部署VNC Server及VNC Server的高级应用
- 格式:docx
- 大小:40.17 KB
- 文档页数:8
• 安装VNC服务端view sourceprint?1.[root@rhel6 ~]# rpm -q tigervnc-server2.tigervnc-server-1.0.90-0.17.20110314svn4359.el6.x86_64启动VNC服务view sourceprint?01.[root@rhel6 ~]# vncserver #第一次启动display :1(第一张虚拟纸,依次类推),可通过vncserver :2 启动display:202.03.New ':1 (root)' desktop is :104.05.Starting applications specified in /root/.vnc/xstartup06.Log file is /root/.vnc/:1.log07.08.[root@rhel6 ~]# /etc/init.d/vncserver status09.Xvnc (pid 2182) is running...•修改VNC Server配置文件view sourceprint?01.[root@rhel6 ~]# cat /etc/sysconfig/vncservers #启动vncserver后才生成02.# The VNCSERVERS variable is a list of display:user pairs.03.#04.# Uncomment the lines below to start a VNC server on display :205.# as my 'myusername' (adjust this to your own). You will also06.# need to set a VNC password; run 'man vncpasswd' to see how07.# to do that.08.#09.# DO NOT RUN THIS SERVICE if your local area network is10.# untrusted! For a secure way of using VNC, see this URL:11.# /faq/docs/DOC-702812.13.# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.14.15.# Use "-localhost" to prevent remote VNC clients connecting except when16.# doing so through a secure tunnel. See the "-via" option in the17.# `man vncviewer' manual page.18.19.# VNCSERVERS="2:myusername"20.# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"21.VNCSERVERS="2:xfcy 3:root" #设置在vncserver启动2个display,且display:2,:3的用户权限分别为xfcy,root22.VNCSERVERARGS[2]="-geometry 800x600"23.VNCSERVERARGS[3]="-geometry 800x600 -localhost" #设置display:2的分辨率为800×600且只监听本地•设置VNC密码(保存在~/.vnc/passwd中),同时自动生成~/.vnc/xstartup(在每次启动VNC服务时候,都会读取该文件中的配置信息)view sourceprint?1.[root@rhel6 ~]# vncpasswd2.Password:3.Verify:•修改xstartup配置文件view sourceprint?01.[root@rhel6 ~]# cat ~/.vnc/xstartup02.#!/bin/sh03.04.[ -r /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n05.export LANG06.export SYSFONT07.vncconfig -iconic &08.unset SESSION_MANAGER09.unset DBUS_SESSION_BUS_ADDRESS10.OS=`uname -s`11.if [ $OS = '<a class="keylink" href="/os/oslin/" target="_blank">Linux</a>' ]; then12. case "$WINDOWMANAGER" in13. *gnome*)14. if [ -e /etc/SuSE-release ]; then15. PATH=$PATH:/opt/gnome/bin16. export PATH17. fi18. ;;19. esac20.fi21.if [ -x /etc/X11/xinit/xinitrc ]; then22. exec /etc/X11/xinit/xinitrc23.fi24.if [ -f /etc/X11/xinit/xinitrc ]; then25. exec sh /etc/X11/xinit/xinitrc26.fi27.[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources28.xsetroot -solid grey29.#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & #注释掉这两行避免出现黑屏30.#twm &31.32.gnome-session & #登录到GNOME桌面环境33.#startkde & #登录到KDE桌面环境•配置Display:2(即用户权限为xfcy的共享桌面,配置方法同上)view sourceprint?01.[root@rhel6 .vnc]# su - xfcy #必须在对应的用户下设置密码02.[xfcy@rhel6 ~]$ vncserver :203.04.You will require a password to access your desktops.05.06.Password:07.Verify:08.09.New ':2 (xfcy)' desktop is :210.11.Creating default startup script /home/xfcy/.vnc/xstartup12.Starting applications specified in /home/xfcy/.vnc/xstartup13.Log file is /home/xfcy/.vnc/:2.log14.15.[xfcy@rhel6 ~]$ vi .vnc/xstartup16.#!/bin/sh17.18.[ -r /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n19.export LANG20.export SYSFONT21.vncconfig -iconic &22.unset SESSION_MANAGER23.unset DBUS_SESSION_BUS_ADDRESS24.OS=`uname -s`25.if [ $OS = '<a class="keylink" href="/os/oslin/" target="_blank">Linux</a>' ]; then26. case "$WINDOWMANAGER" in27. *gnome*)28. if [ -e /etc/SuSE-release ]; then29. PATH=$PATH:/opt/gnome/bin30. export PATH31. fi32. ;;33. esac34.fi35.if [ -x /etc/X11/xinit/xinitrc ]; then36. exec /etc/X11/xinit/xinitrc37.fi38.if [ -f /etc/X11/xinit/xinitrc ]; then39. exec sh /etc/X11/xinit/xinitrc40.fi41.[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources42.xsetroot -solid grey43.#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &44.#twm &45.46.gnome-session &•重启VNC Server服务view sourceprint?01.[root@rhel6 ~]# /etc/init.d/vncserver restart02.Shutting down VNC server: 2:xfcy 3:root [ OK ]03.Starting VNC server: 2:xfcy04.New ':2 (xfcy)' desktop is :205.06.Starting applications specified in /home/xfcy/.vnc/xstartup07.Log file is /home/xfcy/.vnc/:2.log08.09.3:root10.New ':3 (root)' desktop is :311.12.Starting applications specified in /root/.vnc/xstartup13.Log file is /root/.vnc/:3.log14.15. [ OK ]16.17.[root@rhel6 .vnc]# netstat -lntp | grep 590 #VNC server监听的端口从5900开始,display :1的监听5901,display :2监听5902,以此类推18.19.tcp 0 0 0.0.0.0:5902 0.0.0.0:* LISTEN 3567/Xvnc20.tcp 0 0 127.0.0.1:5903 0.0.0.0:* LISTEN 3649/Xvnc•客户端访问view sourceprint?01.[root@rhel5 ~]# vncviewer 192.168.1.119:302.03.VNC Viewer Free Edition 4.1.2 for X - built Jan 26 2009 11:52:0804.Copyright (C) 2002-2005 RealVNC Ltd.05.See for information on VNC.06.07.Sun Nov 18 23:17:16 201208. CConn: connected to host 192.168.1.119 port 590309. CConnection: Server supports RFB protocol version 3.810. CConnection: Using RFB protocol version 3.811.12.Sun Nov 18 23:17:18 201213. TXImage: Using default colormap and visual, TrueColor, depth 16.14. CConn: Using pixel format depth 6 (8bpp) rgb22215. CConn: Using ZRLE encoding16.17.Sun Nov 18 23:17:21 201218. CConn: Throughput 20476 kbit/s - changing to hextile encoding19. CConn: Throughput 20476 kbit/s - changing to full colour20. CConn: Using pixel format depth 16 (16bpp) little-endian rgb56521. CConn: Using hextile encoding•通过SSH加密VNC的远程连接view sourceprint?01.[root@rhel5 ~]# vncviewer -via 192.168.1.119 :202.03.VNC Viewer Free Edition 4.1.2 for X - built Jan 26 2009 11:52:0804.Copyright (C) 2002-2005 RealVNC Ltd.05.See for information on VNC.06.The authenticity of host 'rhel6 (192.168.1.119)' can't be established.07.RSA key fingerprint is 1a:cf:92:de:28:7d:f2:e0:e8:e6:ad:f1:7c:40:6a:67.08.Are you sure you want to continue connecting (yes/no)? yes09.Warning: Permanently added 'rhel6' (RSA) to the list of known hosts.10.root@rhel6's pass<a class="keylink" href="/edu/ebg/" target="_blank">word</a>:11.12.Tue Nov 20 01:12:37 201213. CConn: connected to host localhost port 559914. CConnection: Server supports RFB protocol version 3.815. CConnection: Using RFB protocol version 3.816.17.Tue Nov 20 01:12:39 201218. TXImage: Using default colormap and visual, TrueColor, depth 16.19. CConn: Using pixel format depth 6 (8bpp) rgb22220. CConn: Using ZRLE encoding21.22.Tue Nov 20 01:12:41 201223. CConn: Throughput 20588 kbit/s - changing to hextile encoding24. CConn: Throughput 20588 kbit/s - changing to full colour25. CConn: Using pixel format depth 16 (16bpp) little-endian rgb56526. CConn: Using hextile encoding•关闭已启用的display:2view sourceprint?1.[xfcy@rhel6 ~]$ vncserver -kill :2 #必须以相应的用户进行操作2.Killing Xvnc process ID 35673.Xvnc seems to be deadlocked. Kill the process manually and then re-run4. /usr/bin/vncserver -kill :25.to clean up the socket files.6.7.[root@rhel6 ~]# netstat -lntp | grep 5908.tcp 0 0 127.0.0.1:5903 0.0.0.0:* LISTEN 6585/Xvnc •通过VNC Server自动抓取客户端的桌面(CatchDesktop)•附:AIX上部署VNC Serverview sourceprint?01.一.安装VNC02.# rpm -ivh vnc-3.3.3r2-6.aix5.1.ppc.rpm03.vnc ##################################################04.05.# rpm -ql vnc06./opt/freeware/bin/Xvnc07./opt/freeware/bin/vncconnect08./opt/freeware/bin/vncpasswd09./opt/freeware/bin/vncserver10./opt/freeware/bin/vncviewer11./opt/freeware/doc/vnc-3.3.3r212./opt/freeware/doc/vnc-3.3.3r2/LICENCE.TXT13./opt/freeware/doc/vnc-3.3.3r2/README14./opt/freeware/share/vnc/classes15./opt/freeware/share/vnc/classes/DesCipher.class16./opt/freeware/share/vnc/classes/animatedMemoryImageSource.class17./opt/freeware/share/vnc/classes/authenticationPanel.class18./opt/freeware/share/vnc/classes/clipboardFrame.class19./opt/freeware/share/vnc/classes/index.vnc20./opt/freeware/share/vnc/classes/optionsFrame.class21./opt/freeware/share/vnc/classes/rfbProto.class22./opt/freeware/share/vnc/classes/shared.vnc23./opt/freeware/share/vnc/classes/vncCanvas.class24./opt/freeware/share/vnc/classes/vncviewer.class25./opt/freeware/share/vnc/classes/vncviewer.jar26./opt/freeware/vnc27./usr/lpp/X11/bin/Xvnc28./usr/lpp/X11/bin/vncconnect29./usr/lpp/X11/bin/vncpasswd30./usr/lpp/X11/bin/vncserver31./usr/lpp/X11/bin/vncviewer32.33.34.二.编辑配置文件:/opt/freeware/bin/vncserver35.1.修改前:36.# $cmd .= " -fp /usr/lib/X11/fonts/,/usr/lib/X11/fonts/misc/,/usr/lib/X11/fonts/75dpi/";37.修改后:(去掉注释,即加入了fonts)38.$cmd .= " -fp /usr/lib/X11/fonts/,/usr/lib/X11/fonts/misc/,/usr/lib/X11/fonts/75dpi/";39.$cmd .= " -ac -fp /usr/lib/X11/fonts/,/usr/lib/X11/fonts/misc/,/usr/lib/X11/fonts/75dpi/"; (若出现灰屏则设置为此)40.2.修改前:41.$vncClasses = "/usr/local/vnc/classes";42.修改后:43.$vncClasses = "/opt/freeware/vnc/classes";44.45.# cat /opt/freeware/bin/vncserver | egrep "font|vncClasses" | grep -v ^#46.$vncClasses = "/opt/freeware/vnc/classes";47.$cmd .= " -fp /usr/lib/X11/fonts/,/usr/lib/X11/fonts/misc/,/usr/lib/X11/fonts/75dpi/,/usr/lib/X11/fonts/100dpi /,/usr/lib/X11/fonts/ibm850/,/usr/lib/X11/fonts/Type1/";48.49.50.三.如果要使用CDE界面(AIX下的XWindow,类似于Redhat的GNOME)51.# vi ~/.vnc/xstartup52.#!/bin/sh53.54.xrdb $HOME/.Xresources55.xsetroot -solid grey56.xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &57.# twm & #注释掉原来的配置58./usr/dt/bin/dtsession & #添加CDE界面的session59.60.四.启动vncserver61.# su oracle62.$ vncserver63.64.You will require a pass<a class="keylink" href="/edu/ebg/" target="_blank">word</a> to access your desktops.65.66.Password:67.Verify:68.69.New 'X' desktop is fjkf:170.71.Creating default startup script /home/oracle/.vnc/xstartup72.Starting applications specified in /home/oracle/.vnc/xstartup73.Log file is /home/oracle/.vnc/fjkf:1.log延伸阅读:∙1、linux下配置VNC服务端∙2、CentOS6下VNC的安装与配置∙3、Ubuntu server配置远程VNC服务∙4、使用VNC实现LINUX与windows的相互远程控制∙5、aix5.3下配置vnc远程控制软件∙6、配置VNC远程登录Linux主机∙7、VNCserver & VNCviewer Setup∙8、配置Linux系统远程桌面vnc服务。