1.准备好舒树莓派系统(本次使用ubunt-mate-20.04)。

点击下载

2.使用SDFormatter格式化内存卡。

3.使用Win32DiskImager烧录系统。

4.进入系统后更换国内源(本次使用阿里源)。

1.需要查看当前系统代号,控制台会输出Codename。

lsb_release -a

2.到阿里源看下这个源存在不存在,主要查看目录中有没有上面的Codename

http://mirrors.aliyun.com/ubuntu/dists/ x86系统
http://mirrors.aliyun.com/ubuntu-ports/dists/ 树莓派arm 本次用这个,x86同理

3.然后以下面的为模板,把’TODO’的地方换成上面的Codename

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

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

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

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

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

比如我换好20.04的源以后是这样:

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

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

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

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

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

5.更新缓存和升级。

sudo apt-get update
sudo apt-get upgrade

6.安装并开启ssh远程访问。

1.安装ssh服务端

sudo apt-get install openssh-server

2.确认sshserver是否启动了

ps -e | grep ssh

如果只有ssh-agent那ssh-server还没有启动,需要/etc/init.d/ssh start,如果看到sshd那说明ssh-server已经启动了

7.安装java环境

  • JRE(Java Runtime Environment)它是你运行一个基于Java语言应用程序的所正常需要的环境。如果你不是一个程序员的话,这些足够你的需要.
  • JDK代表Java开发工具包,如果你想做一些有关Java的开发(阅读程序), 这正是你所需要的.
  • OpenJDK是Java开发工具包的开源实现
  • Oracle JDK是Java开发工具包的官方Oracle版本

尽管OpenJDK已经足够满足大多数的案例,但是许多程序比如Android Studio建议使用Oracle JDK, 以避免UI/性问题。本次使用Open JDK

1.安装jre

sudo apt-get install default-jre

2.安装OpenJDK

sudo apt-get install default-jdk

特殊地, 如果你想要安装Java 8, Java 7或者Java 6等等,你可以使用openjdk-7-jdk/openjdk-6jdk, 但是记住在此之前安装openjdk-7-jre/openjdk-6-jre

3.安装Oracle JDK

使用下面的命令安装,只需一些时间,它就会下载许多的文件,所及你要确保你的网络环境良好:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default

如果你想安装Java 8(i.e Java 1.8), 在上面的命令中用java7代替java8.

Q.E.D.