zoukankan      html  css  js  c++  java
  • vnc server的安装

    vnc是一款使用广泛的服务器管理软件,可以实现图形化管理。我在安装vnc server碰到一些问题,也整理下我的安装步骤,希望对博友们有一些帮助。

    1 安装对应的软件包

    [root@centos6 ~]# yum search vnc
    [root@centos6 ~]# yum -y install tigervnc-server

    2 设置vnc远程连接密码

    [root@centos6 ~]# vncpasswd 
    Password:
    Verify:

    3 修改vncserver配置文件

    [root@centos6 ~]# vim /etc/sysconfig/vncservers 
    VNCSERVERS="2:root"
    VNCSERVERARGS[2]="-geometry 1024x768"

    注意:1024x768的中间的那个符号是小写字母x。

    4 重启服务并查看服务

    [root@centos6 ~]# service vncserver restart #重启vncserver
    Shutting down VNC server:                                  [  OK  ]
    Starting VNC server: 2:root xauth:  file /root/.Xauthority does not exist
    xauth: (stdin):1:  bad display name "centos6.magedu.com:2" in "add" command
    
    New 'centos6.magedu.com:2 (root)' desktop is centos6.magedu.com:2
    
    Creating default startup script /root/.vnc/xstartup
    Starting applications specified in /root/.vnc/xstartup
    Log file is /root/.vnc/centos6.magedu.com:2.log
    
                                                               [  OK  ]
    [root@centos6 ~]# netstat -tunlp |grep vnc #发现监听在5902端口上
    tcp        0      0 0.0.0.0:5902                0.0.0.0:*                   LISTEN      4269/Xvnc           
    tcp        0      0 0.0.0.0:6002                0.0.0.0:*                   LISTEN      4269/Xvnc           
    tcp        0      0 :::6002                     :::*                        LISTEN      4269/Xvnc     

    5 测试vnc服务

    我这里在windows机器使用vncview进行测试。在vncview连接种输入ip:5902,发现连不上去。百度了下,从下面的这个参考地址获取到帮助

    参考地址:https://stackoverflow.com/questions/20367822/vnc-server-installed-and-running-but-not-visible-over-the-network)

    整理下需要3个步骤:

    1. 确保能ping通vnc server所在的服务器
    2. 临时关闭防火墙
    3. 临时关闭selinux
    [root@centos6 ~]# service iptables status
    Table: filter
    Chain INPUT (policy ACCEPT)
    num  target     prot opt source               destination         
    1    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED 
    2    ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0           
    3    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
    4    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22 
    5    REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited 
    
    Chain FORWARD (policy ACCEPT)
    num  target     prot opt source               destination         
    1    REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited 
    
    Chain OUTPUT (policy ACCEPT)
    num  target     prot opt source               destination         
    
    [root@centos6 ~]# service iptables stop
    iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
    iptables: Flushing firewall rules:                         [  OK  ]
    iptables: Unloading modules:                               [  OK  ]
    [root@centos6 ~]# getenforce
    Enforcing
    [root@centos6 ~]# setenforce 0

    执行上面的操作就可以远程连接了。后续我们还需要把启用防火墙把对应的端口放行,并且设置selinux支持vncserver。

  • 相关阅读:
    Python使用Thrift
    python 使用 thrift 教程
    go语言每个工程是不是都要单独设置GOPATH?
    go mod开发模式设置
    在 Ubuntu 开启 GO 程序编译之旅
    基于gin web框架搭建RESTful API服务
    Go编程基础(介绍和安装)
    Spring+SpringMVC+MyBatis深入学习及搭建(二)——MyBatis原始Dao开发和mapper代理开发
    Spring+SpringMVC+MyBatis深入学习及搭建(一)——MyBatis的基础知识
    JavaScript插件:快速选择日期----jedate日历插件
  • 原文地址:https://www.cnblogs.com/zhaojiedi1992/p/zhaojiedi_linux_030_vncserver.html
Copyright © 2011-2022 走看看