Linux AS4下安装VNC4.0


在Linux AS4上安裝VNC 4.0

1. 由www.realvnc.com 下載VNC 4.0 for Linux

2. cd root --> tar -zxvf vnc-4.0-x86_linux.tar.gz

3. cd vnc-4.0-x86_linux

4. ./vncinstall /usr/local/bin /usr/local/man

5. mkdir -p /usr/local/vnc/classes

6. cp java/* /usr/local/vnc/classes

7. cp vncviewer vncserver vncpasswd Xvnc /usr/local/bin

8. cd /root --> mkdir .vnc

9. cd .vnc --> 用指令vncpasswd去設密碼

10. 若出現沒有"libstdc++-libc6.1-1.so.2"的錯誤,則要安裝:

rpm -ivh compat-libstdc++-7.3-2.96.126.i386.rpm

11. cd .vnc --> vncserver --> vi xstartup

源内容:
# 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 &

如果用这个默认的启动vncserver,出现的是twm窗口。把xstartup修改成为:

# 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 &

就会启动gnome桌面的。

或者用改成以下内容:

#!/bin/sh
gnome-session &

若以KDE启动X-Window, 則用以下一行代替上行

startkde &

12.如果第11步gnome界面启动成功不需要这个设置:

#vi /usr/local/bin/vncserver
把$defaultXStartup里的内容改成第11步的内容

13. 每次reboot Linux後, 需在.vnc目錄下

rm -Rf *.* <--- 刪除log和pid檔
再执行指令vncserver方行.

14. 令Firewall允許port 5800 ~ 5810和5900~5910

iptables -A INPUT -p tcp -s 192.168.1.0/24 --dport 5800:5810 -j ACCEPT
iptables -A INPUT -p tcp -s 192.168.1.0/24 --dport 5900:5910 -j ACCEPT

15. 在Client机上

用VNC View则: 192.168.1.1:5901 (不一定是5901,看.log檔)
用IE則输入: http://192.168.1.1:5801/
(我自己试验冒号后面不用端口号,后面用起的id,见使用方法,支持多用户)
使用方法:
1.#cd /root/.vnc
2.#ls
3.if(localhost.localdomain:2.log)and(localhost.localdomain:2.pid)
#vncserver -kill :2
#rm localhost.localdomain:2.log
4.#vncserver
remember this id,e.g.3
5.client:VNC View:192.168.1.1:3

相关内容