1.確認有安裝vnc
[root@Linux1 root]# rpm -qa |grep vnc
vnc-server-3.3.3r2-18.6
vnc-3.3.3r2-18.6
[root@Linux1 root]#
2.設置vncserver為開機自啟動
[root@Linux1 root]#setup
┌────────┤ Choose a Tool ├─────────┐
│ │
│ Authentication configuration │
│ Firewall configuration │
│ Keyboard configuration │
│ Mouse configuration │
│ Network configuration │
│ Printer configuration │
│ System services │
│ Timezone configuration │
│ X configuration │
│ │
│ │
│ ┌──────────┐ ┌──────┐ │
│ │ Run Tool │ │ Quit │ │
│ └──────────┘ └──────┘ │
│ │
│ │
└───────────────────────────┘
choose [System services] ==>[enter]
┌──────────┤ Services ├───
│ │
│ What services should be automatically started? │
│ │
│ [ ] talk ▒ │
│ [ ] telnet ▒ │
│ [ ] time ▒ │
│ [ ] time-udp ▒ │
│ [ ] tux ▒ │
│ [*] vncserver # │
│ [ ] winbind ▒ │
│ [ ] xfs ▒ │
│ │
│ ┌────┐ ┌────────┐ │
│ │ Ok │ │ Cancel │ │
│ └────┘ └────────┘ │
└──────────────────────── ┘
choose [vncserver] ==>Tab [OK] ==>Tab [Quit]
3.切換到要使用vnc的user account下找到xstartup這個文件(for e.g. root)
[root@Linux1 .vnc]# pwd
/root/.vnc
[root@Linux1 .vnc]# ls xstartup
xstartup
[root@Linux1 .vnc]#
4.修改xstartup這個文件讓在用vnc連到server是顯示為KDE or GNOME
vncserver default開啟的是XDM
[root@Linux1 .vnc]# vi xstartup
#!/bin/sh
#xrdb $HOME/.Xresources
#xsetroot -solid grey
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &
#exec /etc/X11/xinit/xinitrc
#add by vongates for gnome
gnome-session
#if you use KDE,Please add follow line
#startkde
#add end
~
5.啟動VNC
[root@Linux1 .vnc]# vncserver
New 'X' desktop is Linux1.com.cn:1
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/Linux1.com.cn:1.log
[root@Linux1 .vnc]# vncserver
Warning: Linux1.com.cn:2 is taken because of /tmp/.X11-unix/X2
Remove this file if there is no X server Linux1.com.cn:2
New 'X' desktop is Linux1.com.cn:3
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/Linux1.com.cn:3.log
[root@Linux1 .vnc]# ps -aux |grep vnc
root 24930 0.2 0.1 5660 3540 pts/2 S 13:08 0:00 Xvnc :1 -desktop
root 25124 0.2 0.1 4880 3100 pts/2 S 13:09 0:00 Xvnc :3 -desktop
root 25479 0.0 0.0 1740 600 pts/2 S 13:12 0:00 grep vnc
[root@Linux1 .vnc]#
6.關閉VNC
[root@Linux1 .vnc]# vncserver -kill :1
Killing Xvnc process ID 24930
[root@Linux1 .vnc]# vncserver -kill :3
Killing Xvnc process ID 25124
[root@Linux1 .vnc]# ps -aux |grep vnc
root 25497 0.0 0.0 1736 588 pts/2 S 13:13 0:00 grep vnc
[root@Linux1 .vnc]#
7.變更vncserver的密碼
[root@Linux1 .vnc]# vncpasswd
Password:
Verify:
[root@Linux1 .vnc]#
8.vncserver --help
[root@Linux1 .vnc]# vncserver --help
usage: vncserver [:
[-geometry
[-pixelformat rgbNNN|bgrNNN]
vncserver -kill
[root@Linux1 .vnc]#
9.VNC Client如何連接上server
a.)
b.)在windows下的通過vncview這個應用程式
c.)在Linux下的run中輸入vncviewer
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29987/viewspace-51630/,如需转载,请注明出处,否则将追究法律责任。