给树莓派4重装Raspbian系统并进行相关设置

1. 从官网下载最新系统镜像

在Windows下从官网下载最新系统镜像
下载地址:Raspbian下载
选择“Raspbian Buster with desktop and recommended software-Download Torrent”
然后可以用迅雷下载,这样速度较快
下载完成后解压,得到文件“2019-09-26-raspbian-buster-full.img”

2. 使用Win32 Disk Imager烧录系统到TF卡

以下操作也均在Windows中完成

2.1 下载并安装Win32 Disk Imager

首先从http://sourceforge.net/projects/win32diskimager/files/latest/download下载Win32 Disk Imager软件
(科学上网可以提高下载速度)
下载完成后正常安装即可

2.2 格式化TF卡

(1) 使用DiskGenius软件,左键选择TF卡,然后右键TF卡,点击“删除所有分区”,并确认
(2) 再次右键TF卡,选择“保存分区表”,并确认
(3) 这个时候还不能正常使用,需要给它再新建分区。再次右键 TF卡,并选择“快速分区”。根据下图配置分区,并确认:
给TF卡新建分区

2.3 烧录系统

使用Win32 Disk Imager将img文件烧录到TF卡
烧录系统
点击“写入”,然后耐心等待
成功后即可弹出TF卡,然后安装在树莓派上测试

3. 树莓派4开机并设置

以下内容在连接有显示器、键盘、鼠标的条件下进行
首次开机后在“Set Country”处注意勾选“Use US keyboard”
接下来进行一些必要的设置

3.1 拓展分区

在终端使用命令“df -h”可以查看容量等信息
初次使用时,TF卡中还存在大量未分配空间需要拓展
(1) 在终端输入sudo raspi-config,回车
(2) 选择“7 Advanced Options”,回车
(3) 选择“A1 Expand Filesystem”,回车
(4) “确定”,回车
(5) “Finish”, 然后重启

3.2 开启Camera、SSH与VNC

在图形界面下,打开“菜单 > 首选项 > Raspberry Pi Configuration”
点击“Interfaces”栏,“Enable” 相应服务

3.3 更换apt源

(1)
编辑 /etc/apt/sources.list 文件
在终端输入如下命令:sudo nano /etc/apt/sources.list
用’#'注释掉原文件内容,用以下内容取代:

deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ buster main contrib non-free rpi
deb-src http://mirrors.ustc.edu.cn/raspbian/raspbian/ buster main contrib non-free rpi

注:
中科大源:http://mirrors.ustc.edu.cn/raspbian/raspbian/
清华源:http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/
(2)
编辑 /etc/apt/sources.list.d/raspi.list 文件
在终端输入如下命令:sudo nano /etc/apt/sources.list.d/raspi.list
用’#'注释掉原文件内容,用以下内容取代:

deb http://mirrors.ustc.edu.cn/archive.raspberrypi.org/debian/ buster main   
deb-src http://mirrors.ustc.edu.cn/archive.raspberrypi.org/debian/ buster main

(3)
同步更新源,执行如下命令:sudo apt-get update
更新升级以安装软件包:sudo apt-get upgrade
可能遇到文件管理器打开闪退的情况,执行:sudo apt full-upgrade

3.4 更换pip源

编辑文件/etc/pip.conf
在终端输入如下命令:sudo nano /etc/pip.conf
打开后该文件中的原始内容为:

[global]
extra-index-url=https://www.piwheels.org/simple

修改后的内容为:

[global]
index-url = https://pypi.mirrors.ustc.edu.cn/simple/                                               
extra-index-url = https://www.piwheels.org/simple

临时使用某个源:

pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple [some-package]

3.5 安装中文输入法

这里选择安装中文输入法Fcitx及Google拼音输入法
树莓派连接网络,在终端输入下面的命令:

sudo apt-get install fcitx fcitx-googlepinyin fcitx-module-cloudpinyin fcitx-sunpinyin

安装完毕后重启即可
之后输入时按“Ctrl+空格”切换输入法

4. 备份系统

可以将设置好的系统备份一份,方便以后恢复
首先新建一个空白的.img后缀的文件,例如在E盘根目录下新建一个文件“raspberrypi_20191229.img”
然后使用Win32 Disk Imager软件中的读取操作将TF卡中的内容备份,注意千万不能点“写入”
恢复系统的操作与“2. 使用Win32 Disk Imager烧录系统到TF卡”类似

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值