首页 / 操作系统 / Linux / Linux AS4下安装VNC4.0
在Linux AS4上安裝VNC 4.01. 由www.realvnc.com 下載VNC 4.0 for Linux2. cd root --> tar -zxvf vnc-4.0-x86_linux.tar.gz3. cd vnc-4.0-x86_linux4. ./vncinstall /usr/local/bin /usr/local/man5. mkdir -p /usr/local/vnc/classes6. cp java/* /usr/local/vnc/classes7. cp vncviewer vncserver vncpasswd Xvnc /usr/local/bin8. cd /root --> mkdir .vnc9. cd .vnc --> 用指令vncpasswd去設密碼10. 若出現沒有"libstdc++-libc6.1-1.so.2"的錯誤,則要安裝:rpm -ivh compat-libstdc++-7.3-2.96.126.i386.rpm11. 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~5910iptables -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 ACCEPT15. 在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