树莓派Ubuntu18更换阿里源

平台:树莓派3B+
系统:ubuntu MATE18


安装完成树莓派开始配置系统中发现使用官方源速度太慢,开始更换境内源,晚上很多资料都是16版本的,所以只能自己去找地址;
一直对source.list文件一知半解,安装ubuntu镜像更新,一直提示没有arm64package.研究发现,ubuntu默认是i386平台的,在阿里云镜像网址下是在ubuntu-port下有arm64平台,ubuntu路径下面是没有arm64包的.
PS:切记备份原始文件

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

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

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

deb http://mirrors.aliyun.com/ubuntu-ports/ bionic-updates main restricted universe multiverse

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

deb http://mirrors.aliyun.com/ubuntu-ports/ bionic-backports main restricted universe multiverse

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

deb http://mirrors.aliyun.com/ubuntu-ports/ bionic-proposed main restricted universe multiverse

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

在上述命令中bionic是系统版本号,后面几个参数是对软件包的分类(Ubuntu下是main, restricted,universe ,multiverse这四个),网上很多更新源都是在ubuntu路径下修改,在树莓派平台上是不行的,切记改为ubuntu-ports路径.
更新完成后进行update 和upgrade.


PS :不知是使用阿里源的问题还是中文版的问题,安装ros总是出现适配问题,无法安装,重装英文版后选择中科大源解决问题

deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse

deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse

deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse

deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse

树梅派3B+安装Ubuntu MATE18.04

平台:树梅派3B+
系统:ubuntu mate 18.04


1.下载mate系统镜像,官网地址
2.下载并解压缩.文件压缩包格式为xz,烧录系统需要dd命令,若无配置命令

sudo apt-get install gddrescue xz-utils
unxz ubuntu-mate-***.img.xz

3.插入SD卡查看挂载路径

lsblk
  1. 根据挂载路径替换/dev/sd* (eg:/dev/sdb)
sudo ddrescue -D --force ubuntu-mate-***.img /dev/sdx

树梅派PI 3B+ MATE18.04开始ssh

平台:树梅派3B+
系统:ubuntu MATE 18.04


系统默认不开启ssh,使用raspi-config开启ssh服务端
1.sudo raspi-config
2. 进入第三项
3. 选则p2回车
4. 选择yes回车
5. 等待完成回车确认
6. 退出配置,ps -e | grep ssh 看到sshd即开启


1.设置完成后,在/etc/ssh/sshd_config内打开22端口,取消port 22 注释,配置完成后重启sshd:

systemctl restart sshd.service

2.若还是无法连接检查端口时候开启

ss -tnlp

3.防火墙状态查看

sudo ufw status

开启端口

sudo ufw allow 22

3.检查sshd.service服务是否开启

systemctl status sshd.service

PS : 在所有状态检查OK,在客户端连接出现Connection closed by X.X.X.X,在服务端,在

systemctl status sshd.service

上可以看到sshd error: could not load host key.
检查key地址:

ls -al /etc/ssh/ssh*key 

发现路径下无key文件,或者key文件大小为0,重新生成key文件

sudo rm -r /etc/ssh/ssh*key  
sudo dpkg-reconfigure openssh-server 

PS:最近在重新安装mate后,使用英文版发现raspi命令竟然没有ssh选项,那只能命令安装

sudo apt install openssh-server

安装完成后记得设置开机启动,出现问题可以参考上面的内容

sudo systemctl enable ssh