本文提供两种方法实现在MacOS上的Ubuntu GUI(图形界面)显示。
方法一功能更加强大,但是界面相对卡顿一些,适合检查性操作,比如刚入门的小白还不太习惯通过命令终端去执行操作,就可以用这种方法作为辅助。
方法二更加轻量,可以实现服务器端单个应用的GUI到主机上的映射(比如打开jupyter notebook、pycharm),对GUI界面操作时很流畅。
可以实现整个Ubuntu系统界面的显示,具体请参考:博客中VNC部分。
安装服务器上的X11
sudo apt-get install xorg
sudo apt-get install openbox
取消ssh_config文件中ForwardX11 yes
的注释
sudo vim /etc/ssh/ssh_config
Host *
# ForwardAgent no
ForwardX11 yes
# ForwardX11Trusted yes
# RhostsRSAAuthentication no
保存退出,并重启服务器的ssh服务
sudo /etc/init.d/ssh restart
安装XQuartz
安装完成后,同样对ssh_config进行修改。
sudo vim /etc/ssh/ssh_config
修改如下(仅修改这部分就可,别都改了):
# Host *
# ForwardAgent no
# ForwardX11 yes
# PasswordAuthentication yes
# HostbasedAuthentication no
# GSSAPIAuthentication no
# GSSAPIDelegateCredentials no
# BatchMode no
# CheckHostIP yes
# AddressFamily any
# ConnectTimeout 0
# StrictHostKeyChecking ask
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa
# IdentityFile ~/.ssh/id_ecdsa
# IdentityFile ~/.ssh/id_ed25519
# Port 22
# Protocol 2
# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc
# MACs hmac-md5,hmac-sha1,umac-64@openssh.com
# EscapeChar ~
# Tunnel no
# TunnelDevice any:any
# PermitLocalCommand no
# VisualHostKey no
# ProxyCommand ssh -q -W %h:%p gateway.example.com
# RekeyLimit 1G 1h
Host *
SendEnv LANG LC_*
ForwardX11 yes
登陆服务器
ssh -X username@host
cd到pycharm的bin目录,输入
./pycharm.sh # 启动pycharm
截图效果如下(不知为何截图后成了这样):
实际效果:
自取: https://pan.baidu.com/s/166DQ_BHmF5PWfAyjbBhJjA 密码: apac
ubuntu界面在mac os可视化、显示ubuntu的GUI到本地
原文:https://www.cnblogs.com/Allen-mat/p/14673216.html