RHEL 5.1下安裝VNC新手教程與常見問題
今天裝了下VNC,解決了不少問題,寫個教學貼,給新手們看看,如果你們碰到同樣的問題,就可以迅速解決,無需頭疼甚至放棄了。
系統(tǒng)環(huán)境
VM+RHEL5.1 [root@localhost .vnc]# uname -r 2.6.18-53.el5xen
本地XP系統(tǒng)安裝VNCVIEW去控制VM中的RHEL5.1
下面在LINUX上安裝VNCSERVER
1、去www.realvnc.com去下載免費版for x86 linux
2、下載是一個tar.gz文件,解壓后進入文件夾,里面有個README,請注意這塊不要下載RPM包,依賴問題以及包頭的安全簽名會讓你很郁悶的。
3、解壓縮,進入該文件夾,按照readme 要求執(zhí)行4步
% ./vncinstall /usr/local/bin % ./vncinstall /usr/local/bin /usr/local/man % mkdir -p /usr/local/vnc/classes % cp java/* /usr/local/vnc/classes
4、啟動VNCSERVER,輸入連接密碼
5、可能會提示linux1x: error while loading shared libraries: libstdc++-libc6.2-2.so.3: cannot open shared object file: No such file or directory
去下載libstdc++-libc6.2-2.so.3,放到/usr/lib里面,(這個我碰到了,通過下載這個SO文件解決了)
下面這個方法在這個版本中不可取,我已經試過,是無效的
在我的系統(tǒng)上ls命令的結果是 libstdc++.so.5.0.7 libstdc++.so.6.0.8
libstdc++.so.6.0.8就是我們要找的,給它做個鏈接
代碼:
$ sudo ln -s libstdc++.so.6.0.8 libstdc++-libc6.2-2.so.3
會出現(xiàn)如下錯誤:
vncpasswd: symbol lookup error:vncpasswd: undefined symbol: __builtin_vec_new
看到這個錯感覺就是那兩個庫不一樣造成的字符未定義
6、繼續(xù)啟動vncserver,可能還有錯誤,如下
vncext: VNC extension running! vncext: Listening for VNC connections on port 5901 vncext: Listening for HTTP connections on port 5801 vncext: created VNC server for screen 0 error opening security policy file /usr/X11R6/lib/X11/xserver/SecurityPolicy Could not init font path element /usr/X11R6/lib/X11/fonts/misc/, removing from list! Could not init font path element /usr/X11R6/lib/X11/fonts/Speedo/, removing from list! Could not init font path element /usr/X11R6/lib/X11/fonts/Type1/, removing from list! Could not init font path element /usr/X11R6/lib/X11/fonts/CID/, removing from list! Could not init font path element /usr/X11R6/lib/X11/fonts/75dpi/, removing from list! Could not init font path element /usr/X11R6/lib/X11/fonts/100dpi/, removing from list!
Fatal server error: could not open default font 'fixed' xsetroot: unable to open display 'localhost.localdomain:1' vncconfig: unable to open display "localhost.localdomain:1" Warning: This program is an suid-root program or is being run by the root user. The full text of the error or warning message cannot be safely formatted in this environment. You may get a more descriptive message by running the program as a non-root user or by removing the suid bit on the executable. xterm Xt error: Can't open display: %s
原因:vncserver默認尋找的X系統(tǒng)的字體路徑在/usr/X11R6/lib/X11/fonts/下,但RHEL5卻在/usr /share/X11/fonts/下
解決:
mkdir /usr/X11R6/lib cd /usr/X11R6/lib ln -s /usr/share/X11 X11
#p#
7、在XP上啟用vncview,注意,這個里面填寫的IP地址加桌面號,一般是1,但是如果有多人登錄桌面可能就不是1,需要詢問管理員,如下格式:192.168.1.102:1
[root@localhost ~]# netstat -an |grep 01 tcp 0 0 0.0.0.0:5801 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN
8 、VNC連接成功后,發(fā)現(xiàn)只有TWM界面,不是傳說中的桌面,修改如下
去掉中以下兩行前面的#號,讓vnc加載默認圖形界面程序
# unset SESSION_MANAGER # exec /etc/X11/xinit/xinitrc
這兩行可能有些文件中沒有,需要手動添加,沒有是顯示不了桌面的
修改下面這個東西
把***一行 twm& 改成------->gonme-session &
附:我的配置文件
#!/bin/sh
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources unset SESSION_MANAGER exec /etc/X11/xinit/xinitrc xsetroot -solid grey vncconfig -iconic & xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & gnome-session & ~
9、日志文件中的錯誤
日志文件位置在root主目錄下的隱藏文件 /root/.vnc/localhost.localdomain:1.log 或者是2.log上,這個1和2的區(qū)別就是桌面號了,不同的桌面號對應的不同的LOG文件
error opening security policy file /usr/X11R6/lib/X11/xserver/SecurityPolicy Could not init font path element /usr/X11R6/lib/X11/fonts/Speedo/, removing from list! Could not init font path element /usr/X11R6/lib/X11/fonts/CID/, removing from list!
這個幾個錯誤一直存在,但是目前沒有發(fā)現(xiàn)VNC異常運行。這個問題還有待研究。
BTW:一般桌面號啟動都是1,可以通過命令來控制vncserver :10 那這樣桌面號就變成10,登錄的時候就是XX.XX.XX.XX:10就OK了
10、把VNC加入服務,每次啟動自動開啟這個就不用說了,chkconfig add即可。
11、如果要在vnc里使用中文輸入法,在.vnc/xstartup文件里加上“scim -d”
【編輯推薦】