Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1188278
  • 博文数量: 259
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 2518
  • 用 户 组: 普通用户
  • 注册时间: 2012-10-13 16:12
个人简介

科技改变世界,技术改变人生。

文章分类

全部博文(259)

分类: 系统运维

2014-11-12 14:49:08

Centos快速安装vnc(tigervnc-server)

Linux服务器端
第一步确认linux系统是否安装VNC
rpm -q tigervnc-server

安装
#yum install tigervnc-server

修改配置文件,直接使用root用户
#vi /etc/sysconfig/vncservers
VNCSERVERS="1:root"
VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"

设置vnc密码
#vncpasswd

启动VNC服务
#vncserver

客户端
1、下载vnc软件
2、登录并输入密码
192.168.1.100:1  (1就是服务器端设置的1)

参考命令:

查看已经打开的vnc服务,关闭服务
[visitor@localhost ~]$ vncserver -list

重启
service vncserver restart

关闭
[visitor@localhost ~]$ vncserver -kill :1

添加防火墙配置
[root@localhost ~]# vim /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5902 -j ACCEPT
[root@localhost ~]# service iptables restart
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]
iptables: Applying firewall rules:                         [  OK  ]

使用安全的SSH进行连接

VNC 是明文的,不安全的.连接过程可能会被窃听,干扰.可以使用SSH通道加密,然后再由远程主机的回环地址通信,加大了安全性.
[root@localhost ~]# vim /etc/sysconfig/vncservers
VNCSERVERARGS[1]="-localhost"

[11:30:18 talen@BJB0300 ~ ]$ vncviewer -via visitor@172.31.0.128 localhost:1
这里的localhost是远程主机的回环地址,由远程主机解析

生成密码文件,无输入密码登录
[root@localhost ~]# vncpasswd virtual
Password:
Verify:
[13:43:02 talen@BJB0300 study ]$ vncviewer -passwd ~/study/virtual -via root@172.31.0.128 localhost:3

多用户配置

 VNCSERVERS="3:root 2:student"
 VNCSERVERARGS[2]="-geometry 800x600 -localhost"
 VNCSERVERARGS[3]="-geometry 1024x768 -localhost"

[root@localhost ~]# chkconfig vncserver on
[root@localhost ~]# chkconfig --list vncserver
vncserver       0:off   1:off   2:on    3:on    4:on    5:on    6:off


解决RHEL6 vncserver 启动 could not open default font 'fixed'错误. .
yum install libXfont
阅读(2688) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~