一、树莓派烧录Ubuntu-18.04
本文用的是32G内存卡,安装ubuntu-18.04.5-preinstalled-server-arm64+raspi3系统,是64位系统。
下载镜像,选择 ubuntu-18.04.3-preinstalled-server-armhf+raspi3.img.xz 的镜像进行下载
从官方下载镜像:https://wiki.ubuntu.com/ARM/RaspberryPi
或者从这里下载: http://cdimage.ubuntu.com/releases/18.04/release/
需要的硬件: 需树莓派4B、8G以上的SD卡、树莓派的HDMI线、电源、网线、USB的鼠标和键盘。
需要的软件工具: 需SD Card Formatter(用来格式化SD卡) 、 Win32DiskImager(用来写入镜像)
1.用SD Card Formatter格式化一下 格 SD卡
2.用Win32DiskImager给SD烧录ubuntu 18.04.4 64位镜像
在U盘根目录下创建两个文件(cmdline.txt和config.txt在这里插入代码片),并分别复制相应的内容,写入文件并保存,也可以将百度网盘已经写好的文件下载后拷贝到U盘根目录。
创建cmdline.txt ,将下面的内容复制到文件里面并保存
dwc_otg.fiq_fix_enable=2 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait rootflags=noload net.ifnames=0
创建config.txt,将下面的内容复制到文件里面并保存
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
[pi4]
[all]
同时,记得创建一个空文件,改名为SSH(不要有文件后缀名.txt),放到U盘根目录,开启SSH远程登录,如果安装之后没法进入系统,没关系,用远程登录即可。
到目前为止,就可以将内存卡插入到你的树莓派4b,启动系统了,首次启动时间比较长,需要2-3分钟,请耐心等待。
默认的登陆用户名和密码都为:ubuntu
二、换源
此时应该把树莓派接上显示屏和网线,在树莓派上进行操作。首先,先执行一下sudo apt-get update看是否能够成功,如果成功,等待更新完成,不会太久,确定能构正常更新,就执行一下步骤进行换源:
sudo nano /etc/apt/sources.list
## Note, this file is written by cloud-init on first boot of an instance
## modifications made here will not survive a re-bundle.
## if you wish to make changes you can:
## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg
## or do the same in user-data
## b.) add sources in /etc/apt/sources.list.d
## c.) make changes to template file /etc/cloud/templates/sources.list.tmpl
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic main restricted
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-updates main restricted
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic universe
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic universe
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-updates universe
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-updates multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-security main restricted
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-security main restricted
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-security universe
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-security universe
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-security multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic-security multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner
其中GNU nano使用保存退出的说明如下:
文件编辑中常用快捷键:ctrl+X 离开nano软件,若有修改过的文件会提示是否保存;选择 :yes
又提示:file name to write :***.launch ,选择:Ctrl+T
在下一个界面用 “上下左右” 按键 选择要保存的文件名,
然后直接点击 “Enter” 按键即可保存.
ctrl+O 保存文件; ctrl+W 查询字符串;
ctrl +C 说明目前光标所在处的行数和列数等信息;
ctrl+ _ 可以直接输入行号,让光标快速移到该行;
————————————————
版权声明:本文为CSDN博主「锲启」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_44166997/article/details/93216783
换源之后记得更新一下:
sudo apt update
sudo apt upgrade
三、安装Ubuntu可视化桌面
安装桌面的时候,会出现依赖的问题,先安装aptitude,用aptitude能够自动安装所缺失的依赖
sudo apt-get install aptitude
喜欢桌面操作的可以安装官方推荐的桌面,以下三个安装其中一个即可:
1.sudo aptitude install xubuntu-desktop
2.sudo aptitude install lubuntu-desktop
3.sudo aptitude install kubuntu-desktop
安装完之后重启树莓派(ps:一定要等完全安装完之后再进行重启树莓派,这样才可以正常的进入到可视化桌面)至此进入到如下所示的界面,博主安装的可视化桌面是第一个,效果如下: