Fisher's Blog

Sein heißt Werden
Leben heißt Lernen

0%

树莓派配置记录

换源

编辑 /etc/apt/sources.list 文件,删除原文件所有内容,用以下内容取代:

1
2
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib

编辑 /etc/apt/sources.list.d/raspi.list 文件,删除原文件所有内容,用以下内容取代:

1
deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui

挂载 U 盘

参考:https://www.jianshu.com/p/0ea8e7b7d64d

1
2
3
$ sudo mkdir /mnt/usb
$ sudo mount -o uid=pi,gid=pi,umask=007 /dev/sda1 /mnt/usb
$ sudo umount /mnt/usb

安装 bt 下载器 transmission

参考:https://shumeipai.nxez.com/2013/09/08/raspberry-pi-bt-download-servers.html

1
2
3
sudo apt-get install transmission-daemon
sudo usermod -G pi debian-transmission
sudo nano /etc/transmission-daemon/settings.json

配置 settings.json

1
2
3
4
5
"download-dir": "/mnt/usb/downloads",
未完成的下载目录
"incomplete-dir": "/mnt/usb/downloads",
允许Web访问的白名单地址
"rpc-whitelist": "192.168.0.*",
1
2
sudo service transmission-daemon reload
sudo service transmission-daemon restart

安装 Adafruit_Python_GPIO

1
2
3
4
5
sudo apt-get update
sudo apt-get install build-essential python3-pip python3-dev python3-smbus git
git clone https://github.com/adafruit/Adafruit_Python_GPIO.git
cd Adafruit_Python_GPIO
sudo python3 setup.py install

开启 i2c

1
sudo raspi-config

安装 python3 gpio

1
sudo apt-get install python3-rpi.gpio

更新 pip

1
2
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
pip install pip -U