一,实验环境
Server:CentOS 6.5 x86_64@H_301_7@
Client: Windows 7@H_301_7@
二,安装和配置VNC
1. 安装软件@H_301_7@
[root@gxh~]#yuminstalltigervnc-server-y
[root@gxh~]#vim/etc/sysconfig/vncservers 找到最后两行,去掉注释,修改为 VNCSERVERS="1:root"###第一个远程连接的账户为root VNCSERVERARGS[1]="-geometry1200x900" ###root远程登录分辨率为1200x900
3. 启动vnc@H_301_7@
[root@gxh~]#vncserver Youwillrequireapasswordtoaccessyourdesktops. Password:###这里输入连接远程桌面的密码 Verify:###再次输入密码 xauth:(stdin):1:baddisplayname"gxh:1"in"add"command New'gxh:1(root)'desktopisgxh:1 Creatingdefaultstartupscript/root/.vnc/xstartup Startingapplicationsspecifiedin/root/.vnc/xstartup Logfileis/root/.vnc/gxh:1.log
[root@gxh~]#vim.vnc/xstartup 将最后两行注释掉,在最后一行添加如下: #xterm-geometry80x24+10+10-ls-title"$VNCDESKTOPDesktop"& #twm& gnome-session&
5. 设置vncserver开机启动@H_301_7@
[root@gxh~]#chkconfigvncserveron
6. 设置防火墙@H_301_7@
VNCserver 监听的端口从 5900 开始,display:1 监听 5901,display:2监听 5902,以此类推。@H_301_7@
[root@gxh~]#iptables-IINPUT-mstate--stateNEW-mtcp-ptcp--dport5901-jACCEPT [root@gxh~]#serviceiptablessave
7. VNC Server配置完成@H_301_7@
三,客户端
1. 安装vnc客户端@H_301_7@
2. 远程连接vnc服务器@H_301_7@
四,扩展命令
[root@gxh~]#vncserver xauth:(stdin):1:baddisplayname"gxh:2"in"add"command New'gxh:2(root)'desktopisgxh:2 Startingapplicationsspecifiedin/root/.vnc/xstartup Logfileis/root/.vnc/gxh:2.log
2. 列出所有display@H_301_7@
[root@gxh~]#vncserver-list TigerVNCserversessions: XDISPLAY#PROCESSID :12403 :22998
[root@gxh~]#vncserver-kill:2 KillingXvncprocessID2998 [root@gxh~]#vncserver-list TigerVNCserversessions: XDISPLAY#PROCESSID :12403
[root@gxh~]#vncpasswd Password: Verify: