1.啟動vnc服務並設定開機啟動
service vncserver start
chkconfig vncserver on
2.修改 /etc/sysconfig/vncservers檔案內容
VNCSERVERS=”1:root”1代表示port是5901,http port是5801
VNCSERVERARGS[1]=”-geometry 800x600 –depth 16”
3.設定登入密碼
輸入vncpasswd指令
Password:
Verify:
注意:要執行這個要先看設定是用那個帳號,如前面設user,就必需su 到user,在執行vncpasswd 這樣在/home/user/目錄下會產生/.vnc目錄,在/.vnc下會產生passwd檔案;如前面設root,就必需登入為root,再執行vncpasswd這樣在/root/目錄下會產生/.vnc目錄,並在/.vnc下會產生passwd檔案。
4.修改 ~/.vnc/xstartup
#!/bin/sh
#Uncomment the following two lines for normal desktop:
unset SESSION_MANNGER
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
gnome-session &
5.設定修改後需重起服務
service vncserver restart
6.開啟遠端連線
網頁瀏覽 http://IP:5801
VNC IP:5901