在rhel5.4上配置vnc,默认都已经安装
1.修改VNC配置文件:
vi /etc/sysconfig/vncservers
# The VNCSERVERS variable is a list of display:user pairs.
#
# 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="2:oracle" 增加oracle用户,用户号为2,端口为5902
2. 设置VNC密码
依次执行如下命令:
切换oracle用户:su – oracle
设置密码:vncpasswd
Password:
Verify:
3.切换到root启动vncserver:
/sbin/service vncserver start
Starting VNC server: 1:tchung [ OK ]
修改
vi /home/oracle/.vnc/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" & twm &
4.重新启动VNCSERVER:
/sbin/service vncserver restart
在VNC VIEWER输入IP:2 就可以联上了
注意: 在/root/.vnc/目录下有成对的log和pid文件,名如 machineName:1.pid和 machineName:1.log
有文件的pid是活动的服务,服务号码就是pid前面的数字。没有pid文件的是已经停止的服务。
可以使用 vncserver :号码 启动停止的服务
可以使用 vncserver -kill :号码 停止服务