说明:
- 1.我自己用的Linux都是Ubuntu,也想用树莓派搭建自己的小服务器/NAS
- 2.百度到树莓派可以装Ubuntu-mate系统,我就赶紧去装了,但是我没有屏幕,无法引导系统,也无法使用SSH,于是我装了树莓派系统,但是我用不惯,于是我又想折腾Ubuntu了!
- 3.这里需要注意的是,Ubuntu-mate是带桌面的,如果没有屏幕是不能使用的,UbuntuServer是不需要屏幕就能安装的
- 4.各个版本的镜像下载Ubuntu镜像
- 5.使用镜像写入软件进行写入TF卡(4G以上),我使用的是BalenaEtcher(https://www.balena.io/etcher),也可以使用其他的软件写入
- 6.将TF卡插入树莓派,接上电源和网线,打开路由器的管理界面,找到路由器的终端管理,查看名叫Ubuntu的设备的IP
- 7.使用SSH工具连接树莓派,Windows下可以使用PUTTY/XSHELL/SecureCRT等工具,我是macOS可以使用系统自带终端。
- 8.输入
ssh ubuntu@你的树莓派IP
连接树莓派,密码也为ubuntu,登录成功会有如下的界面,在Current password:处输入你的旧密码(ubuntu),在New password: 和Retype new password: 处输入你要设置的新密码。(输密码的时候没有光标提示,尽管输入就可)
ubuntu@192.168.2.107's password:
You are required to change your password immediately (administrator enforced)
Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-1028-raspi aarch64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Sun Mar 7 20:19:00 UTC 2021
System load: 0.79 Temperature: 49.7 C
Usage of /: 6.2% of 28.96GB Processes: 141
Memory usage: 7% Users logged in: 0
Swap usage: 0% IPv4 address for eth0: 192.168.2.107
0 updates can be installed immediately.
0 of these updates are security updates.
The list of available updates is more than a week old.
To check for new updates run: sudo apt update
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
WARNING: Your password has expired.
You must change your password now and login again!
Changing password for ubuntu.
Current password:
New password:
Retype new password:
- 9.重新使用
ssh ubuntu@你的树莓派ip
和你的新密码进行登录。得到如下界面
Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-1028-raspi aarch64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Sun Mar 7 20:20:42 UTC 2021
System load: 0.69 Temperature: 51.1 C
Usage of /: 6.4% of 28.96GB Processes: 140
Memory usage: 7% Users logged in: 0
Swap usage: 0% IPv4 address for eth0: 192.168.2.107
0 updates can be installed immediately.
0 of these updates are security updates.
The list of available updates is more than a week old.
To check for new updates run: sudo apt update
Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings
Last login: Sun Mar 7 20:19:04 2021 from 192.168.2.195
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
- 10.安装完成,完美!
- 11.安装桌面
#更新
apt update
#安装桌面环境
sudo apt install xfce4 xfce4-goodies
#安装vncserver
apt install tightvncserver
#启动vncserver
vncserver
#关闭vncserver :1窗口
vncserver -kill :1
#备份原来的配置文件
cp ~/.vnc/xstartup ~/.vnc/xstartup.bak
#编辑新的配置文件
vim ~/.vnc/xstartup
将xstartup文件更改为如下
#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &
重新启动vncserver