OpenMediaVault NAS Setup with Docker Applications

Networking
Author

Vinh Nguyen

Published

November 24, 2020

My 10 year old NAS finally died after 10 years. It ran Ubuntu, with a bunch of apps and services installed via the OS's package manager, and some installed and compiled from source. I used the LTS version of Ubuntu for longer term support, and I actually did full OS upgrades once or twice. However, I think I stopped since version 16 or so. I remember after doing full upgrades, certain apps or setup would break (packages removed, dependencies removed or are no longer compatible, etc.).

For my new NAS, I thought about buying a fully built NAS from Synology based on this article from Linux Journal. Although having a pre-built product seems very tempting, I just couldn't justify the added premium, knowing that I was technical enough to install a Linux OS, that there are distro's like OpenMediaVault (OMV) that is highly stable and user-friendly, and that Docker is also used to install apps in Synology's products.

For my new NAS, I bought a 4-bay server from U-NAS because I wanted a small footprint, low power consumption, and the ability to add and remove drives easily. The U-NAS chassis is similar to my old Acer NAS. I went with OpenMediaVault because it was designed to be user-friendly and because I don't need ZFS (used for FreeNAS).

I wanted to document my setup in case I needed to re-do this in the future for other servers. I followed this guide and this guide to install and setup my server. Here are some things that I want to document.

First, after I installed the OS, I received the following error message when the server booted up: mdadm: no arrays found in config file or automatically. Apparently, this happens when because I installed the OS on an SSD and then I added additional HDD's. This post suggess a fix: with only the SSD, boot up the server, plug in the HDD, log in as root, execute update-grub, and restart the server.

  1. After the OS is installed, visit the server's IP address to reach the OMV's web console. Change the default password.
  2. Since it is a NAS, I installed multiple hard drives for data storage on top of the OS drive. Assuming the drives have been formatted as something like an ext4 format, the drives should be mounted by default in /srv/.
  3. Create shared folders under Access Rights Management > Shared Folders. I created one called home, and one called share. The former is used to store the home directories of the users (I prefer to have this enabled for users with ssh access). The latter is used to store my media files to be shared across the network.
  4. Create users under Access Rights Management > User
    • At least one user belonging to the following groups (my admin account via ssh): users, ssh, sudo, and root.
    • At least one generic user used to access files from the TV or other media devices (eg, mediauser), belonging to the following group: users.
  5. Turn on SSH and SMB/CIFS services under Services.
  6. I was able to install omv-extras by running the following in the terminal: wget -O - https://github.com/OpenMediaVault-Plugin-Developers/installScript/raw/master/install | sudo bash
  7. In the web console, I can now install Docker and Portainer under System > OMV-Extras > Docker.
  8. One can log onto Portainer's web console with server_ip:9000. Set up the admin password.
  9. Here is an example of how to install a Docker app using Portainer, with Heimdall as the example. Since we'll be installing various apps and services as in self-contained Docker containers, we'll have to manage many of them via their own web consoles (different ports); Heimdall bookmarks all the URL's so we have a landing page that itemizes all the apps for easier navigation. I will show how to enter the critical information from the Docker Hub page. Compare the values from that page and what's entered here.
    • In Portainer, go to the Container page. Click Add container.
    • Name: heimdall
    • Registry: leave as DockerHub
    • Image: paste in linuxserver/heimdall
    • Manual network port publishing: add 2 ports (ports description under the docker-compose schema)
      • 80 -> 8888 (80 goes to OMV by default)
      • 443 -> 8889
    • Under Advanced container settings > Volumes, map the following container -> volume paths (volumes description under the docker-compose schema)
      • /config -> /appdata/heimdall (NOTE: create /appdata on the OS hard drive, as the config folder for all Docker apps will be stored here using the layout /appdata/name_of_app).
    • Under Advanced container settings > Env, enter the following environment variables (environment description under the docker-compose schema)
      • PUID -> 1000 (for the primary user set up in step 4, type the following in the web console to get the user id: id -u username)
      • PGID -> 100 (for the primary user set up in step 4, type the following in the web console to get the user id: id -g username)
    • Under Advanced container settings > Restart policy, select Unless Stopped
    • Click Deploy the container to have the app started.
    • Visit server_ip:8888 to get to the Heimdall page
  10. Additional Docker apps could be installed in a similar fashion as the previous step. Note that some apps will also have a /data or /downloads folder, so map them accordingly. Some apps also require the following Docker option --cap-add=NET_ADMIN; this is set under Advanced container settings > Capabilities.

I think my new NAS should last me at least 10 years.