• 背景
  • 步骤
  • http://192.168.3.149:8083/repository/centos/
    enabled=1
    gpgcheck=0
    priority=1
    EOF
    systemctl stop firewalld
    systemctl disable firewalld
    sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/‘ /etc/selinux/config
    #x11的功能是否可用
    yum install -y xauth xclock
    sshd -T|grep “x11uselocalhost yes” && (
    sed -i “s/#X11UseLocalhost yes/X11UseLocalhost no/g” /etc/ssh/sshd_config
    )
    service sshd restart
    :<正常工作sshd的配置类似如下
    x11displayoffset 10
    x11maxdisplays 1000
    x11forwarding yes
    x11uselocalhost no
    EOF
    touch /home/vagrant/.Xauthority
    chmod 666 /home/vagrant/.Xauthority
    yum install -y google-chrome-stable
    # centos的不同版本变化有点让人崩溃 centos7以后使用的是Fonts
    # yum install -y groupinstall “fonts”
    yum install google-noto-sans-simplified-chinese-fonts.noarch
    yum groupinstall Fonts
    #你的客户机器上只要有了XSERVER
    # 1 ssh -X -o StrictHostKeyChecking=no -i key/id_rsa vagrant@192.168.99.200
    # 2 执行 google-chrome —use-gl=swiftshader 即可使用浏览器了
    echo “SSH and use 【 google-chrome —use-gl=swiftshader 】 “
    echo “done”">!/bin/bash
    # centos7 物理机为了支持远程客户端的X11显示桌面程序的支持
    # 将桌面程序直接在这里安装
    rm -rf /etc/yum.repos.d/*
    cat < /etc/yum.repos.d/cs.repo
    [cs]
    name=cs
    baseurl=http://192.168.3.149:8083/repository/centos/
    enabled=1
    gpgcheck=0
    priority=1
    EOF
    systemctl stop firewalld
    systemctl disable firewalld
    sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/‘ /etc/selinux/config
    #x11的功能是否可用
    yum install -y xauth xclock
    sshd -T|grep “x11uselocalhost yes” && (
    sed -i “s/#X11UseLocalhost yes/X11UseLocalhost no/g” /etc/ssh/sshd_config
    )
    service sshd restart
    :<
    正常工作sshd的配置类似如下
    x11displayoffset 10
    x11maxdisplays 1000
    x11forwarding yes
    x11uselocalhost no
    EOF
    touch /home/vagrant/.Xauthority
    chmod 666 /home/vagrant/.Xauthority
    yum install -y google-chrome-stable
    # centos的不同版本变化有点让人崩溃 centos7以后使用的是Fonts
    # yum install -y groupinstall “fonts”
    yum install google-noto-sans-simplified-chinese-fonts.noarch
    yum groupinstall Fonts
    #你的客户机器上只要有了XSERVER
    # 1 ssh -X -o StrictHostKeyChecking=no -i key/id_rsa vagrant@192.168.99.200
    # 2 执行 google-chrome —use-gl=swiftshader 即可使用浏览器了
    echo “SSH and use 【 google-chrome —use-gl=swiftshader 】 “
    echo “done”
  • http://**${**SERVER_IP**}**:9000/ “">!/bin/bash
    #在你自己的机器上指直接执行这个即使用SERVER_IP机器中安装好的chrome,去除了客户端的浏览器兼容问题
    SERVER_IP=192.168.99.200
    SSH_USRERNAME=vagrant
    while [ $# -gt 0 ]
    do
    case “$1” in #参数的类型参考mysql的参数,尽量保持一致
    —ip)
    SERVER_IP=$2
    shift 2
    ;;
    —sshUserName)
    SSH_USRERNAME=$2
    shift 2
    ;;
    esac
    done
    echo “${SERVER_IP} ${SSH_USRERNAME}
    ssh -Y -o StrictHostKeyChecking=no -i key/id_rsa ${SSH_USRERNAME}@${SERVER_IP} “google-chrome —use-gl=swiftshader http://**${**SERVER_IP**}**:9000/

    背景

    为了简化服务器主机的浏览器版本的一致性、运维环境下的端口影响等问题,对基本的维护可以只通过SSH端口进行

    使用X11中转功能,在服务器上运行浏览器,登录主机的SSH客户端这里可以直接看到服务器运行的chrome界面进行操作

    达到的效果

    • 客户端不用安装浏览器,产品的兼容性问题时我们发布的机器上即可验证
    • 如果https通道不通的话,仍然可以管理。SSH一般的地方都会开放

      步骤

      linux服务器

      centos7.4 【最小化安装的即可】主机上执行如下步骤

    !/bin/bash
    # centos7 物理机为了支持远程客户端的X11显示桌面程序的支持
    # 将桌面程序直接在这里安装
    rm -rf /etc/yum.repos.d/*
    cat < /etc/yum.repos.d/cs.repo
    [cs]
    name=cs
    baseurl=http://192.168.3.149:8083/repository/centos/
    enabled=1
    gpgcheck=0
    priority=1
    EOF
    systemctl stop firewalld
    systemctl disable firewalld
    sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/‘ /etc/selinux/config
    #x11的功能是否可用
    yum install -y xauth xclock
    sshd -T|grep “x11uselocalhost yes” && (
    sed -i “s/#X11UseLocalhost yes/X11UseLocalhost no/g” /etc/ssh/sshd_config
    )
    service sshd restart
    :<
    正常工作sshd的配置类似如下
    x11displayoffset 10
    x11maxdisplays 1000
    x11forwarding yes
    x11uselocalhost no
    EOF
    touch /home/vagrant/.Xauthority
    chmod 666 /home/vagrant/.Xauthority
    yum install -y google-chrome-stable
    # centos的不同版本变化有点让人崩溃 centos7以后使用的是Fonts
    # yum install -y groupinstall “fonts”
    yum install google-noto-sans-simplified-chinese-fonts.noarch
    yum groupinstall Fonts
    #你的客户机器上只要有了XSERVER
    # 1 ssh -X -o StrictHostKeyChecking=no -i key/id_rsa vagrant@192.168.99.200
    # 2 执行 google-chrome —use-gl=swiftshader 即可使用浏览器了
    echo “SSH and use 【 google-chrome —use-gl=swiftshader 】 “
    echo “done”

    客户端

    Windows

    https://mobaxterm.mobatek.net/download.html 下载MobaXterm【普通使用Free版本就够了】
    MobaXterm默认启动了Xserver,直接可用
    Linux服务器的x11方式远程管理参考 - 图1
    Linux服务器的x11方式远程管理参考 - 图2
    这个软件只要设置即可使用

    在linux主机上运行chrome后的效果如下
    Linux服务器的x11方式远程管理参考 - 图3

    Linux客户端

    在带有桌面环境LINUX系统下,传入对应的IP,执行这个脚本即可

    !/bin/bash
    #在你自己的机器上指直接执行这个即使用SERVER_IP机器中安装好的chrome,去除了客户端的浏览器兼容问题
    SERVER_IP=192.168.99.200
    SSH_USRERNAME=vagrant
    while [ $# -gt 0 ]
    do
    case “$1” in #参数的类型参考mysql的参数,尽量保持一致
    —ip)
    SERVER_IP=$2
    shift 2
    ;;
    —sshUserName)
    SSH_USRERNAME=$2
    shift 2
    ;;
    esac
    done
    echo “${SERVER_IP} ${SSH_USRERNAME}
    ssh -Y -o StrictHostKeyChecking=no -i key/id_rsa ${SSH_USRERNAME}@${SERVER_IP} “google-chrome —use-gl=swiftshader http://**${**SERVER_IP**}**:9000/