1.安裝所需的組件
伺服器的組件名叫 vnc-server。請執行 rpm -q vnc-server 這個指令。
它的輸出應該是 package vnc-server is not installed 或類似 vnc-server-4.0-11.el4。
假如伺服器未被安裝,請用這個指令來安裝它:yum install vnc-server。
2.設定使用者的 VNC 口令
執行vncpasswd,輸入並確認密碼
3./etc/sysconfig/vncservers
VNCSERVERS="1:root 2:root 3:root"
VNCSERVERARGS[1]="-geometry 640x480"
VNCSERVERARGS[2]="-geometry 800x600"
VNCSERVERARGS[3]="-geometry 1024x768"
三個root,不同的解析度,當然可以設定不能的使用者
4.建立 xstartup 指令碼,啟動vncserver,再停止
service vncserver start
service vncserver stop
vncserver :1
vncserver -kill :1
5.編輯 xstartup
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" & #注釋掉
#twm & #text
gnome-session & #gnome
#startkde & #kde
6.重啟vncserver
service vncserver start
chkconfig on
7.使用vncviewer輸入ip:1,輸入vnc密碼成功進入
done
中文wiki有更詳細的配置:
http://wiki.centos.org/zh/HowTos/VNC-Server