1、本次配置源于网络yum源,配置安装之前,请确保网络yum源安装配置正确。
参考:
http://blog.csdn.net/kadwf123/article/details/78231694
2、安装vnc服务包,如果yum源选择的aliyun下一步没有成功,请换成网易源,本例使用网易源
[root@MYDNS yum.repos.d]# yum -y install tigervnc-server Loaded plugins: fastestmirror,security Loading mirror speeds from cached hostfile Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package tigervnc-server.x86_64 0:1.1.0-24.el6 will be installed --> Processing Dependency: pixman >= 0.27.2 for package: tigervnc-server-1.1.0-24.el6.x86_64 --> Processing Dependency: libX11 >= 1.6.0 for package: tigervnc-server-1.1.0-24.el6.x86_64 --> Processing Dependency: xorg-x11-xkb-utils for package: tigervnc-server-1.1.0-24.el6.x86_64 --> Processing Dependency: xorg-x11-fonts-misc for package: tigervnc-server-1.1.0-24.el6.x86_64 --> Processing Dependency: xkeyboard-config for package: tigervnc-server-1.1.0-24.el6.x86_64 --> Processing Dependency: libxshmfence.so.1()(64bit) for package: tigervnc-server-1.1.0-24.el6.x86_64 --> Processing Dependency: libXdmcp.so.6()(64bit) for package: tigervnc-server-1.1.0-24.el6.x86_64 --> Running transaction check ---> Package libX11.x86_64 0:1.5.0-4.el6 will be updated ---> Package libX11.x86_64 0:1.6.4-3.el6 will be an update --> Processing Dependency: libX11-common = 1.6.4-3.el6 for package: libX11-1.6.4-3.el6.x86_64 ---> Package libXdmcp.x86_64 0:1.1.1-3.el6 will be installed ---> Package libxshmfence.x86_64 0:1.2-1.el6 will be installed ---> Package pixman.x86_64 0:0.26.2-4.el6 will be updated ---> Package pixman.x86_64 0:0.32.8-1.el6 will be an update ---> Package xkeyboard-config.noarch 0:2.16-1.el6 will be installed ---> Package xorg-x11-fonts-misc.noarch 0:7.2-11.el6 will be installed ---> Package xorg-x11-xkb-utils.x86_64 0:7.7-12.el6 will be installed --> Processing Dependency: libxkbfile.so.1()(64bit) for package: xorg-x11-xkb-utils-7.7-12.el6.x86_64 --> Running transaction check ---> Package libX11-common.noarch 0:1.5.0-4.el6 will be updated ---> Package libX11-common.noarch 0:1.6.4-3.el6 will be an update ---> Package libxkbfile.x86_64 0:1.0.6-1.1.el6 will be installed --> Processing Conflict: libX11-1.6.4-3.el6.x86_64 conflicts libxcb < 1.9.1-3 --> Restarting Dependency Resolution with new changes. --> Running transaction check ---> Package libxcb.x86_64 0:1.8.1-1.el6 will be updated ---> Package libxcb.x86_64 0:1.12-4.el6 will be an update --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: tigervnc-server x86_64 1.1.0-24.el6 base 1.0 M Updating: libxcb x86_64 1.12-4.el6 base 180 k Installing for dependencies: libXdmcp x86_64 1.1.1-3.el6 base 30 k libxkbfile x86_64 1.0.6-1.1.el6 base 74 k libxshmfence x86_64 1.2-1.el6 base 6.2 k xkeyboard-config noarch 2.16-1.el6 base 802 k xorg-x11-fonts-misc noarch 7.2-11.el6 base 5.8 M xorg-x11-xkb-utils x86_64 7.7-12.el6 base 98 k Updating for dependencies: libX11 x86_64 1.6.4-3.el6 base 587 k libX11-common noarch 1.6.4-3.el6 base 171 k pixman x86_64 0.32.8-1.el6 base 243 k Transaction Summary ================================================================================ Install 7 Package(s) Upgrade 4 Package(s) Total download size: 9.0 M Downloading Packages: (1/11): libX11-1.6.4-3.el6.x86_64.rpm | 587 kB 00:00 (2/11): libX11-common-1.6.4-3.el6.noarch.rpm | 171 kB 00:00 (3/11): libXdmcp-1.1.1-3.el6.x86_64.rpm | 30 kB 00:00 (4/11): libxcb-1.12-4.el6.x86_64.rpm | 180 kB 00:00 (5/11): libxkbfile-1.0.6-1.1.el6.x86_64.rpm | 74 kB 00:00 (6/11): libxshmfence-1.2-1.el6.x86_64.rpm | 6.2 kB 00:00 (7/11): pixman-0.32.8-1.el6.x86_64.rpm | 243 kB 00:00 (8/11): tigervnc-server-1.1.0-24.el6.x86_64.rpm | 1.0 MB 00:00 (9/11): xkeyboard-config-2.16-1.el6.noarch.rpm | 802 kB 00:00 (10/11): xorg-x11-fonts-misc-7.2-11.el6.noarch.rpm | 5.8 MB 00:02 (11/11): xorg-x11-xkb-utils-7.7-12.el6.x86_64.rpm | 98 kB 00:00 ------------------------------------------------------------------------------------------------------------------------------------ Total 1.9 MB/s | 9.0 MB 00:04 warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature,key ID c105b9de: NOKEY Retrieving key from http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 Importing GPG key 0xC105B9DE: Userid: "CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>" From : http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : libxshmfence-1.2-1.el6.x86_64 1/15 Installing : xkeyboard-config-2.16-1.el6.noarch 2/15 Updating : libX11-common-1.6.4-3.el6.noarch 3/15 Updating : libxcb-1.12-4.el6.x86_64 4/15 Updating : libX11-1.6.4-3.el6.x86_64 5/15 Installing : libxkbfile-1.0.6-1.1.el6.x86_64 6/15 Installing : xorg-x11-xkb-utils-7.7-12.el6.x86_64 7/15 Updating : pixman-0.32.8-1.el6.x86_64 8/15 Installing : xorg-x11-fonts-misc-7.2-11.el6.noarch 9/15 Installing : libXdmcp-1.1.1-3.el6.x86_64 10/15 Installing : tigervnc-server-1.1.0-24.el6.x86_64 11/15 Cleanup : libX11-1.5.0-4.el6.x86_64 12/15 Cleanup : libX11-common-1.5.0-4.el6.noarch 13/15 Cleanup : libxcb-1.8.1-1.el6.x86_64 14/15 Cleanup : pixman-0.26.2-4.el6.x86_64 15/15 Verifying : libXdmcp-1.1.1-3.el6.x86_64 1/15 Verifying : libxkbfile-1.0.6-1.1.el6.x86_64 2/15 Verifying : libX11-1.6.4-3.el6.x86_64 3/15 Verifying : xorg-x11-fonts-misc-7.2-11.el6.noarch 4/15 Verifying : pixman-0.32.8-1.el6.x86_64 5/15 Verifying : libxcb-1.12-4.el6.x86_64 6/15 Verifying : libX11-common-1.6.4-3.el6.noarch 7/15 Verifying : xorg-x11-xkb-utils-7.7-12.el6.x86_64 8/15 Verifying : xkeyboard-config-2.16-1.el6.noarch 9/15 Verifying : libxshmfence-1.2-1.el6.x86_64 10/15 Verifying : tigervnc-server-1.1.0-24.el6.x86_64 11/15 Verifying : pixman-0.26.2-4.el6.x86_64 12/15 Verifying : libX11-common-1.5.0-4.el6.noarch 13/15 Verifying : libX11-1.5.0-4.el6.x86_64 14/15 Verifying : libxcb-1.8.1-1.el6.x86_64 15/15 Installed: tigervnc-server.x86_64 0:1.1.0-24.el6 Dependency Installed: libXdmcp.x86_64 0:1.1.1-3.el6 libxkbfile.x86_64 0:1.0.6-1.1.el6 libxshmfence.x86_64 0:1.2-1.el6 xkeyboard-config.noarch 0:2.16-1.el6 xorg-x11-fonts-misc.noarch 0:7.2-11.el6 xorg-x11-xkb-utils.x86_64 0:7.7-12.el6 Updated: libxcb.x86_64 0:1.12-4.el6 Dependency Updated: libX11.x86_64 0:1.6.4-3.el6 libX11-common.noarch 0:1.6.4-3.el6 pixman.x86_64 0:0.32.8-1.el6 Complete!3、设置vnc服务开机自启动
[root@MYDNS yum.repos.d]# chkconfig vncserver on
4、检查是否设置成功
[root@MYDNS yum.repos.d]# chkconfig vncserver on [root@MYDNS yum.repos.d]# chkconfig --list |grep vnc vncserver 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
5、启动vncserver:
[root@MYDNS yum.repos.d]# vncserver :1 You will require a password to access your desktops. Password: Verify: xauth: creating new authority file /root/.Xauthority xauth: (stdin):1: bad display name "MYDNS:1" in "add" command New 'MYDNS:1 (root)' desktop is MYDNS:1 Creating default startup script /root/.vnc/xstartup Starting applications specified in /root/.vnc/xstartup Log file is /root/.vnc/MYDNS:1.log
6、检验是否启动成功:
[root@MYDNS yum.repos.d]# ps -ef|grep vnc root 2162 1 0 10:39 pts/0 00:00:00 /usr/bin/Xvnc :1 -desktop MYDNS:1 (root) -auth /root/.Xauthority -geometry 1024x768 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5901 -fp catalogue:/etc/X11/fontpath.d -pn root 2168 1 0 10:39 pts/0 00:00:00 vncconfig -iconic root 2246 1957 0 10:40 pts/0 00:00:00 grep vnc
7、本地vnc客户端连接服务端vnc
发现连接超时。
可能两种情况:
a、服务端服务未起来。
b、服务端防火墙限制。
本例中服务端已确认过起来了,那可能的原因就是防火墙。
8、关闭防火墙
[root@MYDNS yum.repos.d]# service iptables stop iptables:清除防火墙规则:[确定] iptables:将链设置为政策 ACCEPT:filter [确定] iptables:正在卸载模块:[确定]关闭开机自启动:
[root@MYDNS yum.repos.d]# chkconfig iptables off [root@MYDNS yum.repos.d]# chkconfig --list |grep iptables iptables 0:关闭 1:关闭 2:关闭 3:关闭 4:关闭 5:关闭 6:关闭 [root@MYDNS yum.repos.d]#
9、再次通过vnc viewer 连接服务端
连接输入:192.168.0.88:1
ip就是vncserver运行的服务器的ip地址
冒号1就是启动vncserver时后面指定的东西。
10、成功。
原文链接:https://www.f2er.com/centos/375595.html