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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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 



连接成功



6、 防火墙配置


尽管以上过程已经完成,并且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的端口。










本文转自 客居天涯 51CTO博客,原文链接:http://blog.51cto.com/tiany/1717087,如需转载请自行联系原作者
目录
相关文章
|
安全 Linux 数据安全/隐私保护
Red Hat Enterprise Linux 9.6 (x86_64, aarch64) - 红帽企业 Linux (RHEL)
Red Hat Enterprise Linux 9.6 (x86_64, aarch64) - 红帽企业 Linux (RHEL)
1547 36
Red Hat Enterprise Linux 9.6 (x86_64, aarch64) - 红帽企业 Linux (RHEL)
|
Ubuntu Linux 网络安全
Linux服务器之Ubuntu的安装与配置
Ubuntu Desktop是目前最成功、最流行的图形界面的Linux发行版;而Ubuntu Server也在服务器端市场占据了较大的份额。今天为大家详细介绍了Ubuntu Server的安装与配置,希望对你能有所帮助。关于VMware、VirtualBox等虚拟化软件的使用,朱哥还会在后续的文章中为大家详细介绍,敬请关注!
|
10月前
|
存储 Linux 开发工具
Linux环境下使用Buildroot配置软件包
使用Buildroot可以大大简化嵌入式Linux系统的开发和维护工作,但它需要对Linux系统和交叉编译有深入的理解。通过上述步骤,可以有效地配置和定制软件包,为特定的嵌入式应用构建高效、稳定的系统。
1016 11
|
11月前
|
安全 Linux iOS开发
SonarQube Server 2025 Release 5 (macOS, Linux, Windows) - 代码质量、安全与静态分析工具
SonarQube Server 2025 Release 5 (macOS, Linux, Windows) - 代码质量、安全与静态分析工具
414 0
SonarQube Server 2025 Release 5 (macOS, Linux, Windows) - 代码质量、安全与静态分析工具
|
Kubernetes Linux 网络安全
Rocky Linux 8.9配置Kubernetes集群详解,适用于CentOS环境
初始化成功后,记录下显示的 `kubeadm join`命令。
873 0
|
关系型数据库 MySQL Java
安装和配置JDK、Tomcat、MySQL环境,以及如何在Linux下更改后端端口。
遵循这些步骤,你可以顺利完成JDK、Tomcat、MySQL环境的安装和配置,并在Linux下更改后端端口。祝你顺利!
767 11
|
人工智能 安全 Linux
Red Hat Enterprise Linux 10 正式版发布 - 红帽企业 Linux (RHEL)
Red Hat Enterprise Linux 10 正式版发布 - 红帽企业 Linux (RHEL)
1741 0
Red Hat Enterprise Linux 10 正式版发布 - 红帽企业 Linux (RHEL)
|
安全 Linux 网络安全
在Linux(CentOS和AWS)上安装更新的git2的方法并配置github-ssh
经过以上这些步骤,你现在就能在GitHub上顺利往返,如同海洋中的航海者自由驰骋。欢迎你加入码农的世界,享受这编程的乐趣吧!
641 10
|
Linux 网络安全 开发工具
在Linux下配置gitee与Github的远程仓库
注意,git push后,是输入你的账号与密码。这个步骤可以通过特殊设置省去,但是一开始还是不要太省。
726 0
|
安全 Linux 网络安全
如何在 VM 虚拟机中安装 Red Hat Enterprise Linux 9.3 操作系统保姆级教程(附链接)
如何在 VM 虚拟机中安装 Red Hat Enterprise Linux 9.3 操作系统保姆级教程(附链接)