CentOS6.4下VNC Server最简配置

bgn4 9年前

CentOS6.4下VNC Server最简配置

    环境:

    CentOS 6.4 Final,桌面安装了除KDE的所有组件

    1、安装服务

    yum install tigervnc-server

    名字有点怪哦,CentOS5前叫vnc-server

    2、运行并设置密码

    vncserver :1

    输入密码,会生成相关的文件

    xauth: creating new authority file /root/.Xauthority

    New 'centos6-244:1 (root)' desktop is centos6-244:1

    Starting applications specified in /root/.vnc/xstartup

    Log file is /root/.vnc/centos6-244:1.log

    3、配置用户

    vim /etc/sysconfig/vncservers

    最后一行加入:

    VNCSERVERS="1:root" 多个用户用空格分开,并要先su - 到那个用户运行vncserver :n来设定配置文件和密码

    4、实用命令

    usage: vncserver [:] [-name ] [-depth ]

    [-geometry x]

    [-pixelformat rgbNNN|bgrNNN]

    [-fp ]

    [-fg]

    ...

    vncserver -kill

    vncserver -list

    vncserver[:n]开服务

    vncserver -list看有几个在运行

    vncserver -kill :n 杀掉第几个x-display

    vncpasswd     修改密码

    5、服务管理

    service vncserver restart

    其它用法:/etc/init.d/vncserver {start|stop|restart|try-restart|status|force-reload}

    chkconfig vncserver on 加入到自启动(chkconfig --level 35 vncserver on)

    6、客户端连接

    CentOS:使用TigerVNC Viewer 连接 ip:1

    Windows:使用Real VNC Viewer 连接ip:1

    输入密码即可访问



关闭虚拟机防火墙:

关闭命令:  service iptables stop

永久关闭防火墙:chkconfig iptables off

两个命令同时运行,运行完成后查看防火墙关闭状态
service iptables status

1 关闭防火墙-----service iptables stop 
2 启动防火墙-----service iptables start 
3 重启防火墙-----service iptables restart 
4 查看防火墙状态--service iptables status 
5 永久关闭防火墙--chkconfig iptables off 
6 永久关闭后启用--chkconfig iptables on

客户端工具

http://www.realvnc.com/download/viewer/