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

  • 相关阅读:
    # 20155229 2016-2017-2 《Java程序设计》第七周学习总结
    20155229 实验一《Java开发环境的熟悉》实验报告
    20155229 2016-2017-2 《Java程序设计》第六周学习总结
    20155229 2016-2017-2 《Java程序设计》第五周学习总结
    20155229 2016-2017-2 《Java程序设计》第四周学习总结
    20155229 2016-2017-2 《Java程序设计》第三周学习总结
    20155229 2016-2017-2 《Java程序设计》第二周学习总结
    20155229 2016-2007-2 《Java程序设计》第一周学习总结
    20155229付钰涵-虚拟机安装及LINUX命令学习
    20155223 2016-2017-2 《Java程序设计》第10周学习总结
  • 原文地址:https://www.cnblogs.com/cutelinux/p/5754835.html
Copyright © 2011-2022 走看看