OpenMediaVault on Raspberry Pi 4 in 5 simple steps

Published by mr.pigeon on

OpenMediaVault_RaspberryPi

Introduction

OpenMediaVault is a network attached storage (NAS) solution based on Debian Linux. It contains services like SSH, (S)FTP, SMB/CIFS, DAAP media server, RSync, BitTorrent client and many more. Thanks to the modular design of the framework you can enhance the usability via plugins. OpenMediaVault is primarily designed to be used in small offices or home offices. It is a simple and easy to use out-of-the-box solution that will allow everyone to install and administrate a Network Attached Storage without deeper knowledge.

Step 1: Download Raspberry Pi OS

OpenMediaVault used to have pre-installed images, but it has been deprecated. We will first install our OS layer, and on top of it, we will install OpenMediaVault. As OpenMediaVault is built and design to work on operating systems that are Debian based, we will go and use the default Raspberry Pi OS (previously known as Raspbian). The Raspberry Pi OS is based on Debian/buster and is using the apt tool for package management. Let's go and grab a copy of the latest Raspberry Pi OS image.

wget --content-disposition https://downloads.raspberrypi.org/raspios_lite_armhf_latest

Step 2: Install Raspberry Pi OS to microSD

Before we install the image, we will need to unzip the downloaded file, and then install it on a micro SD card, (Such as sdX where X is the device letter of your micro SD card).

unzip 2020-05-27-raspios-buster.lite-armhf.zip
sudo dd if=2020-05-27-raspios-buster.lite-armhf.img of=/dev/sdX bs=1M status=progress

Step 3: Change OS Default Passwords

On the first time we boot our Raspberry Pi, it is advisable to change the default pi/raspberry credentials to improve our Pi's security. It can either be by updating the password for the default pi account, or by adding a new user with the name of your choice and adding this user account to the sudoer's group. You can have a terminal to your Raspberry Pi either by connecting to it via SSH or by attaching a serial to usb cable.

Example 1: Updating password for the default pi account

sudo passwd

Example 2: Creating a new account and adding this account to sudoer's group

sudo adduser banana
sudo adduser banana sudo

Step 4: Install OpenMediaVault

Installing OpenMediaVault on top of our operating system is a matter of running a one line installing script which may take some time to complete due to the fact that OpenMediaVault has a lot of dependencies related to their NAS solution.

Before we run the installer script, lets update our system repository and make sure we have the latest packages installed on our system

sudo apt update && sudo apt upgrade -y

OpenMediaVault installer script via wget

wget -O - https://github.com/OpenMediaVault-Plugin-Developers/installScript/raw/master/install | sudo bash

OpenMediaVault installer script via curl

curl -sSL https://github.com/OpenMediaVault-Plugin-Developers/installScript/raw/master/install | sudo bash

Step 5: OpenMediaVault Configurations

Open a new tab in your web browser and enter the IP of your Raspberry Pi to enter the OpenMediaVault login page by typing http://RASPBERRY-PI-IP into the search bar. The default login credentials are admin/openmediavault, we will later on change that to something more secure.

Login_Screen
Figure 1: Login to OpenMediaVault

Step 5a: Web Administrator Password

In order to change the default administrator password, navigate to System, from there to General Settings and then click on the Web Administrator Password tab.

Password_Change
Figure 2: Change Default Admin Password

Step 5b: Auto log-out timer

This step is optional, use for your convenience. By default, being idle for more than 2 minutes would log you out automatically for security measures. This feature is good to have, but having it set to short amount of time can slightly stand in the way of the user, especially on a freshly installed setup when it takes time for the user to get familiar with the environment. In order to change the default time of the auto log-out option, go to System from there to General Settings. Select the Web Administration tab, and under the General Settings field, change the option for Auto logout to something like 1 day.

Web_Administrator_Auto_Logout
Figure 3: Web Administrator, Auto log-out

Step 5c: Setup CIFS/SMB Share

Now it is time to attach any storage device you have at your disposal to your Raspberry Pi. We will ssh to our Raspberry Pi to prepare the device before we configure it in the web interface.

# ssh pi@raspberry-pi
# assuming our device is /dev/sdc

sudo parted --script /dev/sdc \
mklabel msdos \
mkpart primary ntfs 1MiB 100% \
set 1 boot on

Format the device, use a label of your choice for your drive.

sudo mkfs.ntfs --quick /dev/sdc1 --label 500g-ntfs

Now connect to OpenMediaVault via browser and navigate to Storage -> File Systems. Locate your device you just formatted and mount it. OpenMediaVault will automatically add needed records to /etc/fstab for it to be mounted on the next boot.

Mount_Device
Figure 4: Mount Device

Now lets create a share by navigating to Access Rights Management -> Shared Folders. Click on the +Add button to create a new share. Name the new share, select the appropriate device, select the default path, set the desired permission set, and add a comment if needed. When done, click on save.

Create_Share
Figure 5: Create A Share

As for access for this share, select the new share and click on Privileges and give the needed access for that share. You can use the built-in local account called guest and give access for this account. When connecting to this share, the guest acount does not have a password for its credentials.

Privileges
Figure 6: Privileges

Example for cifs/smb /etc/fstab entry

/dev/disk/by-label/500g-ntfs    /srv/dev-disk-by-label-500g-ntfs    ntfs    defaults,nofail 0 2

Step 5d: Setup NFS Share

In case we want to setup an NFS share for our network, attach a storage device to your Raspberry Pi, and run the following to formart it to use linux partitions & file systems.

# ssh pi@raspberry-pi
# assuming our device is /dev/sdc

sudo parted --script /dev/sdc \
mklabel gpt \
mkpart primary ext4 1MiB 100% \
set 1 boot on

Format the device, use a label of your choice for your drive.

sudo mkfs.ext4 /dev/sdc1 -L 500g-nfs

Now that we have our drive formatted, we need to mount it (same as in figure 4), and create a new share in Access Rights Management -> Shared Folder (same as in figure 5).

Example for nfs /etc/fstab entry

/dev/disk/by-label/500g-nfs     /srv/dev-disk-by-label-500g-nfs ext4    defaults,nofail,user_xattr,usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0,acl 0 2

What's Next

Now that we have our own storage solution, we can share files between our devices over our network. Besides that, we can now setup Plex which is a client–server media player system plus an ancillary software suite. The Plex Media Server desktop application runs on Windows, macOS, and Linux.

Plex @ OpenMediaVault

Conclusion

In this tutorial we have successfully installed Raspberry Pi OS on a micro-SD card and on top of that we have installed OpenMediaVault NAS solution and configured basic SMB/CIFS and NFS shares.

Read More

OpenMediaVault
Raspberry Pi


0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *