vnc是一款使用广泛的服务器管理软件,可以实现图形化管理。我在安装vnc server碰到一些问题,也整理下我的安装步骤,希望对博友们有一些帮助。

1 安装对应的软件包

[root@centos6 ~]# yum search vnc
[root@centos6 ~]# yum -y install tigervnc-server

2 设置vnc远程连接密码

[root@centos6 ~]# vncpasswd
Password:
Verify:

3 修改vncserver配置文件

[root@centos6 ~]# vim /etc/sysconfig/vncservers
VNCSERVERS="2:root"
VNCSERVERARGS[]="-geometry 1024x768"

注意:1024x768的中间的那个符号是小写字母x。

4 重启服务并查看服务

[root@centos6 ~]# service vncserver restart #重启vncserver
Shutting down VNC server: [ OK ]
Starting VNC server: :root xauth: file /root/.Xauthority does not exist
xauth: (stdin):: bad display name "centos6.magedu.com:2" in "add" command New 'centos6.magedu.com:2 (root)' desktop is centos6.magedu.com: Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/centos6.magedu.com:.log [ OK ]
[root@centos6 ~]# netstat -tunlp |grep vnc #发现监听在5902端口上
tcp 0.0.0.0: 0.0.0.0:* LISTEN /Xvnc
tcp 0.0.0.0: 0.0.0.0:* LISTEN /Xvnc
tcp ::: :::* LISTEN /Xvnc

5 测试vnc服务

我这里在windows机器使用vncview进行测试。在vncview连接种输入ip:5902,发现连不上去。百度了下,从下面的这个参考地址获取到帮助

参考地址:https://stackoverflow.com/questions/20367822/vnc-server-installed-and-running-but-not-visible-over-the-network)

整理下需要3个步骤:

  1. 确保能ping通vnc server所在的服务器
  2. 临时关闭防火墙
  3. 临时关闭selinux
[root@centos6 ~]# service iptables status
Table: filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
ACCEPT all -- 0.0.0.0/ 0.0.0.0/ state RELATED,ESTABLISHED
ACCEPT icmp -- 0.0.0.0/ 0.0.0.0/
ACCEPT all -- 0.0.0.0/ 0.0.0.0/
ACCEPT tcp -- 0.0.0.0/ 0.0.0.0/ state NEW tcp dpt:
REJECT all -- 0.0.0.0/ 0.0.0.0/ reject-with icmp-host-prohibited Chain FORWARD (policy ACCEPT)
num target prot opt source destination
REJECT all -- 0.0.0.0/ 0.0.0.0/ reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT)
num target prot opt source destination [root@centos6 ~]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
[root@centos6 ~]# getenforce
Enforcing
[root@centos6 ~]# setenforce

执行上面的操作就可以远程连接了。后续我们还需要把启用防火墙把对应的端口放行,并且设置selinux支持vncserver。

最新文章

  1. [转]SSAS没有注册类 (异常来自 HRESULT:0x80040154 (REGDB_E_CLASSNOTREG)) (Microsoft Visual Studio)的解决办法
  2. nyoj 171 聪明的kk
  3. 小希的数表2(用的for循环)
  4. Powershell Remove "Limited Access" - 金大昊(jindahao)
  5. ORM框架-VB/C#.Net实体代码生成工具(EntitysCodeGenerate)【ECG】4.5
  6. IOS_修改项目模板
  7. sqlserver 动态表名 动态字段名 执行 动态sql
  8. 11、WebView 使用总结
  9. Jquery 控件
  10. 将archlinux 2013-06-01版,安装配置为个人工作站
  11. 各个平台 如何安装 Ruby 和 RubyGems
  12. C# 文件copy和文件删除
  13. python turtle库的几个小demo
  14. Eclipse中SVN插件的安装和配置(在线安装)
  15. BZOJ3237:[AHOI2013]连通图(线段树分治,并查集)
  16. mycql 多表联合查询
  17. Spring事务控制和传递性理解
  18. 使用HttpModule实现网址重写和HttpHandler实现页面静态化冲突的解决办法
  19. 大数据学习--day14(String--StringBuffer--StringBuilder 源码分析、性能比较)
  20. sql函数应用例子

热门文章

  1. 1095 A+B for Input-Output Practice (VII)
  2. JS for循环 if判断、white循环。小练习
  3. asp.net 跨域请求
  4. vs2012,打开早期版本窗体错误
  5. web测试点总结---UI、兼容、功能、交互、安全、性能、接口测试
  6. zipkin
  7. SPARK-AM-TrackURL-UI-500
  8. Session Cookie介绍和使用
  9. Lua学习链接
  10. 干货分享: 长达250页的Libvirt Qemu KVM的ppt,不实验无真相