VNC使您可以远程访问和控制您的计算机从另一计算机或移动设备上,无论你在世界的任何地方。常见的使用情形,包括给同事和朋友提供桌面支持、远程管理您的服务器。
将VNCServer部署到您想要控制计算机,使用VNCViewer连接到你想要控制的计算机。
安装服务:
yuminstalltigervnc-server
这名称有点怪,没用过不知道的话是猜测不到的。
[root@localhost ~]# yum install tigervnc-server
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirror.bit.edu.cn
* extras: mirrors.yun-idc.com
* updates: mirrors.yun-idc.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package tigervnc-server.x86_64 0:1.1.0-8.el6_5 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================
Installing:
tigervnc-server x86_64 1.1.0-8.el6_5 updates 1.1 M
Transaction Summary
===============================================================================================================================================================================================
Install 1 Package(s)
Total download size: 1.1 M
Installed size: 2.9 M
Is this ok [y/N]: y
Downloading Packages:
tigervnc-server-1.1.0-8.el6_5.x86_64.rpm | 1.1 MB 00:02
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : tigervnc-server-1.1.0-8.el6_5.x86_64 1/1
Verifying : tigervnc-server-1.1.0-8.el6_5.x86_64 1/1
Installed:
tigervnc-server.x86_64 0:1.1.0-8.el6_5
Complete!
运行并设置密码:
vncserver:1
注意: vncserver和:1之间必须有空格的。
输入密码,会生成相关的文件
[root@localhost ~]# vncserver :1
You will require a password to access your desktops.
Password:
Verify:
xauth: creating new authority file /root/.Xauthority
New 'localhost.localdomain:1 (root)' desktop is localhost.localdomain:1
Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost.localdomain:1.log
配置用户
vim/etc/sysconfig/vncservers
最后一行加入:
VNCSERVERS="1:root"多个用户用空格分开
实用命令
usage: vncserver [:<number>] [-name <desktop-name>] [-depth <depth>][-geometry <width>x<height>]
[-pixelformat rgbNNN|bgrNNN]
[-fp <font-path>]
[-fg]
<Xvnc-options>...
vncserver -kill <X-display>
vncserver -list
vncserver[:n]开服务
vncserver -list看有几个在运行
vncserver -kill :n 杀掉第几个x-display
vncpasswd 修改密码
服务管理
service vncserver restart其它用法:/etc/init.d/vncserver {start|stop|restart|try-restart|status|force-reload}
chkconfig vncserver on 加入到自启动(chkconfig --level 35 vncserver on)
客户端连接
CentOS:使用TigerVNC Viewer 连接 ip:1
Windows:使用Real VNC Viewer 连接ip:1
输入密码即可访问
错误记录及解决方案:
错误记录:
[root@localhost media]# service vncserver start
Starting VNC server: 1:root
WARNING: The first attempt to start Xvnc failed, possibly because the font
catalog is not properly configured. Attempting to determine an appropriate
font path for this system and restart Xvnc using that font path ...
Could not start Xvnc.
/usr/bin/Xvnc: symbol lookup error: /usr/bin/Xvnc: undefined symbol: pixman_composite_trapezoids
/usr/bin/Xvnc: symbol lookup error: /usr/bin/Xvnc: undefined symbol: pixman_composite_trapezoids
[FAILED]
解决方案:
yum install pixman pixman-devel libXfont
错误记录:
[root@localhost /]# vncserver :1
WARNING: The first attempt to start Xvnc failed, possibly because the font
catalog is not properly configured. Attempting to determine an appropriate
font path for this system and restart Xvnc using that font path ...
Could not start Xvnc.
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
Fatal server error:
Cannot establish any listening sockets - Make sure an X server isn't already running
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
Fatal server error:
Cannot establish any listening sockets - Make sure an X server isn't already running
解决过程:
ps aux |grep -i "xorg|x11"
yum -y groupinstall "GNOME Desktop Environment" CentOS6.5下不能用。
yum groupinstall "X Window System" "KDE (K Desktop Environment)"
rm -rf /tmp/.X11-unix
错误记录:
[root@hn opt]# vncserver :1
Warning: hn.kd.ny.adsl:1 is taken because of /tmp/.X1-lock
Remove this file if there is no X server hn.kd.ny.adsl:1
A VNC server is already running as :1
[root@hn opt]# cp /tmp/.X1-lock X1-lock.bak
[root@hn opt]# rm -rf /tmp/.X1-lock
[root@hn opt]# vncserver :1
Warning: hn.kd.ny.adsl:1 is taken because of /tmp/.X11-unix/X1
Remove this file if there is no X server hn.kd.ny.adsl:1
A VNC server is already running as :1
[root@hn opt]# vncserver :1
Warning: hn.kd.ny.adsl:1 is taken because of /tmp/.X11-unix/X1
Remove this file if there is no X server hn.kd.ny.adsl:1
A VNC server is already running as :1
[root@hn opt]# rm -rf /tmp/.X11-unix/X1
[root@hn opt]# vncserver :1
xauth: creating new authority file /root/.Xauthority
WARNING: The first attempt to start Xvnc failed, possibly because the font
catalog is not properly configured. Attempting to determine an appropriate
font path for this system and restart Xvnc using that font path ...
Could not start Xvnc.
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
Fatal server error:
Cannot establish any listening sockets - Make sure an X server isn't already running
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
Fatal server error:
Cannot establish any listening sockets - Make sure an X server isn't already running
正在启动 VNC 服务器:1:root
WARNING: The first attempt to start Xvnc failed, possibly because the font
catalog is not properly configured. Attempting to determine an appropriate
font path for this system and restart Xvnc using that font path ...
Could not start Xvnc.
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
Fatal server error:
Cannot establish any listening sockets - Make sure an X server isn't already running
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
Fatal server error:
Cannot establish any listening sockets - Make sure an X server isn't already running
[失败]
正在启动 VNC 服务器:1:root
WARNING: The first attempt to start Xvnc failed, possibly because the font
catalog is not properly configured. Attempting to determine an appropriate
font path for this system and restart Xvnc using that font path ...
Could not start Xvnc.
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
Fatal server error:
Cannot establish any listening sockets - Make sure an X server isn't already running
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
Fatal server error:
Cannot establish any listening sockets - Make sure an X server isn't already running
[失败]
执行:setup命令
没有需要的选项;
以下为2014年10月21日安装VNCServer遇到的问题及解决方法
错误记录:
[root@hn]# service vncserver restart
关闭 VNC 服务器: [确定]
正在启动 VNC 服务器:1:root
Warning: hn.kd.ny.adsl:1 is taken because of /tmp/.X1-lock
Remove this file if there is no X server hn.kd.ny.adsl:1
A VNC server is already running as :1
[失败]
[root@hn]# find -name hn.kd.my.ads1:1
[root@hn]# rm -rf /tmp/.X1-lock
[root@hn]#
[root@hn]#
[root@hn]# service vncserver restart
关闭 VNC 服务器: [确定]
正在启动 VNC 服务器:1:root
Warning: hn.kd.ny.adsl:1 is taken because of /tmp/.X11-unix/X1
Remove this file if there is no X server hn.kd.ny.adsl:1
A VNC server is already running as :1
[失败]
[root@hn]# rm -rf /tmp/.X11-unix/X1
[root@hn]# service vncserver restart
关闭 VNC 服务器: [确定]
正在启动 VNC 服务器:1:root
WARNING: The first attempt to start Xvnc failed, possibly because the font
catalog is not properly configured. Attempting to determine an appropriate
font path for this system and restart Xvnc using that font path ...
Could not start Xvnc.
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
Fatal server error:
Cannot establish any listening sockets - Make sure an X server isn't already running
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
Fatal server error:
Cannot establish any listening sockets - Make sure an X server isn't already running
[失败]
[root@hn]#
解决方案:
[root@hn]# init 3
[root@hn]# service vncserver restart
关闭 VNC 服务器: [确定]
正在启动 VNC 服务器:1:root
New 'hn.kd.ny.adsl:1 (root)' desktop is hn.kd.ny.adsl:1
Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/hn.kd.ny.adsl:1.log
[确定]
[root@hn]#