标签:linux
Linux Study之--RedHat EL6配置VNC server
系统环境:
操作系统:RedHat EL6.4(64)
RH6在vnc server的安装及配置和RH5稍微有不同,以下案例在RH EL6.4上安装配置vnc server
1、查看vnc 安装包
[root@rh64 ~]# rpm -qa |grep vnc
gtk-vnc-0.3.10-3.el6.x86_64
libvncserver-0.9.7-4.el6.x86_64
gtk-vnc-python-0.3.10-3.el6.x86_64
在rh6上需要安装tigervnc-server软件包
[root@rh64 ~]# yum install -y vnc-server
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package tigervnc-server.x86_64 0:1.1.0-5.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================================================== Package Arch Version Repository Size ================================================================================================================== Installing: tigervnc-server x86_64 1.1.0-5.el6 base 1.0 M Transaction Summary ================================================================================================================== Install 1 Package(s) Total download size: 1.0 M Installed size: 2.6 M Downloading Packages: Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : tigervnc-server-1.1.0-5.el6.x86_64 1/1 Verifying : tigervnc-server-1.1.0-5.el6.x86_64 1/1 Installed: tigervnc-server.x86_64 0:1.1.0-5.el6 Complete!
2、配置vnc server
[root@rh64 ~]# vi /etc/sysconfig/vncservers
# VNCSERVERS="2:myusername"
# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"
VNCSERVERS="1:root" //安装提示添加vnc server启动的终端和连接的user
~
3、设置用户连接的口令
[root@rh64 ~]# vncpasswd
Password:
Password must be at least 6 characters - try again
Password:
Verify:
4、启动vnc server(port:5900、5901)
[root@rh64 ~]# service vncserver start
Starting VNC server: 1:root xauth: creating new authority file /root/.Xauthority
New ‘rh64:1 (root)‘ desktop is rh64:1
Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/rh64:1.log
[ OK ]
安装vnc工具vncviewer
[root@rh64 Packages]# rpm -ivh tigervnc-1.1.0-5.el6.x86_64.rpm
warning: tigervnc-1.1.0-5.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:tigervnc ########################################### [100%]
5、通过vncviewer连接vncserver(也可在windows下使用浏览器或vncviewer客户端)
[root@rh64 Packages]# export DISPLAY=192.168.8.83:0.0
[root@rh64 Packages]# vncviewer
连接成功
尽管以上过程已经完成,并且vncserver服务也启动,但却还是连不上,这时,可能的原因就是该请求被防火墙屏蔽了。所以这里介绍下防火墙的配置方法。
vnc服务运行时,使用netstat -antpl查看可以发现有三个端口在监听。
5901 5801 6001
默认的,vnc 服务监听3个TCP端口
RFB(Remote FrameBuffer)协议 默认端口:5900+显示器号
HTTP协议默认端口:5800+显示器号
X协议 默认端口:6000+显示器号
vncserver使用的显示器编号默认从1开始,依次使用,也可以参数指定端口号。
因为我们需要建立远程连接,所以只需要RFB协议就可以了。
下面介绍配置防火墙的过程。
[root@localhost ~]# vi /etc/sysconfig/iptables
文件内容为
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
按照/etc/sysconfig/vncservers文件中的配置,我们需要打开5901的端口号,只需在
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
下面加入一行
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT
即开启了5901的端口。
本文出自 “天涯客的blog” 博客,请务必保留此出处http://tiany.blog.51cto.com/513694/1717087
Linux Study之--RedHat EL6配置VNC server
标签:linux
原文地址:http://tiany.blog.51cto.com/513694/1717087