免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1195 | 回复: 0
打印 上一主题 下一主题

安装VNCserver [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-08-11 21:51 |只看该作者 |倒序浏览
cnetos 5.2
[root@AA/]# rpm -qa|grep vnc
vnc-4.1.2-9.el5
vnc-server-4.1.2-9.el5
安装系统时选择安装好。
下面是安装时的源程序:
一、vi /etc/sysconfig/vncservers
# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the lines below to start a VNC server on display :2
# as my 'myusername' (adjust this to your own).  You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.  
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted!  For a secure way of using VNC, see
# .
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
# Use "-nohttpd" to prevent web-based VNC clients connecting.
# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel.  See the "-via" option in the
# `man vncviewer' manual page.
# VNCSERVERS="2:myusername"
# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"
用下面的源程序覆盖上面的就OK了,用网上提供给的,会出错的,我TEST。
#
# Uncomment the line below to start a VNC server on display :1
# as my 'myusername' (adjust this to your own).   You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted!   For a secure way of using VNC, see
#
URL:http://www.uk.research.att.com/vnc/sshvnc.html
>.
# VNCSERVERS="1:myusername"
# VNCSERVERS="1:mes 2:xiaofu" # use the method for more user
VNCSERVERS="2:root"
# VNCSERVERARGS[1]="-geometry 800x600"
VNCSERVERARGS[2]="-geometry 1024x768"
二、设置 root用户的密码,使用如下命令设置密码:vncpasswd,当提示Verify时,再次输入密码确认。
三、启动VNC服务,service vncserver start 。当显示如下信息时,表示启动成功:
Starting VNC server: 2:root                [   OK   ]
四、修改VNC SERVER的窗口管理器
vnc server默认使用的窗口管理器是twn,这是一个非常简单的窗口管理器,我们可以改成常用的GNOME或者KDE。
先使用如下命令进入用户的home目录:
cd ~/.vnc
编辑启动项:

vi xstartup  
按照如下方式修改启动项:

#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
gnome-session &     #以GNOME作为VNC的窗口管理器
#startkde &                 #kde desktop
#twm &                        #注掉系统默认的窗口管理器

五、重启VNC SERVER
     六、关键的,在CENTOS5.2 里系统--首选项-共享里选二个。然后在系统FIREWALL 里其它端口里添加:5901 TCP 。就可以使用VNC Viewer了。或是使用下面的方法:
有 root 操作
vi /etc/sysconfig/iptables
增加 下面的 记录
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT
5901 为默认桌面 1 的端口号
如果VNCSERVERS="2:root" 是"2", 端口号就是"5902"


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/103248/showart_2024831.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP