树莓派4B搭建NAS
1.安装树莓派官方提供的精简版系统不要桌面版系统
官网https://www.raspberrypi.com/
2.完成配置及安装后连接网线
3.电脑通过ssh连接连接树莓派
下面命令开启ssh
sudo systemctl enable ssh sudo systemctl start ssh sudo systemctl status ssh 检查 SSH 服务状态
4.固定ip(选配)
5.换源(清华源)
访问以下网址
https://mirrors.tuna.tsinghua.edu.cn/help/raspbian/
复制以下到/etc/apt/sources.list
文件并将原有的源屏蔽
deb https://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ bookworm main non-free contrib rpi
deb-src https://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ bookworm main non-free contrib rpi
deb [arch=arm64] https://mirrors.tuna.tsinghua.edu.cn/raspbian/multiarch/ bookworm main
-----------------------分隔线------------------------------------
如果你安装的是aarch64请复制下面的不要复制上面的
# 默认注释了源码镜像以提高 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
复制以下到 /etc/apt/sources.list.d/raspi.list
文件并将原有的屏蔽
deb https://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ bookworm main
6.更新
sudo apt-get update
sudo apt-get upgrade
sudo rm -f /etc/systemd/network/99-default.link
sudo reboot(重启)
没有公钥使用下列命令导入密钥
导入 GPG 密钥: gpg --keyserver keyserver.ubuntu.com --recv-keys E77FC0EC34276B4B(替换为报错缺少的密钥) 将密钥添加到 APT 的密钥环中: gpg --export --armor E77FC0EC34276B4B | sudo apt-key add -
7.下载安装脚本
下面任选一个,哪个能用用哪个
wget https://cdn.jsdelivr.net/gh/OpenMediaVault-Plugin-Developers/installScript@master/install
wget https://gcore.jsdelivr.net/gh/OpenMediaVault-Plugin-Developers/installScript@master/install
下载完成后用
ls
可查看到文件
8.给予权限并运行
chmod +x install
sudo ./install -n
9.安装完成后访问树莓派IP地址
默认用户名密码
用户名:admin
密码:openmediavault
接下来是电脑及web操作
10.擦除挂载硬盘
进入系统后点击存储器----磁盘,选择对应磁盘擦除
11.创建文件系统并挂载
擦除后,选择文件系统,点击创建,选择对应设备,类型EXT4,创建完后,点击加号挂载
12.创建共享文件夹
点击共享文件夹,点击创建,并完成配置
13.在文件夹-网络中就能看到共享文件夹