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

服务器端配置

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 ~]# vncserver
xauth: (stdin):1:  bad display name "localhost.shootbox.server:2" in "add" command

New 'localhost.shootbox.server:2 (root)' desktop is localhost.shootbox.server:2

Starting applications specified in /root/.vnc/xstartup
Log 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 restart
iptables:将链设置为政策 ACCEPT:filter                    [确定]
iptables:清除防火墙规则:                                 [确定]
iptables:正在卸载模块:                                   [确定]
iptables:应用防火墙规则:Bad argument `5901'
Error occurred at line: 10
Try `iptables-restore -h' or 'iptables-restore --help' for more information.
                                                           [失败]

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

[root@localhost ~]# service iptables restart
iptables:将链设置为政策 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 ~]# vncserver
xauth: (stdin):1:  bad display name "localhost.shootbox.server:2" in "add" command

New 'localhost.shootbox.server:2 (root)' desktop is localhost.shootbox.server:2

Starting applications specified in /root/.vnc/xstartup
Log 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
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值