zoukankan      html  css  js  c++  java
  • CentOS 6.8 安装vnc

    1. 先检查下是否有安装VNC

    [root@yanghg yanghg]# rpm -qa | grep tigervnc
    tigervnc-1.1.0-18.el6.x86_64
    tigervnc-server-1.1.0-18.el6.x86_64
    如果没有安装则执行:

    [root@yanghg yanghg]# yum install tigervnc-server -y
    已加载插件:fastestmirror, refresh-packagekit, security
    设置安装进程
    Repository base is listed more than once in the configuration
    Repository updates is listed more than once in the configuration
    Repository extras is listed more than once in the configuration
    Repository centosplus is listed more than once in the configuration
    Repository contrib is listed more than once in the configuration
    Loading mirror speeds from cached hostfile
     * base: mirrors.btte.net
     * epel: mirror.premi.st
     * extras: mirrors.btte.net
     * linuxtech-release: pkgrepo.linuxtech.net
     * nux-dextop: mirror.li.nux.ro
     * rpmfusion-free-updates: mirror.bjtu.edu.cn
     * rpmfusion-nonfree-updates: mirror.bjtu.edu.cn
     * updates: mirrors.aliyun.com
    包 tigervnc-server-1.1.0-18.el6.x86_64 已安装并且是最新版本
    无须任何处理
    [root@yanghg yanghg]#

    2. 执行[root@yanghg yanghg]# vncserver

    第一次执行会让你输入密码,至少6位,后续在vncviewer连接服务器端主机中需要用到。

    注意:后续可用vncpasswd命令修改密码

    3. 启动vncserver服务

    启动vncserver服务有两种方式。

    第一种:/etc/init.d/vncserver start,此种方式需要编辑配置文件。

    [root@node1 ~]# /etc/init.d/vncserver start
    Starting VNC server: no displays configured                [FAILED]

    报以上错误,需修改配置文件

    $ vim /etc/sysconfig/vncservers 

    4. /etc/sysconfig/vncservers 文件添加以下内容:

     VNCSERVERS="1:root 2:yanghg"
     VNCSERVERARGS[1]="-geometry 1920x1080 -depth 32 -nolisten tcp"
     VNCSERVERARGS[2]="-geometry 1920x1080 -depth 32 -nolisten tcp"

    5. # vim /root/.vnc/xstartup

    #twm & //注释该行

    末尾追加如下行:

    gnome-session & //如果为KDE桌面,则修改为:startkde &

    其他用户同理修改

    6. 最后启动vncserver 并设置为开机启动,执行以下

    # service vncserver start

    # chkconfig vncserver on

    补充:

    如果执行# service vncserver start有发现报以下错误

    2:yanghg 
    You will require a password to access your desktops.

    getpassword error: Inappropriate ioctl for device
    Password:3:yuy 
    You will require a password to access your desktops.

    getpassword error: Inappropriate ioctl for device
    Password: [FAILED]

    让用户设置密码(必须切换到配置文件中添加的用户名下,如yanghg)

    # vncpasswd

    7. 看看新生成的桌面对应的窗口

    [root@yanghg yanghg]# netstat -ntlup |grep vnc
    tcp        0      0 0.0.0.0:5901                0.0.0.0:*                   LISTEN      2911/Xvnc           
    tcp        0      0 0.0.0.0:5902                0.0.0.0:*                   LISTEN      3050/Xvnc           

    参考链接:http://www.cnblogs.com/ivictor/archive/2015/08/27/4760914.html

  • 相关阅读:
    linux命令查询网站
    UTC(世界协调时间)时区和各个时区时间的转换
    dev-c++ 中写完源文件生成exe程序怎么避免运行闪退?
    numpy和time计时程序
    进化算法之粒子群算法和Matlab实现(多维)
    tf.config:GPU 的使用与分配(转载)
    限制TensorFlow只在CPU上运行的方法
    Python重要学习链接
    SpringCloud 之 Nacos 注册配置中心
    Jenkins 自动化部署入门详细教程
  • 原文地址:https://www.cnblogs.com/cutelinux/p/5754835.html
Copyright © 2011-2022 走看看