一、安装好系统
下载链接:https://www.raspberrypi.com/software/operating-systems/
二、SD卡插在电脑上
在磁盘根目录(/boot)下新建空文件ssh
磁盘根目录(/boot)下新建文件wpa_supplicant.conf
wpa_supplicant.conf填写内容如下
country=CN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="网络名称,使用英语,保留引号"
psk="网络密码,保留引号"
priority=1
}
最新版22年04月版本树莓派无系统账户需要添加
解决方法:在boot分区创建文件userconf
文件内容
用户名:加密后的密码
加密密码的方法:
echo ‘明文密码’ | openssl passwd -6 -stdin
pi:$6$qvj3hcXqsXwJjNMT$bCkcAw8f92OUJJ8r1lV77vJ3ZxUnKZ2TOqHSyHfrdA8bBa8x/AbgjgH6QZiI7DoqGaDMDDjgPd3B95ckW7OBX0
明文账号为pi
密码为raspberry
SD卡插上,开机,记录IP地址。
修改账户密码
sudo passwd pi
三、登录远程桌面
打开PuTTY, 在Host Name填入树莓派的IP地址,,点击OPEN,警告点击是。
登录默认用户名pi,默认密码raspberry。
输入
sudo raspi-config
简洁版,看不懂看图片
# Enable VNC
sudo raspi-config
# choose 5 Interfacing Options -> P3 VNC -> Enable VNC[Yes]
# change resolution
sudo raspi-config
# choose 7 Advanced Options -> A5 Resolution -> 1920*2080(Optional)
#Expand Filesystem
sudo raspi-config
# choose 7 Advanced Options -> choose A1 Expand Filesystem -> Reboot[yes]
#After reboot, check filesystem
df -h
选择合适的视频尺寸
重启
df -h
四、远程连接
在电脑打开VNC Viewer。按Ctrl+N输入树莓派IP地址。选择连接后输入树莓派的登录用户名密码,默认用户名pi,默认密码raspberry。确认后即可进入树莓派远程桌面。
五、换源
查看系统位数:
getconf LONG_BIT
返回64是64位,返回32是32位
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo cp /etc/apt/sources.list.d/raspi.list /etc/apt/sources.list.d/raspi.list.bak
sudo nano /etc/apt/sources.list
32位源:
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main contrib non-free rpi
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main contrib non-free rpi
64位源:
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
sudo nano /etc/apt/sources.list.d/raspi.list
32位源:
deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui
64位源:
deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ bullseye main
sudo apt-get update
sudo apt-get upgrade
sudo apt full-upgrade
ping百度时提示Temporary failure in name resolution,此时需要添加DNS
sudo vi /etc/systemd/resolved.conf
# 去掉DNS前面的#号 并添加如下内容
DNS=114.114.114.114