百度360必应搜狗淘宝本站头条
当前位置:网站首页 > IT知识 > 正文

树莓派基础安装(树莓派3b+安装)

liuian 2025-05-03 15:15 52 浏览

一、设置ll

vim ~/.bashrc
PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'

if [ -f "$HOME/.cargo/env" ]; then
    . "$HOME/.cargo/env"
fi
source ~/.bashrc

二、更改端口

1. 编辑配置

vim /etc/ssh/sshd_config

2. 设置参数

Port 8022
PermitRootLogin yes

3. 重启服务

systemctl restart ssh

4. 设置root密码

passwd root
passwd123

三、修改数据源(清华大学)

网站

cp /etc/apt/sources.list /etc/apt/sources.list.bak
vim /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://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
apt-get update && apt-get upgrade -y

四、配置固定IP

nmcli -p connection show
nmcli con mod "Wired connection 1" ipv4.addresses 192.168.1.100/24 ipv4.method manual
nmcli con mod "Wired connection 1" ipv4.gateway 192.168.1.1
nmcli con mod "Wired connection 1" ipv4.dns "223.5.5.5,114.114.114.114,8.8.8.8"
nmcli con up "Wired connection 1"
hostname -I

五、自动更新外网ip

安装软件

apt-get install python3-pip python3-venv

1、阿里云

cd /usr/local/
mkdir aliyun_update_dns
cd aliyun_update_dns/
python3 -m venv aliyun
source aliyun/bin/activate
pip install aliyun-python-sdk-core
pip install aliyun-python-sdk-alidns
pip install requests
python -c "import requests; print(requests.__version__)"
vim update_dns.py
python update_dns.py

2、cloudflare

cd /usr/local/
mkdir cloudflare_update_dns
cd cloudflare_update_dns/
python3 -m venv cloudflare
source cloudflare/bin/activate
pip install requests cloudflare
python cloudflare-ddns.py

定时器

crontab -e 
# */5 * * * * /usr/local/aliyun_update_dns/myenv/bin/python /usr/local/aliyun_update_dns/update_dns.py >> /usr/local/aliyun_update_dns/update_dns.log 2>&1
*/5 * * * * /usr/local/cloudflare_update_dns/cloudflare/bin/python /usr/local/cloudflare_update_dns/cloudflare-ddns.py

六、挂在硬盘

1. 临时挂载

apt install ntfs-3g samba samba-common-bin
mkdir /mnt/ntfs
mount -t ntfs-3g /dev/sda1 /mnt/ntfs

2. 获取磁盘信息

blkid
vim /etc/fstab
UUID=50CE4302CE42E038 /mnt/ntfs ntfs-3g defaults,nofail 0 0

3. 设置权限,重启服务

chmod -R 777 /mnt
systemctl restart samba

七、安装apparmor

apt install apparmor apparmor-utils
vim /boot/firmware/cmdline.txt

末尾添加

apparmor=1 security=apparmor systemd.unified_cgroup_hierarchy=false

八、安装JAVA

cd /usr/local/
wget https://download.oracle.com/java/17/archive/jdk-17.0.12_linux-aarch64_bin.tar.gz
tar -zxvf jdk-17.0.12_linux-aarch64_bin.tar.gz
vim /etc/profile
export JAVA_HOME=/usr/local/jdk-17.0.12
export PATH=$JAVA_HOME/bin:$PATH
source /etc/profile
java -version

九、安装ngixn

apt-get install nginx
vim /etc/nginx/nginx.conf

十、安装redis

1. 安装

apt-get install redis-server

2. 修改密码

vim /etc/redis/redis.conf
注释bind 127.0.0.1 -::1
requirepass passwd123

3. 重启服务

systemctl restart redis
systemctl enable redis

十一、安装postgresql

1. 安装

apt install postgresql postgresql-client

2. 修改密码

sudo -u postgres psql
ALTER USER postgres PASSWORD 'passwd123';
\q

3. 更改postgresql.conf权限

vim /etc/postgresql/15/main/postgresql.conf
listen_addresses = '*'

4. 更改pg_hba.conf权限

vim /etc/postgresql/15/main/pg_hba.conf
host    all             all             0.0.0.0/0               md5

5. 重启服务

systemctl restart postgresql
apt-get remove --purge postgresql-15
apt-get autoremove
apt-get update
apt-get install postgresql-15

十二、安装home-assistant

1. 停用ModemManager

systemctl stop ModemManager
systemctl disable ModemManager

2. 安装依赖

apt install apparmor bluez cifs-utils curl dbus jq libglib2.0-bin lsb-release network-manager nfs-common systemd-journal-remote systemd-resolved udisks2 wget -y

3. 安装docker

curl -fsSL https://get.docker.com | sh

4. 修改docker源

vim /etc/docker/daemon.json
{
    "log-driver": "journald",
    "storage-driver": "overlay2",
    "ip6tables": true,
    "experimental": true,
    "log-opts": {
        "tag": "{{.Name}}"
    },
    "registry-mirrors": [
        "https://docker.1panel.live",
        "https://hub.rat.dev/",
        "https://docker.chenby.cn",
        "https://docker.m.daocloud.io"
    ]
}

5. 安装代理(必须重启)

wget https://github.com/home-assistant/os-agent/releases/download/1.6.0/os-agent_1.6.0_linux_aarch64.deb
dpkg -i os-agent_1.6.0_linux_aarch64.deb

6. 安装homeassistant-supervised

wget -O homeassistant-supervised.deb https://github.com/home-assistant/supervised-installer/releases/latest/download/homeassistant-supervised.deb
apt install ./homeassistant-supervised.deb

7. 安装HACS

wget -O - https://hacs.vip/get | bash -

8. home assistant 网关配置

nmcli -p connection show
nmcli con mod "Supervisor eth0" ipv4.addresses 192.168.1.100/24 ipv4.method manual
nmcli con mod "Supervisor eth0" ipv4.gateway 192.168.1.1
nmcli con mod "Supervisor eth0" ipv4.dns "223.5.5.5,114.114.114.114,8.8.8.8"
nmcli con up "Supervisor eth0"

十三、安装immich

1. 安装postgresql插件

pgvecto.rs插件,用于向量搜索,支持 AI 驱动的照片搜索功能

2. 安装依赖

apt-get install libjemalloc-dev

3. 修改配置

vim /boot/firmware/config.txt

kernel=kernel8.img

4. 下载依赖

wget https://github.com/tensorchord/pgvecto.rs/releases/download/v0.3.0/vectors-pg15_aarch64-unknown-linux-gnu_0.3.0.zip

5. 解压安装

unzip vectors-pg15_aarch64-unknown-linux-gnu_0.3.0.zip -d vectors

cp vectors/vectors.so $(pg_config --pkglibdir)/
cp vectors/vectors--* $(pg_config --sharedir)/extension/
cp vectors/vectors.control $(pg_config --sharedir)/extension/

6. 编辑配置文件

vim /etc/postgresql/15/main/postgresql.conf
shared_preload_libraries = 'vectors.so'
search_path = '"$user", public, vectors'

7. 重启服务

systemctl restart postgresql

8. 验证

DROP EXTENSION IF EXISTS vectors;
CREATE EXTENSION vectors;

pg_trgm 插件,用于模糊文本搜索

apt install postgresql-contrib

9. 验证,进入immich库

CREATE EXTENSION IF NOT EXISTS vectors;
CREATE EXTENSION IF NOT EXISTS pg_trgm;

2、安装immich

cd /usr/local
mkdir immich-app
cd immich-app

1. 获取 docker-compose.yml 文件

wget -O docker-compose.yml https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml

2. 获取 .env 文件

wget -O .env https://github.com/immich-app/immich/releases/latest/download/example.env

3. (可选)获取 hwaccel.transcoding.yml 文件

wget -O hwaccel.transcoding.yml https://github.com/immich-app/immich/releases/latest/download/hwaccel.transcoding.yml

4. (可选)获取 hwaccel.ml.yml 文件

wget -O hwaccel.ml.yml https://github.com/immich-app/immich/releases/latest/download/hwaccel.ml.yml

5. 启动

docker compose up -d

6. 更新

docker compose pull && docker compose up -d

十四、安装dify

cd /usr/local/
git clone https://github.com/langgenius/dify.git
cd dify/docker
cp .env.example .env

启动

docker compose up -d

十五、安装npm

# 下载并安装nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh | bash

# 代替重新启动外壳
\. "$HOME/.nvm/nvm.sh"

# 下载并安装Node.js
nvm install 22

# 对Node.js版本进行验证
node -v # 应该打印 "v22.14.0".
nvm current # 应该打印 "v22.14.0".

# 验证npm版本
npm -v # 应该打印 "10.9.2".

相关推荐

电脑品牌型号在哪里看(电脑选什么牌子的好)

查看自己电脑品牌型号和具体配置的具体方法:1.右键点击桌面上的“这台电脑”图标,弹出的菜单中选择“属性”。2.在此界面即可看到你的电脑的CPU品牌(AMD)、型号(A6-5200)、频率(2.0GHz...

网卡驱动装不上怎么回事(网卡驱动装不了怎么办)

可能原因如下1、这种情况是因为系统中没有集成电脑网卡所对应的驱动程序。2、这种情况可以利用鲁大师查询网卡的具体型号,然后去官网或者网络上下载对应的驱动重新安装就可以正常上网了。可能原因如下:1,估计是...

手机输入法怎么打繁体字(手机怎样输入繁体)

步骤如下:1.在手机设置页面找到输入法设置,如果能搜索,会帮助找到输入法设置页面。2.在系统的输入法设置页面,找到输入法自身的设置页面入口。3.在输入法自设难度设置页面,找到简繁切换的设置页面。4.勾...

photoshop 下载(photoshop下载需要花钱吗)

怎样下载photoshop的步骤方法如下面所示:1.首先第一步的步骤是在我们的电脑桌面上找到电脑管家并紧接着点击它(如果没有电脑管家需要提前安装)。2.然后一步的方法是点击屏幕右下方的工具箱。3.最后...

联想官方网站驱动下载官网(联想官方网站驱动下载官网安装)

拯救者官网下驱动的方法:打开联想服务官网(support.lenovo.com.cn),页面滚动下拉找到“帮助与支持”板块,点击“驱动和软件下载”。下载联想拯救者的驱动很简单。简单联想官网提供详细的驱...

win7一键重装(win7一键重装系统纯净版不需要激活哪个好)

1.制作一个u盘pe2.下载win7系统镜像到u盘里面3.u盘插入电脑4.启动电脑按F12或DE5.选择usb进入pe6.打开一键安装7.选择系统8.等待安装,都是自动安装无需手动9.安装系统完成后就...

硬盘低格工具软件(硬盘低格软件推荐)

万能低格工具llftool好万能低格工具llftool是一款强大易用的硬盘低级格式化软件,支持硬盘、移动硬盘、内存卡、u盘等等存储设备的低格功能,过程快速方便,性能安全稳定。另外,...

笔记本电脑过热保护自动关机
笔记本电脑过热保护自动关机

笔记本电脑发热可能是因为散热不行导致cpu过热自动关机保护,可以这样处理:1)清洁笔记本侧面和底部的散热孔,保证可以充分散热;2)外接风扇进行辅助散热,如问题依然存在,按照步骤3处理;3)拆卸后盖,清洁风扇叶片上的灰尘,同时,更换导热片下方...

2026-01-12 01:55 liuian

英特尔cpu查询(英特尔cpu查询保修)

英特尔官网序列号的查询,1可以通过BIOS设置或者CPU-Z等软件查询英特尔序列号。2英特尔序列号是由英特尔公司推出的一种唯一标识符,用于区分不同的处理器芯片。3除了查询英特尔序列号,CPU-Z...

电脑可以还原系统吗(电脑可以还原到出厂设置吗)

方法/步骤分步阅读1/11Windows7系统打开或者关闭系统还原点的方法Windows7系统关闭系统还原右键桌面计算机图标-属性;2/11在打开的系统窗口,我们点击左侧的高级系统设置;3/11在...

visio软件密钥(microsoft visio密钥)

在控制面板\所有控制面板项\程序和功能中找到,右键----更改

1920x1080和2k差别大么(4k为啥没1080p清晰)

区别:图像清晰度不同。2K的清晰度高于1920×1080。电视或显示屏领域上,1080P,一般对应1920*1080分辨率,2K则对应2560*1440分辨率。两者的主要区别在于像素点的多少,在尺寸相...

路由器恢复出厂设置会怎么样

现在的很多路由器都很智能化,我们在日常使用的时候,很多时候出现卡死或者忘记了路由器的登录密码等问题,这个时候我们就需要对路由器进行重置或者是恢复出厂设置,这样就可以用初始化的用户名和密码登录路由器了...

电脑密码忘了如何取消开机密码

1/5第一种方法:在开机时,按下F8进入带命令提示符的安全"模式输入"netuser+用户名+123456/add"可把自己的密码设置为"123456",这样进入控制面板就可以清除自己用户密码了。...

安卓手机exe文件怎么打开(安卓手机用什么打开exe文件)

在Android操作系统中,通常情况下是无法直接运行.exe文件的,因为Android手机和Windows操作系统在底层架构上存在较大差异。不过,有一些方法可以让Android手机...