树莓派4B Ubuntu 远程桌面 步骤

准备

Ubuntu Mate / Ubuntu Desktop版本为22.04

官网只能下载最新版22.04:

https://ubuntu-mate.org/raspberry-pi/download/

下载20.04版本无法正常启动:

https://blog.csdn.net/qq_52785580/article/details/122599728
http://www.okey56.com/zb_users/upload/2021/10/202110241635088474188702.torrent

先用balenaEtcher重装系统。设置开机自动登录!首先安装输入法。

更换国内源

不更换也可以。备份软件源文件,以免修改坏了

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

打开软件源文件,使用nano进行修改

sudo nano /etc/apt/sources.list

添加对应Ubuntu版本的源,不要在网上随便复制。Ubuntu22.04换成这个:

deb http://mirrors.aliyun.com/ubuntu-ports/ jammy main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu-ports/ jammy main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu-ports/ jammy-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu-ports/ jammy-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu-ports/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu-ports/ jammy-updates main restricted universe multiverse
# deb http://mirrors.aliyun.com/ubuntu-ports/ jammy-proposed main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu-ports/ jammy-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu-ports/ jammy-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu-ports/ jammy-backports main restricted universe multiverse

更新软件列表和软件

sudo apt update
sudo apt upgrade

https://blog.csdn.net/qq_52785580/article/details/122599728

安装SSH

The OpenSSH server is not installed by default. Simply install it to to enable SSH.

sudo apt install openssh-server

If you install SSH then you might also want to install sshguard which is highly optimised and well suited for use on the Raspberry Pi to protect from brute force attacks against SSH.

sudo apt install sshguard

https://ubuntu-mate.org/raspberry-pi/

安装ubuntu-desktop

sudo apt install ubuntu-desktop

xrdp方法

安装:sudo apt install xrdp

重启Xrdp服务器:sudo service xrdp restart / sudo systemctl start xrdp

查看服务运行状态:sudo service xrdp status / systemctl status xrdp

如果状态像下图一样是Active就可以了:
在这里插入图片描述
设置开启自动启动:sudo update-rc.d xrdp defaults / sudo systemctl enable xrdp

以上步骤完成后,即可用PC端的远程桌面连接树莓派,先查看树莓派IP地址:

ifconfig

若报错,安装 net-tools:

sudo apt install net-tools

Windows快捷键win+R,输入mstsc,输入树莓派IP地址即可连接。

https://mp.weixin.qq.com/s/UWgDs0UA_SegAoWl4X5eRg
https://www.freesion.com/article/3137780425/

对于Ubuntu Desktop 22.04

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

先执行上述“xrdp方法”,在防火墙中打开3389端口。
要让网络中的其他系统通过 RDP 远程访问 Ubuntu 22.04 Jammy,请在系统防火墙上打开端口号 3389。

sudo ufw allow from any to any port 3389 proto tcp

注销 Ubuntu 22.04
安装完成后,只需注销Ubuntu 22.04 系统,否则在使用 XRDP 远程连接 Ubuntu 时,Windows 遇到黑屏问题。

实测Ubuntu 22.04成功。

https://www.cnblogs.com/pipci/p/16377032.html

VNC方法

1.安装VNC

sudo apt-get install x11vnc

2.创建vnc密码

x11vnc -storepasswd

输入两边密码,回车

3.启动vnc

x11vnc -usepw

4.建立远程连接

查看树莓派IP地址:ifconfig
在这里插入图片描述

https://blog.csdn.net/qq_52785580/article/details/122599728

Ubuntu Mate20.04测试成功。

Ubuntu Mate22.04提示系统不支持VNC。

问题故障解决

花屏

问题原因:乌班图13.10以后的版本xrdp不支持gnome和unity

解决方法:下载xfce4,重启xrdp即可

sudo apt-get install xfce4
echo "xfce4-session" >~/.xsession
sudo service xrdp restart

https://blog.csdn.net/Hao_ge_666/article/details/123953446

尝试无效。

蓝屏/黑屏

  • 尝试一

执行下面代码,删除两个文件目录。
注意:pi 替换为自己的用户名!!!,比如我的用户名是lumuzi。则sudo gpasswd -d lumuzi video

sudo gpasswd -d pi video
sudo gpasswd -d pi render

执行命令,进行系统设置。

sudo raspi-config

依次选择进入System options -> Boot / Auto Login ->Desktop(Desktop GUI, requiring user to login)

然后确定重启。

尝试无效。

https://blog.csdn.net/qq_44696500/article/details/124543039

  • 尝试二

如果用PC端的远程桌面连接时出现灰屏现象,就需要再进行以下设置:

① 创建一个配置文件:sudo touch ~/.xsession
② 进入文件编辑:sudo nano ~/.xsession
③ 复制以下内容到文件:

unset DBUS_SESSION_BUS_ADDRESS
mate-session
TZ='Asia/Shanghai'; export TZ

④ ctrl+x退出编辑,提示是否保存的时候选择Y,再回车即可保存。
⑤ 重启树莓派,再次连接的时候即可进入桌面。

尝试无效。

https://mp.weixin.qq.com/s/UWgDs0UA_SegAoWl4X5eRg

无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系

使用aptitude进行安装,aptitude 会对依赖关系进行智能处理

sudo apt-get install aptitude
sudo aptitude install <package name>

https://blog.csdn.net/weixin_43846270/article/details/103779781?spm=1001.2014.3001.5506

参考

https://blog.csdn.net/qq_52785580/article/details/122599728
https://shumeipai.nxez.com/2022/11/28/ubuntu-server-installs-graphical-interface-and-remote-desktop.html

  • 0
    点赞
  • 45
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值