树莓派基础安装(树莓派3b+安装)
liuian 2025-05-03 15:15 29 浏览
一、设置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".
相关推荐
- Optional是个好东西,如果用错了就太可惜了
-
原文出处:https://xie.infoq.cn/article/e3d1f0f4f095397c44812a5be我们都知道,在Java8新增了一个类-Optional,主要是用来解决程...
- IDEA建议:不要在字段上使用@Autowire了!
-
在使用IDEA写Spring相关的项目的时候,在字段上使用@Autowired注解时,总是会有一个波浪线提示:Fieldinjectionisnotrecommended.纳尼?我天天用,咋...
- Spring源码|Spring实例Bean的方法
-
Spring实例Bean的方法,在AbstractAutowireCapableBeanFactory中的protectedBeanWrappercreateBeanInstance(String...
- Spring技巧:深入研究Java 14和SpringBoot
-
在本期文章中,我们将介绍Java14中的新特性及其在构建基于SpringBoot的应用程序中的应用。开始,我们需要使用Java的最新版本,也是最棒的版本,Java14,它现在还没有发布。预计将于2...
- Java开发200+个学习知识路线-史上最全(框架篇)
-
1.Spring框架深入SpringIOC容器:BeanFactory与ApplicationContextBean生命周期:实例化、属性填充、初始化、销毁依赖注入方式:构造器注入、Setter注...
- 年末将至,Java 开发者必须了解的 15 个Java 顶级开源项目
-
专注于Java领域优质技术,欢迎关注作者:SnailClimbStar的数量统计于2019-12-29。1.JavaGuideGuide哥大三开始维护的,目前算是纯Java类型项目中Sta...
- 字节跨平台框架 Lynx 开源:一个 Web 开发者的原生体验
-
最近各大厂都在开源自己的跨平台框架,前脚腾讯刚宣布计划四月开源基于Kotlin的跨平台框架「Kuikly」,后脚字节跳动旧开源了他们的跨平台框架「Lynx」,如果说Kuikly是一个面向...
- 我要狠狠的反驳“公司禁止使用Lombok”的观点
-
经常在其它各个地方在说公司禁止使用Lombok,我一直不明白为什么不让用,今天看到一篇文章列举了一下“缺点”,这里我只想狠狠地反驳,看到列举的理由我竟无言以对。原文如下:下面,结合我自己使用Lomb...
- SpringBoot Lombok使用详解:从入门到精通(注解最全)
-
一、Lombok概述与基础使用1.1Lombok是什么Lombok是一个Java库,它通过注解的方式自动生成Java代码(如getter、setter、toString等),从而减少样板代码的编写,...
- Java 8之后的那些新特性(六):记录类 Record Class
-
Java是一门面向对象的语言,而对于面向对象的语言中,一个众所周知的概念就是,对象是包含属性与行为的。比如HR系统中都会有雇员的概念,那雇员会有姓名,ID身份,性别等,这些我们称之为属性;而雇员同时肯...
- 为什么大厂要求安卓开发者掌握Kotlin和Jetpack?优雅草卓伊凡
-
为什么大厂要求安卓开发者掌握Kotlin和Jetpack?深度解析现代Android开发生态优雅草卓伊凡一、Kotlin:Android开发的现代语言选择1.1Kotlin是什么?Kotlin是由...
- Kotlin这5招太绝了!码农秒变优雅艺术家!
-
Kotlin因其简洁性、空安全性和与Java的无缝互操作性而备受喜爱。虽然许多开发者熟悉协程、扩展函数和数据类等特性,但还有一些鲜为人知的特性可以让你的代码从仅仅能用变得真正优雅且异常简洁。让我们来看...
- 自行部署一款免费高颜值的IT资产管理系统-咖啡壶chemex
-
在运维时,ICT资产太多怎么办,还是用excel表格来管理?效率太低,也不好多人使用。在几个IT资产管理系统中选择比较中,最终在Snipe-IT和chemex间选择了chemex咖啡壶。Snip...
- PHP对接百度语音识别技术(php对接百度语音识别技术实验报告)
-
引言在目前的各种应用场景中,语音识别技术已经越来越常用,并且其应用场景正在不断扩大。百度提供的语音识别服务允许用户通过简单的接口调用,将语音内容转换为文本。本文将通过PHP语言集成百度的语音识别服务,...
- 知识付费系统功能全解析(知识付费项目怎么样)
-
开发知识付费系统需包含核心功能模块,确保内容变现、用户体验及运营管理需求。以下是完整功能架构:一、用户端功能注册登录:手机号/邮箱注册,第三方登录(微信、QQ)内容浏览:分类展示课程、文章、音频等付费...
- 一周热门
-
-
Python实现人事自动打卡,再也不会被批评
-
【验证码逆向专栏】vaptcha 手势验证码逆向分析
-
Psutil + Flask + Pyecharts + Bootstrap 开发动态可视化系统监控
-
一个解决支持HTML/CSS/JS网页转PDF(高质量)的终极解决方案
-
再见Swagger UI 国人开源了一款超好用的 API 文档生成框架,真香
-
网页转成pdf文件的经验分享 网页转成pdf文件的经验分享怎么弄
-
C++ std::vector 简介
-
系统C盘清理:微信PC端文件清理,扩大C盘可用空间步骤
-
10款高性能NAS丨双十一必看,轻松搞定虚拟机、Docker、软路由
-
python使用fitz模块提取pdf中的图片
-
- 最近发表
- 标签列表
-
- python判断字典是否为空 (50)
- crontab每周一执行 (48)
- aes和des区别 (43)
- bash脚本和shell脚本的区别 (35)
- canvas库 (33)
- dataframe筛选满足条件的行 (35)
- gitlab日志 (33)
- lua xpcall (36)
- blob转json (33)
- python判断是否在列表中 (34)
- python html转pdf (36)
- 安装指定版本npm (37)
- idea搜索jar包内容 (33)
- css鼠标悬停出现隐藏的文字 (34)
- linux nacos启动命令 (33)
- gitlab 日志 (36)
- adb pull (37)
- table.render (33)
- python判断元素在不在列表里 (34)
- python 字典删除元素 (34)
- vscode切换git分支 (35)
- python bytes转16进制 (35)
- grep前后几行 (34)
- hashmap转list (35)
- c++ 字符串查找 (35)