Last login: Tue Jul 23 21:43:24 2013 from 192.168.88.1
[root@node1 ~]#
安装vncserver rpm包:
[root@node1 ~]# ll
total 1752
-rw-------. 1 root root 2105 Jun 6 22:36 anaconda-ks.cfg
drwxr-xr-x. 2 root root 4096 Jun 6 14:44 Desktop
drwxr-xr-x. 2 root root 4096 Jun 6 14:44 Documents
drwxr-xr-x. 2 root root 4096 Jun 6 14:44 Downloads
-rw-r--r--. 1 root root 67215 Jun 6 22:36 install.log
-rw-r--r--. 1 root root 12558 Jun 6 22:33 install.log.syslog
drwxrwxrwx 9 406 disk 4096 Jul 23 21:56 lrzsz-0.12.20
-rw-r--r-- 1 root root 280938 Dec 3 2011 lrzsz-0.12.20.tar.gz
drwxr-xr-x. 2 root root 4096 Jun 6 14:44 Music
drwxr-xr-x. 2 root root 4096 Jun 6 14:44 Pictures
drwxr-xr-x. 2 root root 4096 Jun 6 14:44 Public
drwxr-xr-x. 2 root root 4096 Jun 6 14:44 Templates
-rw-r--r-- 1 root root 1112724 Nov 10 2011 tigervnc-server-1.0.90-0.17.20110314svn4359.el6.x86_64.rpm
drwxr-xr-x. 2 root root 4096 Jun 6 14:44 Videos
[root@node1 ~]#
[root@node1 ~]#
[root@node1 ~]# rpm -ihv tigervnc-server-1.0.90-0.17.20110314svn4359.el6.x86_64.rpm
warning: tigervnc-server-1.0.90-0.17.20110314svn4359.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:tigervnc-server ########################################### [100%]
[root@node1 ~]#
[root@node1 ~]#
[root@node1 ~]# 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 this URL:
# http://kbase.redhat.com/faq/docs/DOC-7028
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
# 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="1:root"
VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"
~
红色部分两行必须要打开注释启用。
VNCSERVERARGS不能与VNCSERVERS同一个端口。
修改vnc password:
[root@node1 sysconfig]# vncpasswd
Password:
Verify:
[root@node1 sysconfig]#
[root@node1 sysconfig]# cd ~
启动服务一次,生成 /root/.vnc/xstartup:
[root@node1 .vnc]#
[root@node1 .vnc]# vncserver
xauth: creating new authority file /root/.Xauthority
xauth: (stdin):1: bad display name "node1:1" in "add" command
New 'node1:1 (root)' desktop is node1:1
Creating default startup script. /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/node1:1.log
[root@node1 .vnc]#
[root@node1 .vnc]# ll
total 16
-rw-r--r-- 1 root root 1327 Jul 23 22:38 node1:1.log
-rw-r--r-- 1 root root 5 Jul 23 22:38 node1:1.pid
-rw------- 1 root root 8 Jul 23 22:37 passwd
-rwxr-xr-x 1 root root 654 Jul 23 22:38 xstartup
修改xstartup文件:
[root@node1 .vnc]# vi xstartup
#!/bin/sh
[ -r /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n
export LANG
export SYSFONT
vncconfig -iconic &
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
OS=`uname -s`
if [ $OS = 'Linux' ]; then
case "$WINDOWMANAGER" in
*gnome*)
if [ -e /etc/SuSE-release ]; then
PATH=$PATH:/opt/gnome/bin
export PATH
fi
;;
esac
fi
if [ -x /etc/X11/xinit/xinitrc ]; then
exec /etc/X11/xinit/xinitrc
fi
if [ -f /etc/X11/xinit/xinitrc ]; then
exec sh /etc/X11/xinit/xinitrc
fi
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &
gnome-session &
~
将默认的twm注释掉,添加gnome-session &项。
手工kill掉vncserver进程,再重启vncserver:
[root@node1 .vnc]# vncserver -list
TigerVNC server sessions:
X DISPLAY # PROCESS ID
:1 5599
[root@node1 .vnc]# vncserver -kill :1
Killing Xvnc process ID 5599
[root@node1 .vnc]#
[root@node1 ~]# service vncserver start 或者 vncserver start 或者 /etc/init.d/vncserver start
Starting VNC server: 2:root xauth: (stdin):1: bad display name "node1:2" in "add" command
New 'node1:2 (root)' desktop is node1:2
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/node1:2.log
[ OK ]
[root@node1 ~]#
[root@node1 ~]# vncserver -list
TigerVNC server sessions:
X DISPLAY # PROCESS ID
:2 8340
启动client端:
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7220098/viewspace-766952/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/7220098/viewspace-766952/