其實其它linux平臺也差不多。
VNC client software (tightVNC, you can download it here.)
RHEL下默認有了Xvnc,只是服務沒有啟動,免安裝。
下面啟動vnc服務:
# service vncserver startStarting VNC server: [ OK ]# vncpasswdPassword: Verify: # vncserverNew 'roswell:1 (root)' desktop is roswell:1Starting applications specified in /root/.vnc/xstartupLog file is /root/.vnc/roswell:1.log此時可以通過vnc客戶端軟件(端口默認5901)或瀏覽器(端口默認5801,如 http://192.168.0.1:5801 )登陸,輸入剛才設置的密碼。此時默認不是gnome或kde界面,如果不想使用默認的twm,還有修改用戶主目錄下.vnc目錄里的xstartup(注意這個文件是在vnc client登陸后自動生成的):# 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" &
startx &
然后再重啟vncserver即可,目前都是以root身份登陸的,太危險了。
需要設置具體登陸的用戶和分辨率,可以修改/etc/sysconfig/vncservers文件:
# 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:oracle"
VNCSERVERARGS[1]="-geometry 1024x768"
/etc/sysconfig/vncserver要這樣設置:
為每個你允許使用vnc的用戶添加兩行
VNCSERVERS="x:username"
VNCSERVERARGS[x]="-geometry 800x600 -query localhost"
這里,第一行中x>0,5800+x和5900+x分別是vnc監聽的端口,前者是使用http協議的,第二行是設置該用戶vnc進程的參數。
例如:
VNCSERVERS="3:foo"
VNCSERVERARGS[3]="-geometry 800x600 -query localhost"
表示用戶foo可以通過 http://serverip:5803/ 或用vnc viewer連接serverip:5903 來訪問。
最后,要為每個使用vnc的用戶用vncpasswd命令設置訪問口令。
重啟vncserver:
# service vncserver status
Xvnc (pid 5718) is running...
# service vncserver restart
Shutting down VNC server: [ OK ]
Starting VNC server: [ OK ]
# service vncserver status
Xvnc (pid 5718) is running...
# kill 5718
# kill 5718
-bash: kill: (5718) - No such process
# service vncserver start
Starting VNC server: 1:oracle [ OK ]
# service vncserver status
Xvnc (pid 7679) is running...
#
posted on 2009-12-22 18:16
老馬驛站 閱讀(535)
評論(0) 編輯 收藏 引用 所屬分類:
linux