树莓派不吃灰行动

别让你的树莓派吃灰!

1.更新国内源

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 sudo nano /etc/apt/sources.list #输入一下内容

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware

deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware

# deb https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
# # deb-src https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
1
2
3
   sudo nano /etc/apt/sources.list.d/raspi.list #输入以下内容
  
   deb http://mirror.tuna.tsinghua.edu.cn/raspberrypi/ bookworm main
1
2
3
4
5
6
7
#添加公钥
gpg --keyserver keyserver.ubuntu.com --recv-keys 9165938D90FDDD2E
gpg --export --armor 9165938D90FDDD2E | sudo apt-key add -

#更新
sudo apt-get update
sudo apt-get upgrade

2.Windows远程控制桌面

1
2
3
sudo apt-get install tightvncserver
sudo apt-get install xrdp

3.Docker

Docker安装

1
sudo curl -fsSL https://get.docker.com -o get-docker.sh
1
sudo sh get-docker.sh

docker-compose安装

1
sudo apt-get update
1
sudo apt-get install -y python python-pip
1
sudo apt-get install libffi-dev
1
sudo pip3 install docker-compose -i https://pypi.mirrors.ustc.edu.cn/simple/  --trusted-host  pypi.mirrors.ustc.edu.cn

portainer安装(可视化管理镜像)

1
docker pull portainer/portainer-ce
1
docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock --restart=always --name portainer portainer/portainer-ce

更新portainer

1
docker stop portainer
1
docker rm portainer
1
docker pull portainer/portainer-ce:latest

青龙面板

1.用root权限安装

1
2
3
4
5
6
7
8
9
10
11
12
13
docker run -dit \
-v /home/pi/qinglong/ql/config:/ql/config \
-v /home/pi/qinglong/ql/log:/ql/log \
-v /home/pi/qinglong/ql/db:/ql/db \
-v /home/pi/qinglong/ql/repo:/ql/repo \
-v /home/pi/qinglong/ql/raw:/ql/raw \
-v /home/pi/qinglong/ql/scripts:/ql/scripts \
-v /home/pi/qinglong/ql/jbot:/ql/jbot \
-p 5700:5700 \
--name qinglong \
--hostname qinglong \
--restart unless-stopped \
whyour/qinglong:latest
1
直接拉库即可

3.京东获取cookie
4.环境变量设置JD_COOKIE
5.教程合集

HomeAssistant(HA)

安装

使用docker进行安装,其中/home/pi/home-assistant修改为您的路径 network设置为bridge

1
2
3
4
5
6
7
8
9
docker run -d \
--name homeassistant \
-p 8123:8123 \
--privileged \
--restart=unless-stopped \
-e TZ=Asia/Shanghai \
-v /home/pi/home-assistant:/config \
--network=bridge \
ghcr.io/home-assistant/raspberrypi4-homeassistant:stable
1
2
3
4
5
6
7
8
9
docker run -d \
--name homeassistant \
-p 8123:8123 \
--privileged \
--restart=unless-stopped \
-e TZ=Asia/Shanghai \
-v /home/pi/homeassistant:/config \
--network=host \
ghcr.io/home-assistant/raspberrypi4-homeassistant:stable

vlc

1
2
sudo apt install vlc
vlc -I telnet --telnet-host 192.168.XX.XX --telnet-port 4212 --telnet-password XXXX

集成搜索VLC media player Telnet

内网穿透

直接用cpolar穿透会有问题,需要修改configuration.yaml,添加以下信息,其中172.17.0.1是docker中bridge的Gateway,在portainer中很容易能找到这个地址。

1
2
3
4
http:
use_x_forwarded_for: true
trusted_proxies:
- 172.17.0.1

修改完毕后输入以下命令即可使用内网穿透,这样外网也能访问

1
cpolar http 8123

文件管理

发现一个不错的文件管理插件,下载地址.
把里面的ha_file_explorer-master\custom_components\ha_file_explorer中的这个文件夹移到HA的custom_components中,重启HA,然后点击此链接配置

更换主题

更换主题和更换UI前提需要安装HomeAssistant的HACS,HACS有主题和UI下载,下载主题完毕后修改configuration.yaml,添加以下信息后重启HA

1
2
frontend:
themes: !include_dir_merge_named themes

重启完毕后在左下角选择用户资料,也就是通知下面那个栏目,右边有主题选择,此时会出现你下载你主题。

更换Lovelace

下载完毕后,编辑卡片,选择代码编辑器,默认为type: entities,此时你只需要查看你新的Lovelace名字,比如custom:mini-graph-card,把entities改成这个名字就可以了,更多设置请查看该Lovelace的文档。

nodered

1
sudo docker run -it -p 1880:1880 --name=nodered --restart=always --user=root --net=host -v /data/nodered:/data -e TZ=Asia/Shanghai nodered/node-red