介绍
Linux系统也是有图像界面的。它的方式和Windows不一样,叫做 X Window,采用的是X11协议。X11 中的 X 指的就是 X 协议;11 指的是采用 X 协议的第 11 个版本
客户端是X server,用MobaXterm登录服务器,MobaXterm就是X Server,Ubuntu服务器是X Client
登陆ECS时,最开始这个图像界面是不可用的:X11-forwarding : ✘ (disabled or not supported by server)
此时在服务器上运行一个要展示图形界面的程序,结果会是失败的
[root@ctos ~]# xclock
安装
安装 X11,需要在root下执行
[root@ctos ~]# yum install xorg-x11-xauth xorg-x11-fonts-* xorg-x11-font-utils xorg-x11-fonts-Type1 xclock
修改参数,启用X11 Forwarding
[root@ctos ~]# vim /etc/ssh/sshd_config
修改参数X11Forwarding和X11UseLocalhost
#AllowAgentForwarding yes
重启sshd服务
[root@ctos ~]# systemctl restart sshd.service
root 用户执行 xhost +,该命令用于关闭访问控制,允许任何主机访问本地的X服务器;
[root@ctos ~]# xhost +
验证
用MobaXterm链接服务器,并验证
红框中显示如下,说明安装成功
运行xclock验证
[root@ctos ~]# xclock
转载博客:https://www.guitang.fun/coding/linux/centos7%e6%9c%ac%e5%9c%b0%e6%98%be%e7%a4%ba%e8%bf%9c%e7%a8%8b%e5%9b%be%e5%bd%a2%e7%95%8c%e9%9d%a2/
学科上网:https://www.guitang.fun/coding/linux/linux%E7%A7%91%E5%AD%A6%E4%B8%8A%E7%BD%91%EF%BC%88centos-7%EF%BC%89/