CentOS 6.5 服务端配置vnc-server windows客户端远程桌面访问CentOS 6.5

来源:互联网 发布:java友盟别名推送demo 编辑:程序博客网 时间:2024/05/21 07:02

服务器端配置

1. 下载vnc相关组件

    yum install -y vnc-server

    如下提示表示安装成功:

[root@localhost ~]# yum -y install vnc-server已加载插件:fastestmirror, refresh-packagekit, security设置安装进程Loading mirror speeds from cached hostfile * base: mirrors.skyshe.cn * extras: mirrors.163.com * updates: mirrors.163.com包 tigervnc-server-1.1.0-16.el6.centos.x86_64 已安装并且是最新版本无须任何处理

2. 修改vnc配置

    vi /etc/sysconfig/vncservers


    修改最后两行的配置

    去除#注释,启动该配置,做如下修改:

    # 2为服务器标识,root为系统已经存在的用户名

    VNCSERVERS="2:root"

    # 服务器分辨率配置
    VNCSERVERARGS[2]="-geometry 1024x768 -nolisten tcp -localhost"


3. 设置vncserver密码

    在终端输入: vncserver

    依据提示输入自己需要设置的密码。

    设置成功的提示如下:

[root@localhost ~]# vncserverxauth: (stdin):1:  bad display name "localhost.shootbox.server:2" in "add" commandNew 'localhost.shootbox.server:2 (root)' desktop is localhost.shootbox.server:2Starting applications specified in /root/.vnc/xstartupLog file is /root/.vnc/localhost.shootbox.server:2.log

4. 修改防火墙端口配置,开放5901端口

    vi /etc/sysconfig/iptables

    -A INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT

    PS:此处的--dport比较容易少了一个短横杆"-",配置时请务必注意!


5. 重启防火墙

    service iptables restart

    PS: 如果出现规则不对,请核对开放5901端口命令是否正确。

    防火墙规则配置错误信息:

[root@localhost ~]# service iptables restartiptables:将链设置为政策 ACCEPT:filter                    [确定]iptables:清除防火墙规则:                                 [确定]iptables:正在卸载模块:                                   [确定]iptables:应用防火墙规则:Bad argument `5901'Error occurred at line: 10Try `iptables-restore -h' or 'iptables-restore --help' for more information.                                                           [失败]

    防火墙规则配置正确信息:

[root@localhost ~]# service iptables restartiptables:将链设置为政策 ACCEPT:filter                    [确定]iptables:清除防火墙规则:                                 [确定]iptables:正在卸载模块:                                   [确定]iptables:应用防火墙规则:                                 [确定]

6. 重启vnc服务

    service vncserver restart

    重启失败原因:用户名不存在情况

[root@localhost ~]# service vncserver restart关闭 VNC 服务器:2:myusername                              [失败]正在启动 VNC 服务器:2:myusername runuser: 用户myusername 不存在                                                           [失败][root@localhost ~]# vncserverxauth: (stdin):1:  bad display name "localhost.shootbox.server:2" in "add" commandNew 'localhost.shootbox.server:2 (root)' desktop is localhost.shootbox.server:2Starting applications specified in /root/.vnc/xstartupLog file is /root/.vnc/localhost.shootbox.server:2.log[root@localhost ~]# service vncserver restart关闭 VNC 服务器:shootbox:111111                           [失败]正在启动 VNC 服务器:shootbox:111111 runuser: 用户111111 不存在                                                           [失败]

7. ping 客户端IP

    验证是否连通

   

客户端配置

    (1) 打开其他操作系统的vnc客户端,输入如下命令:

          ip:5901--[192.168.1.xxx:5901]

    (2) 输入对应的密码

   



0 0