OMV项目官方目前仅提供x86架构的镜像,无法直接在基于arm64的树莓派上安装。因此我们需要先安装精简的linux(本文使用32位Raspberry Pi OS Lite),再在该系统上安装OMV。
准备工作
- 树莓派。笔者这里采用树莓派4B,4G版本。
- 一张内存卡。最好不低于32G,级别不低于A1、速率不低于U1或C10。
- 读卡器。
- 一台联网的电脑。笔者为win11。
- USB键盘。
- 联网的WiFi。非必须,可通过网线联网,但本文不做展开和说明。
- 显示器以及micro-HDMI转HDMI线。非必须,有其他方案可以进行树莓派初次装机时的连接和配置。
一、烧录树莓派OS
如果树莓派已经烧录过系统请跳过。
1、下载安装树莓派镜像烧录器
Windows版本烧录器:
downloads.raspberrypi.org/imager/imag…
其他系统可在官网下载对应版本的烧录器:
下载完成后安装即可。
2、烧录树莓派镜像
-
将内存卡通过读卡器连接到电脑
-
打开烧录器,依次选择树莓派设备版本、操作系统版本(这里选择了Raspberry Pi OS Lite 32-BIT)、并选定内存卡。
-
点击NEXT,在“Would you like to apply OS customization settings?”对话框中选择“编辑设置”。
-
在出现的弹窗中,GENERAL下设置好用户名和密码(这里最好避免使用root作为用户名)、WiFi名和密码(地区改为CN),SERVICES下勾选“开启SSH服务”,选择“使用密码登录”。检查无误后点击保存。
-
回到“Would you like to apply OS customization settings?”对话框,点击“是"。
-
接下来的”数据删除警告“点击“是”,烧录器便开始烧录镜像。
-
烧录完成后,用电脑在其根目录(boot)下新建一个文本文件,改名为“ssh”(没有后缀)。
虽然烧录阶段已经勾选ssh,但笔者仍遇到了第一次启动后ssh未开启的情况,因此保险起见特加此步骤。
- 将内存卡插入树莓派,接通电源,即可启动。
二、使用ssh与树莓派建立连接
1、获取树莓派内网ip以远程连接
可通过WiFi后台查看,或使用命令查看。
前者需要进入WiFi后台,在已连接设备中找到名为raspberrypi的设备,记下其对应ip
后者需要将树莓派连接至显示器,运行ifconfig,在wlan0下inet后对应192.168.x.x即为设备ip
如果WiFi后台没有新增raspberrypi设备,或运行ifconfig发现没有ip,说明设备没有成功连接WiFi,请重新烧录,烧录完成后先使用电脑在其根目录(boot)下新建一个文本文件,改名为“wpa_supplicant.conf”。使用文本方式打开该文件,按照以下格式填入内容(注意替换)并保存。
然后再插入树莓派通电启动即可
country=CN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="你的无线网络名称(ssid)"
psk="你的无线密码"
key_mgmt=WPA-PSK
priority=1
}
2、固定树莓派ip
可通过WiFi后台为树莓派设置固定ip,也可在树莓派中进行相关设置。
对于前者,进入WiFi后台后找到DHCP静态IP分配,为名为raspberrypi的设备绑定为当前IP即可。
对于后者请自行查找方案,这里暂不展开。
至此,后续对于树莓派的操作,使用ssh远程登陆即可进行。
3、使用ssh工具连接树莓派
使用任意SSH连接树莓派即可,笔者使用的Xshell下载链接为www.xshell.com/zh/free-for…
对于root用户无法ssh密码登录的问题:
使用其他账户登录,打开配置文件
nano /etc/ssh/sshd_config
找到
#PermitRootLogin prohibit-password改为PermitRootLogin yes(注意删除前面的#)按
Ctrl+X,然后按Y,回车,即可保存然后重启sshd服务即可:
systemctl restart sshd
三、换源和更新
1、编辑sources.list:
使用如下命令编辑sources.list
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
nano /etc/apt/sources.list
对于Debian 12 (bookworm)的树莓派系统,将sources.list中的内容删除,更换为如下内容:
(其他版本系统自行到mirrors.tuna.tsinghua.edu.cn/help/raspbi… 获取对应软件源列表。)
# 默认注释了源码镜像以提高 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
编辑完成后按Ctrl+X,然后按Y,回车,即可保存。
2、更新软件包
sudo apt-get update --allow-unauthenticated
sudo apt upgrade -y
遇见 press q to quit 按 q
笔者sudo apt upgrade -y过程中遇到ssh连接断开,把树莓派接入显示器操作发现极其卡顿。等待半小时无果,遂断电重启后重新sudo apt upgrade -y
sudo cp /etc/systemd/network/99-default.link /etc/systemd/network/99-default.link.bak
sudo rm -f /etc/systemd/network/99-default.link
sudo reboot
四、使用脚本安装OMV
首先检查你的树莓派是否能够访问github :
ping github.com
然后如下方案选择其一:
-
如果树莓派可以访问github,直接执行如下命令即可:
wget https://github.com/OpenMediaVault-Plugin-Developers/installScript/raw/master/install
chmod +x install
sudo ./install -n
-
如果树莓派无法访问GitHub,那么你需要能够在你电脑上访问github,在此基础上进行如下操作:
1、打开如下脚本链接,复制页面全部内容 github.com/OpenMediaVa…
2、新建一个文本文件命名为 install(最好是不保留后缀,用vscode编辑),将复制的内容粘贴进去
3、查找如下内容(在第400行左右),将其注释或者删除,然后保存:
if [ -f "${file}" ]; then
rm ${file}
fi
wget ${url}/${file}
如果是以.txt编辑,保存后请删除.txt后缀
4、根据你的树莓派os的版本(VERSION_ID)下载对应.deb文件:
- 查看VERSION_ID:
cat /etc/os-release
- VERSION_ID="12",下载这个:github.com/OpenMediaVa…
- VERSION_ID="11",下载这个:github.com/OpenMediaVa…
5、将通过上述步骤获得的两个文件:install和openmediavault-omvextrasorg_latest_all7(或6).deb,上传至树莓派root目录下(可通过Xftp等工具上传)。
6、执行如下命令安装:
cd /root
chmod +x install
sudo ./install -n
五、配置OMV
电脑浏览器打开树莓派ip地址,即可进入OMV管理页面。
默认用户名为
admin
默认密码为
openmediavault
关于OMV的具体配置暂不做展开,请自行查阅互联网。
参考内容: