首页 > 代码库 > centos6.x 配置 vnc server

centos6.x 配置 vnc server

环境:  centos6.x 桌面环境 用户root

安装vnc服务端软件

yum install -y tigervnc-server

配置vnc

vncserver :1

设置密码后会自动生成相关配置文件

如下

root@localhost ~]# vncserver :1
You will require a password to access your desktops.
Password:
Verify:
xauth: (stdin):1:  bad display name "localhost:1" in "add" command
New ‘localhost:1 (root)‘ desktop is localhost:1
Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost:1.log

配置防火墙

vnc服务默认使用5900以后端口

:1使用5901
:2使用5902  ##以此类推

查看使用哪个端口

netstat -tupln|grep vnc
tcp        0      0 0.0.0.0:5901                0.0.0.0:*                   LISTEN      5969/Xvnc


开启5901端口 

lokkit -p 5901:tcp


配置开机启动启动vnc服务

 vim /etc/sysconfig/vncservers

添加 

VNCSERVERS="1:root"

配置开机自动启动

chkconfig vncserver on


vnc工具连接

现在就可以通过vnc工具连接了

地址格式 IP:1


其他常用命令

vncserver -list   #查看vnc进程列表
vncserver -kill :1  关闭进程:1


附:realvnc下载地址 http://www.realvnc.com/download/viewer/