ubuntu界面在mac os可视化、显示ubuntu的GUI到本地

本文提供两种方法实现在MacOS上的Ubuntu GUI(图形界面)显示。

方法一功能更加强大,但是界面相对卡顿一些,适合检查性操作,比如刚入门的小白还不太习惯通过命令终端去执行操作,就可以用这种方法作为辅助。

方法二更加轻量,可以实现服务器端单个应用的GUI到主机上的映射(比如打开jupyter notebook、pycharm),对GUI界面操作时很流畅。

方法一:借助VNC软件

可以实现整个Ubuntu系统界面的显示。具体教程大家网上搜下吧,本来放了推荐的博客的链接的,但CSDN说我涉及到版权问题?

方法二:借助X11(XQuartz)

step1:配置远程服务器

安装服务器上的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
step2:配置本机(MacOS)

安装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
step3:测试

登录服务器

ssh -X username@host

cd到pycharm的bin目录,输入

./pycharm.sh  # 启动pycharm

截图效果如下(不知为何截图后成了这样):截屏2021-04-18 下午12.21.03

实际效果:

WechatIMG544
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值