树莓派NAS——OMV安装篇(一)

20170902 初成文
20180607 更新omv4.x(debian 9 stretch),见文末
建议直接使用OMV树莓派官方版镜像,Win32DiskImager写进SD卡,本文是介绍基于Debian8上安装OMV
跑nas之前做过大量压力测试,usb外接硬盘(ext4或btrfs;用ntfs是很难满速的,调用ntfs-3g还得占用cpu)读写百兆网卡可以达到满速,可以跑docker,bt/pt常用下载工具正常使用。蓝光原盘码率大都在50Mbps以下,百兆带宽已经绰绰有余,实测局域网可以同时流畅播放两个原盘,也还算满意。
树莓派NAS——OMV安装篇(一)
文章图片
安装大部分应用后,可跑docker

目前稳定版OpenMediaVault 3.X.X(erasmus)是基于Debian8的,所以只能安装在基于Debian8的Jessie上,比如DietPi(Jessie)、Raspbian(2017-7-5及以前版本)。
一、Jessie更换软件源为国内更快速的软件源

sudo nano /etc/apt/sources.list
【树莓派NAS——OMV安装篇(一)】deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ jessie main non-free contrib rpi
sudo nano /etc/apt/sources.list.d/raspi.list
deb https://mirrors.ustc.edu.cn/archive.raspberrypi.org/ jessie main ui
sudo apt update
二、添加OMV的软件源
这步需要在root权限下,因为sudo只是让 echo 命令具有了 root 权限,
但是没有让 “>” 命令也具有root 权限。
sudo su
echo "deb http://packages.openmediavault.org/public erasmus main" > /etc/apt/sources.list.d/openmediavault.list
exit
更新:目前已发布测试版OMV4.X,基于Debian9(可在Raspbian Stretch上安装),此步将erasmus改为arrakis,其余不变,即:
sudo su
echo "deb http://packages.openmediavault.org/public arrakis main" > /etc/apt/sources.list.d/openmediavault.lis
三、设置环境变量并更新软件包索引
export LANG=C
export DEBIAN_FRONTEND=noninteractive
export APT_LISTCHANGES_FRONTEND=none
四、开始安装:
sudo apt install dirmngr
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 7E7A6C592EF35D13 24863F0C716B980B
sudo apt update
sudo apt --allow-unauthenticated install openmediavault-keyring
sudo apt --yes --force-yes --auto-remove --show-upgraded --no-install-recommends --option Dpkg::Options::="--force-confdef" --option DPkg::Options::="--force-confold" install postfix openmediavault
注意点:
1、出现 Postfix Configuration选择的时候,选择No configuration
2、出现Configuring mdadm的时候,键入none.
3、Do you want to start MD arrays automatically?选择 YES
4、When the 'ProFTPD configuration' dialogue is displayed choose 选择 standalone
五、安装完成后初始化系统和数据库,重启前注意配置好ssh
sudo apt install resolvconf
sudo omv-initsystem//初始化
sudo nano /etc/ssh/sshd_config//AllowGroups添加ssh远程用户
sudo /etc/init.d/ssh restart
sudo reboot now
六、OMV3.X安装OMV 3.X最新版插件包
wget http://omv-extras.org/openmediavault-omvextrasorg_latest_all3.deb
sudo dpkg -i openmediavault-omvextrasorg_latest_all3.deb
直接在浏览器输入树莓派ip地址,初始账户为admin密码为openmediavault
七、其他
更新OMV版本为最新:
sudo omv-update
OMV修复工具(IP配置重设、WEBGUI端口重置、密码修改、重置登录失败次数锁定、配置备份恢复、更新apt缓存):
sudo omv-firstaid


树莓派NAS——OMV安装篇(一)
文章图片
omv-firstaid

在Debian9(Stretch)上安装OMV4.X,
在用户目录下,执行sudo nano omv4setup.sh , 复制粘贴下列信息后,Ctrl-X 退出并保存
#!/bin/sh
cat <> /etc/apt/sources.list.d/openmediavault.list
deb http://packages.openmediavault.org/public arrakis main
# deb http://downloads.sourceforge.net/project/openmediavault/packages arrakis main
## Uncomment the following line to add software from the proposed repository.
# deb http://packages.openmediavault.org/public arrakis-proposed main
# deb http://downloads.sourceforge.net/project/openmediavault/packages arrakis-proposed main
## This software is not part of OpenMediaVault, but is offered by third-party
## developers as a service to OpenMediaVault users.
# deb http://packages.openmediavault.org/public arrakis partner
# deb http://downloads.sourceforge.net/project/openmediavault/packages arrakis partner
EOF
export LANG=C
export DEBIAN_FRONTEND=noninteractive
export APT_LISTCHANGES_FRONTEND=none
apt-get update
apt-get --allow-unauthenticated install openmediavault-keyring
apt-get update
apt-get --yes --auto-remove --show-upgraded \
--allow-downgrades --allow-change-held-packages \
--no-install-recommends \
--option Dpkg::Options::="--force-confdef" \
--option DPkg::Options::="--force-confold" \
install postfix openmediavault
# Initialize the system and database.
omv-initsystem
sudo apt install resolvconf
wget http://omv-extras.org/openmediavault-omvextrasorg_latest_all4.deb
dpkg -i openmediavault-omvextrasorg_latest_all4.deb
apt update
终端继续执行:
chmod +x omv4setup.sh
sudo bash omv4setup.sh
可能会出现错误提示:
Exception ignored in:.remove at 0x76125420>Traceback (most recent call last): File "/usr/lib/python3.5/weakref.py", line 117, in removeTypeError: 'NoneType' object is not callableException ignored in:.remove at 0x76125420>
Traceback (most recent call last):
File "/usr/lib/python3.5/weakref.py", line 117, in remove
TypeError: 'NoneType' object is not callable
解决办法:
sudo nano /usr/lib/python3.5/weakref.py
def remove(wr, selfref=ref(self)):
修改为
def remove(wr, selfref=ref(self), _atomic_removal=_remove_dead_weakref):
_remove_dead_weakref(d, wr.key)
修改为
_atomic_removal(d, wr.key)

    推荐阅读