• Linux 通过安装vncserver,客户端远程连接展示图形化界面


    Step 1: 安装vncserver和其依赖的软件

    # 修改yum为国内镜像
    cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup-linux && 
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo && 
    yum clean all && 
    yum makecache
    
    # 安装依赖软件
    yum install -y  compat-libstdc++*  && 
    yum install -y  binutils*  && 
    yum install -y  compat-libstdc*  && 
    yum install -y  elfutils-libelf*  && 
    yum install -y  gcc*  && 
    yum install -y  glibc*  && 
    yum install -y  ksh*  && 
    yum install -y  libaio*  && 
    yum install -y  libgcc*  && 
    yum install -y  libstdc*  && 
    yum install -y  make*  && 
    yum install -y  sysstat*  && 
    yum install -y  libXp*  && 
    yum install -y  glibc-kernheaders
    
    # yum
    rpm -q --queryformat %-{name}-%{version}-%{release}-%{arch}"
    "  compat-libstdc++-33 glibc-kernheaders glibc-headers libaio libgcc glibc-devel xorg-x11-deprecated-libs
    # 输出无法下载和安装的软件,清单如下:
    # package  compat-libstdc++-33 is not installed
    # package glibc-kernheaders is not installed
    # package glibc-headers is not installed
    # libaio-0.3.109-13.el7-x86_64
    # libgcc-4.8.5-16.el7-x86_64
    # package glibc-devel is not installed
    # package xorg-x11-deprecated-libs is not installed
    
    # 遇到部分无法在aliyun下载的软件,则需要重新替换yum.repo
    cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup-aliyun && 
    cp /etc/yum.repos.d/CentOS-Base.repo.backup-linux /etc/yum.repos.d/CentOS-Base.repo && 
    yum clean all && 
    yum makecache && 
    yum install -y compat-libstdc++*  && 
    # 安装包找不到
    yum install -y glibc-kernheaders*  && 
    yum install -y glibc-headers*  && 
    yum install -y libaio*  && 
    yum install -y libgcc*  && 
    yum install -y glibc-devel*  && 
    # 安装包找不到
    yum install -y xorg-x11-deprecated-libs*  && 
    
    # 查看VNC启动失败的日志,
    cat ./.vnc/CNT7XORACLED01:1.log
    # xrdb: No such file or directory
    # xrdb: can't open file '/root/.Xresources'
    # xterm: cannot load font '-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1'
    
    # 根据日志错误信息,安装插件或创建目录
    touch ~/.Xresources  && 
    yum install -y xterm  && 
    yum install -y gnome-session
    
    # 如果日志提示错误:xterm: cannot load font '-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1'
    # 则编辑文件,添加如下两行内容
    vi ~/.Xresources
    xterm*faceName:AR PL Uming CN
    xterm*faceSize:12
    
    # 然后,重新启动vncserver
    # 关闭vncserver , vncserver这里是"Xvnc :1",见下面查询结果所得:1
    # 详情使用ps -ef | grep vncserver查看
    # [root@CNT7XORACLED01 ~]# ps -ef | grep vnc
    # root       1608      1  0 10:20 pts/1    00:00:00 /usr/bin/Xvnc :1 -auth /root/.Xauthority -desktop CNT7XORACLED01:1 (root) -fp catalogue:/etc/X11/fontpath.d -geometry 1024x768 -pn -rfbauth /root/.vnc/passwd -rfbport 5901 -rfbwait 30000
    # 关闭vncserver
    vncserver -kill :1
    vncserver :1
    
    # 然后,执行如下命令
    export DISPLAY=localhost:1
    xhost +
    
    # 出现如下输出,才是成功启动了Linux的远程连接的图形化界面
    

    Step 2:客户端连接linux服务器

    创建vnc客户端连接如下:{linux_ip}:{vncserver进程的参数 Xvnc :1}

     执行链接,弹出窗口如下:

  • 相关阅读:
    [Python][小知识][NO.3] Python 使用系统默认浏览器打开指定URL的网址
    [Python][小知识][NO.2] Python 字符串跨行连接,或拆分为多行显示
    [Python] wxPython 状态栏组件、消息对话框组件 学习总结(原创)
    [Python][小知识][NO.1] Python字符串前 加 u、r、b 的含义
    [Python] wxPython 编辑框组件学习总结 (原创)
    [Python] wxPython 菜单栏控件学习总结(原创)
    [Python] wxPython 基本控件 (转)
    HDU 2086 A1 = ? (找规律推导公式 + 水题)(Java版)
    HDU 1840 Equations (简单数学 + 水题)(Java版)
    UVA 1152 4 Values whose Sum is 0 (枚举+中途相遇法)(+Java版)(Java手撕快排+二分)
  • 原文地址:https://www.cnblogs.com/itshare/p/13123988.html
Copyright © 2020-2023  润新知