【教程】腾讯云Ubuntu 20.04 server安装图形界面,并用VNC Viewer远程连接 您所在的位置:网站首页 腾讯云服务器搭建ip教程视频下载失败怎么办 【教程】腾讯云Ubuntu 20.04 server安装图形界面,并用VNC Viewer远程连接

【教程】腾讯云Ubuntu 20.04 server安装图形界面,并用VNC Viewer远程连接

2024-01-20 13:12| 来源: 网络整理| 查看: 265

文章目录 前言1、安装图形界面2、用VNC Viewer远程连接图形界面小技巧:alias4、探究灰屏的原因(有点麻烦)5、关于灰屏:腾讯云工单中技术人员的反馈小结

前言

创作开始时间:2021年6月27日15:34:09

这里详细记录腾讯云服务器ubuntu20.04 server安装图形界面,并用vncviewer连接的过程。

1、安装图形界面

根据 搭建 Ubuntu 可视化界面,进行如下操作:

1)先打开xshell,用ssh连接一下服务器(这个就不详细介绍了,比较简单)

在这里插入图片描述

2)在xshell的终端中输入如下指令:

# 进入root sudo -s # update一下 apt-get update #安装vncserver apt-get install tightvncserver # 切换到普通用户 logout vncserver # 这之后要输入密码,输入就完事了。 # 安装x-winodws sudo apt-get install x-window-system-core # 安装登陆管理器 sudo apt-get install gdm3 # 安装ubuntu桌面 sudo apt-get install ubuntu-desktop # 安装gnome套件 sudo apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal

然后输入:nano ~/.vnc/xstartup,删除原有内容(如果有的话),填入如下内容:

#!/bin/sh # Uncomment the following two lines for normal desktop: export XKL_XMODMAP_DISABLE=1 unset SESSION_MANAGER # exec /etc/X11/xinit/xinitrc unset DBUS_SESSION_BUS_ADDRESS gnome-panel & gnome-settings-daemon & metacity & nautilus & gnome-terminal &

然后输入指令:

vncserver -kill :1 vncserver 2、用VNC Viewer远程连接图形界面

1)下载vnc viewer软件,这个就不赘述了;

2)在vnc viewer中,新建连接,输入:

:5901

然后连接就可以了。(需要输入密码验证,输入前面设置的密码就行了。)

在这里插入图片描述

3)连上之后长这样,说实话,挺丑的。很讨厌桌面,灰色的。但是其他功能都还正常。先凑合着用吧。

在这里插入图片描述

小技巧:alias

在终端输入:sudo nano ~/.bashrc,在末尾加入:

alias vkill='vncserver -kill :1' alias vnc2='vncserver :1' alias vnc='vncserver :1 -geometry 1920x1080'

然后保存,然后终端输入:source ~/.bashrc

以后就只需要输入:vnc和vkill就可以分别开启和关闭vncserver了。

4、探究灰屏的原因(有点麻烦)

其实主要是腾讯云官方文档的有一些不清楚的地方,或者说不适合我的场景。

为了研究这个,我花了很多时间,参考了:

关于灰屏:

Grey screen with VNC https://www.linux.org/threads/grey-screen-with-vnc.28929/Ubuntu 20.04 Gray screen on VNC https://askubuntu.com/questions/1278053/ubuntu-20-04-gray-screen-on-vncThread: VNC woes - can connect but see a grey screen https://ubuntuforums.org/showthread.php?t=2425810vncserver grey screen ubuntu 16.04 LTS https://askubuntu.com/questions/800302/vncserver-grey-screen-ubuntu-16-04-ltsvncviewe连接ubuntu系统显示灰屏解决方案 https://blog.csdn.net/jx18080136806/article/details/80239134解决配置Ubuntu中vnc远程显示灰屏 https://blog.csdn.net/weixin_34174422/article/details/93689750

关于图形界面安装: 7. How to Install VNC on Ubuntu 20.04, 18.04 & 16.04 (Windows, Linux and Mac) https://devanswers.co/install-vnc-ubuntu-18-04-windows-mac-linux/ 说要用putty,我试了,也不好使。 8. How to Install and Configure VNC Server on Ubuntu 20.04 LTS https://vitux.com/ubuntu-vnc-server/ 这个等下可以试试。 9. How to Install and Configure VNC on Ubuntu 20.04 https://linuxize.com/post/how-to-install-and-configure-vnc-on-ubuntu-20-04/ 试过了 10. Ubuntu 20.04 Remote Desktop Access with VNC https://www.answertopia.com/ubuntu/ubuntu-remote-desktop-access-with-vnc/ 11. VNC server on Ubuntu 20.04 Focal Fossa Linux https://linuxconfig.org/vnc-server-on-ubuntu-20-04-focal-fossa-linux 12. How to Install TightVNC Server on Ubuntu 20.04 https://serverspace.io/support/help/install-tightvnc-server-on-ubuntu-20-04/ 13. How To Install and Configure VNC Server on Ubuntu 20.04 https://tecadmin.net/install-vnc-server-on-ubuntu-20-04/ 也试了。没用。 14. How to Install and Configure VNC on Ubuntu 20.04 https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-ubuntu-20-04 15. Ubuntu 20.04系统中安装vncserver https://blog.csdn.net/booklijian/article/details/107734980 16. How to Install VNC on Ubuntu 20.04 https://www.spinup.com/how-to-install-vnc-on-ubuntu-20-04/

其他小问题: 17. How can I have new ~/.vnc/xstartup files be configured for normal desktop by default? https://unix.stackexchange.com/questions/52967/how-can-i-have-new-vnc-xstartup-files-be-configured-for-normal-desktop-by-def 18. How do I search for available packages from the command-line? https://askubuntu.com/questions/160897/how-do-i-search-for-available-packages-from-the-command-line 19. https://superuser.com/questions/1280568/tasksel-apt-get-failed-100

此外,我也参考了我自己以前的vnc相关博客: 20. VNC Viewer建立多个图形界面,来远程访问同一个服务器(Ubuntu) https://dalewushuang.blog.csdn.net/article/details/115407500 21. VNC Viewer 远程连接 Ubuntu 不显示桌面,也没有菜单栏(menu)(程序边栏)https://dalewushuang.blog.csdn.net/article/details/104273465 22. [解决方案] VNC Viewer 灰屏 (能够连接上,但全是灰点,没有任何菜单、按钮) https://dalewushuang.blog.csdn.net/article/details/104221023 23. 本地Windows远程连接阿里云服务器图形界面(使用vnc viewer) https://dalewushuang.blog.csdn.net/article/details/94554206

但是还是没有办法,我只是在一篇博客里面看到,gnome似乎对ubuntu 14.04之后的系统支持的不好。这可能导致了这种灰屏的情况。(就是说vncserver和ubuntu的发展没有适配,没有co-evolve起来。)

继续研究:

Install and Configure VNC Server on Ubuntu 18.04 https://computingforgeeks.com/how-to-install-vnc-server-on-ubuntu/

这样试了之后,发现可以用xfce4桌面了,还可以,但是网速实在太差了。

在这里插入图片描述 而且经常有报错:(我惊了) 在这里插入图片描述

感觉Ubuntu 20 server非常不友好。我不想用图形界面了。我在想要不要直接远程调试,所有的都是远程调试。但是我目前的电脑配置又好像不太行,不知道能不能开这么多个vscode window。

5、关于灰屏:腾讯云工单中技术人员的反馈

技术人员将灰屏的原因归结为:Ubuntu20和vncserver不适配。 他们推荐用ubuntu 16 或者 ubuntu 18。

通过这次实践,虽然屡次受挫,但是还是有些收获吧。 有些感受: 1)Ubuntu 虽然都发展到20了,但是并不意味着新版本就好用,很多配套的软件都还没跟上呢!这是最尴尬的吧。 2)深思熟虑之后,我觉得还是得用ubuntu 18。希望这次不会坑。

小结

到此为止。累了累了。以后有空再研究。

收获: 虽然这个巨坑,但是现在对ubuntu的几个图形界面还是比较了解了。gnome和xfce可以同时安装的,我们只需要通过调整xstartup文件,就可以选择用哪个图形界面。 然而,至今xstartup文件的内容还是个谜,根本不知道为啥要这样设置。 此外,ubuntu server而非desktop版本,对图形界面貌似非常不友好,而且不知道为啥,图形界面操作及其缓慢(网速?还是服务器的优化问题呢?尚未清楚)。

创作结束时间:2021年6月27日16:48:43 更新:2021年6月27日22:11:05 添加工单反馈。



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有