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,如需转载请自行联系原作者
目录
相关文章
|
Ubuntu Linux 网络安全
Linux服务器之Ubuntu的安装与配置
Ubuntu Desktop是目前最成功、最流行的图形界面的Linux发行版;而Ubuntu Server也在服务器端市场占据了较大的份额。今天为大家详细介绍了Ubuntu Server的安装与配置,希望对你能有所帮助。关于VMware、VirtualBox等虚拟化软件的使用,朱哥还会在后续的文章中为大家详细介绍,敬请关注!
|
存储 Linux 开发工具
Linux环境下使用Buildroot配置软件包
使用Buildroot可以大大简化嵌入式Linux系统的开发和维护工作,但它需要对Linux系统和交叉编译有深入的理解。通过上述步骤,可以有效地配置和定制软件包,为特定的嵌入式应用构建高效、稳定的系统。
1308 11
|
安全 Linux iOS开发
SonarQube Server 2025 Release 5 (macOS, Linux, Windows) - 代码质量、安全与静态分析工具
SonarQube Server 2025 Release 5 (macOS, Linux, Windows) - 代码质量、安全与静态分析工具
501 0
SonarQube Server 2025 Release 5 (macOS, Linux, Windows) - 代码质量、安全与静态分析工具
|
关系型数据库 MySQL Java
安装和配置JDK、Tomcat、MySQL环境,以及如何在Linux下更改后端端口。
遵循这些步骤,你可以顺利完成JDK、Tomcat、MySQL环境的安装和配置,并在Linux下更改后端端口。祝你顺利!
845 11
|
Kubernetes Linux 网络安全
Rocky Linux 8.9配置Kubernetes集群详解,适用于CentOS环境
初始化成功后,记录下显示的 `kubeadm join`命令。
976 0
|
安全 Linux 网络安全
在Linux(CentOS和AWS)上安装更新的git2的方法并配置github-ssh
经过以上这些步骤,你现在就能在GitHub上顺利往返,如同海洋中的航海者自由驰骋。欢迎你加入码农的世界,享受这编程的乐趣吧!
718 10
|
人工智能 Kubernetes Ubuntu
linux配置IP
linux配置IP
6466 1
|
Linux 网络安全 开发工具
在Linux下配置gitee与Github的远程仓库
注意,git push后,是输入你的账号与密码。这个步骤可以通过特殊设置省去,但是一开始还是不要太省。
862 0
|
Linux 应用服务中间件 Shell
二、Linux文本处理与文件操作核心命令
熟悉了Linux的基本“行走”后,就该拿起真正的“工具”干活了。用grep这个“放大镜”在文件里搜索内容,用find这个“探测器”在系统中寻找文件,再用tar把东西打包带走。最关键的是要学会使用管道符|,它像一条流水线,能把这些命令串联起来,让简单工具组合出强大的功能,比如 ps -ef | grep 'nginx' 就能快速找出nginx进程。
1145 1
二、Linux文本处理与文件操作核心命令