vnc server的安装
2024-10-12 07:03:46
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,发现连不上去。百度了下,从下面的这个参考地址获取到帮助
整理下需要3个步骤:
- 确保能ping通vnc server所在的服务器
- 临时关闭防火墙
- 临时关闭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。
最新文章
- [转]SSAS没有注册类 (异常来自 HRESULT:0x80040154 (REGDB_E_CLASSNOTREG)) (Microsoft Visual Studio)的解决办法
- nyoj 171 聪明的kk
- 小希的数表2(用的for循环)
- Powershell Remove ";Limited Access"; - 金大昊(jindahao)
- ORM框架-VB/C#.Net实体代码生成工具(EntitysCodeGenerate)【ECG】4.5
- IOS_修改项目模板
- sqlserver 动态表名 动态字段名 执行 动态sql
- 11、WebView 使用总结
- Jquery 控件
- 将archlinux 2013-06-01版,安装配置为个人工作站
- 各个平台 如何安装 Ruby 和 RubyGems
- C# 文件copy和文件删除
- python turtle库的几个小demo
- Eclipse中SVN插件的安装和配置(在线安装)
- BZOJ3237:[AHOI2013]连通图(线段树分治,并查集)
- mycql 多表联合查询
- Spring事务控制和传递性理解
- 使用HttpModule实现网址重写和HttpHandler实现页面静态化冲突的解决办法
- 大数据学习--day14(String--StringBuffer--StringBuilder 源码分析、性能比较)
- sql函数应用例子