Hey, are you looking to create your own media server? We set it up with Plex Media Server, Next Cloud, and anything you can imagine! Maybe you have many friends that would like to share there own files and enjoy them with you (like photos, videos, anything digital!). Well, you're in luck! I decided to finally give it a try and have successfully launched my own server that is also available to the public as well as local devices!
Disclaimer: This guide could easily become outdated, so I will list versions for what I used for this build and setup!
Note: I will update this guide over a few days of time because I don't want to spend a lot of time working on the guide, but the quality will be good.
I want to make this guide quick and short because time is valuable! I will link and give credits to many other people I have followed so that you can also get a sense of being resourceful and tactful.
I had three main reasons to start my own server for media streaming and file storage. One of those reasons was because I wanted to learn more about servers and networking. Although it is still not that advanced it is quite difficult to understand if you are just starting out. I will go over what I did in detail to hopefully help you set up your own media server as well.
So what will we do in this project tutorial?
1. We will build and assemble a computer dedicated to be a server (much efficient than buying a high-end NAS)
2. We will burn open media vault 5 (5.2.1) to a USB for installation
3. We will install open media vault 5 to the new computer, go over the installation of the OS first
4. We will set up the port forwarding from our ISP (internet service provider), we will do it manually because I had to.
5. We will then do a walkthrough on setting up open media vault with portainer and docker
6. We will then SSH into the server from another computer to get omv-extras and other things
7. We will then configure open media vault 5 to become a plex media server using portainer and docker
8. We will then go over adding video files, and files of all kinds to the server
9. We will then go over domain and security protection (optional)
What You Will Need:
Before you get started, you will need at least 1 USB stick that is about 8 GB for burning Open Media Vault to. Here is a list:
An 8 GB USB stick
3 Cat6 Ethernet Cables for speed (get a length depending on how far your server will be from your ISP router)
1 ISP modem/router, like Cox, AT&T or so, you need access to it later on via local IP (internet protocol) address
1 network switch, get a plug-in-and-play such as a D-Link 5-port Gigabit Switch (DGS-1005G) or you could get a better one, etc.
Additional SATA Cables for your hard drives
2 Storage Drives (consult the PC part picker below as well), preferably HDD for many disks writes and reads, you do not need server-grade, you can use normal HDD
This is the PC I built, it consumes a max of up to 200 Watts only, it can handle up to about 12 simulcasts of 720p streaming.
The build above will cost less than a high-end NAS, compare to this:
Looking at the above NAS, the NAS we are building will run with DDR4, so you can easily go up to 32 GB of RAM, which is enough for a personal server for a beginner.
Once you get all the computer parts, assemble them together. It should not take you more than an hour since the case is actually really nice and spacious for this build!
Once you finish assembling the computer, go to the BIOS and change the boot priority to use the USB with open media vault 5. During this process, only have 1 drive connected to the motherboard, because we want to be safe and avoid any discrepancies if you install it to the wrong drive.
My Quick-Guide Video:
I want to make a quick video but I'm cold and sleepy.
Quick Setup and Walkthrough:
Going through the installation of open media vault (I assume you have a keyboard, mouse, and screen set up with it as well, and internet connectivity via ethernet) it's very easy and you should not have any difficulties. Once you finish and get to the blue screen where you have to run the command:
omv-confdbadm populate (something like that)
Before you run that command, do: sudo apt update and sudo apt upgrade as the root user. You should have already set a root password during the beginning of the installation so DO NOT forget what it was; I hope you wrote it down or so.
Now after that easy installation, before we go any further we need to connect everything together first.
Attach any hard drives you need left, now close your computer case and plug any port from your ISP (internet service provider's) modem/router to your network switch that you have, then plug an ethernet switch from your network switch to your computer. So the wiring is
modem > network switch > computer... So you need two wires as mentioned above (cat6 is fast for 1Gps).
Now after that, you want to use another computer or any device that has browser abilities (that's on the same network, for now) to access that URL Open Media Vault tells you to visit AFTER you remove the installation USB and reboot the computer. Go to that URL and you should see a menu similar to that in the video.
Here is a great video by Techno Life, it's great and pretty self-explanatory:
Once you finish that, you are at the stretch line! Now, if you have another PC and or a Linux Machine, you can SSH into your machine via ethernet or LAN connection. Then you need to get omv-extras.
Once you get that, and you have configured mostly everything in open media vault 5, such as the time zone sync, mounted volumes, shared folders, and such, you are ready to start using a plugin or extra add-on plugin! Enable docker, but follow this reddit post! It is much easier this way, if you want to have docker use a larger drive (because I'm using an M.2 SSD for the OS speed) for storing docker things like images, overlay, etc.
For clarity I will get the important info or steps:
1-- First, in the OMV webUI, set the container directory back to /var/lib/docker and save the changes (docker should be running).
2-- Now, SSH your server and become root, and stop docker (systemctl stop docker)
3-- Now delete your old docker folders so we are starting completely new here... rm -R /var/lib/docker to remove the default docker directory. You should now be able to delete the folder you created in the webUI (including its content) and create a new one (I'll be calling mine "Containers").
4-- Now, start (systemctl start docker) and then stop docker again so it will build a new /var/lib/docker file directory structure.
5-- The step 5 should use "mv /var/lib/docker/* /srv/dev-something/Containers" to copy the directory structure, not the docker directory itself.
6-- Now we'll create symbolic link between our docker directory, and the directory we just created: ln -s /srv/dev-something/Containers /var/lib/docker
7-- systemctl start docker
8-- Now cd to your /srv/dev-something/Containers folder, and ls and you should see the docker file structure there. You can test the link is working by creating a simple file (touch test) and then cd /var/lib/docker and ls the director. You should see your test file. This shows you the link is working. You can then remove the test file (rm test)
You should be able to create/remove shared folders in the webUI now, while docker is running and your Containers will not be on your OS drive (very helpful if you have a small OS drive). Now you can use the omv webUI to install Portainer or Cockpit to have a GUI to manage docker containers. I don't personally use the OMV webUI for this (It's strictly an OCD thing regarding where my container configs are installed, naming, etc..). If you want some insight on that, feel free to ask.
Disclaimer: It seems like the new sharedfolder shouldn't be created on a unionfs volume. I was still getting the same error as before. Making a sharedfolder from a different device fixed it.
This is it for the basic setup and if you know Docker or related technologies you can go ham as I did :D
Everything is Containers:
If you do not know what docker is, I have a short article: Docker - Legacy Intro Guide or you can just go Google Docker Tutorial for Linux (Debian Buster if you want to be specific). Essentially docker works the same in most operating systems.
Before we move on to installing Portainer via the open media vault web UI; consult this guide for a static IP on your router (I have a static IP so I don't need to use dynIP or whatever).
However, if you do not have a static IP available here: https://dyn.com/dns/
The process for setting it up is not that difficult. You can also buy a domain name and add an A record and CNAME for your domain name to link to your personal home server. Another thing you want to do is read how a DNS (domain name servers) works and how PKI (Public Key Infrastructure) works. A coworker of mine gave me those to read, and aside from all the words, it's a simple concept to understand, just over-engineered for security and redundancy.
You do not have to read the entire article for PKI. Now that you have that, remember to be careful about exposing external ports on your ISP (internet service provider) router! I recommend only enabling port 80 (http) 443 (https), 21 (SSH, add key auths and disable password logins), and be cautious about enabling other ports. It would be safer if you are a beginner to use a proxy container in docker (which we will go over later, but it's intermediate to advanced)
Now that you have a basic understanding you can enable portainer and go visit the URL. Now you have two choices here, you can either spin up containers using the portainer web UI (user interface), or use docker-compose within your system (intermediate to advanced). I chose the latter because I have been using docker a lot all the time (Kubernetes is cool too if you have multiple servers).
If you decide to go with using docker-compose or swarm, continue below with same precautions.
Choices for reverse proxies? Now, what you want first, or the first container to set up is a reverse proxy: either choose Caddy, Traefikv2, or Nginx. If you do need to use the docker socket also follow this, so you have more security as well.
The above technique can apply to all reverse proxies that require the docker socket.
Basic Setup Through Portainer:
Once you have everything ready, you can follow these two videos from Techno Life, but I will quickly go over them first.
You will have to download the images first before you can create a container in portainer. Then you create a container and fill in all the missing pieces, usually you can go to the docker hub for that image and they have examples you can follow to quickly get started. Now, let's say you launched the Plex container but can't play a video, for each drive, you have to remove the noexec option for EACH drive in the file Techno Life edits in the second video. Then you have to apply those changes with the new command (not in the video). The new command is: omv-salt deploy run fstab
That's it! Now you have and local plex media server accessible to your LAN, you can also use it as a NAS (when you set up the workgroups in open media vault 5 web UI).
Advanced With Domain Names and More:
If you are competent with Docker, you can go much further than this setup and basically have subdomains on your domain using docker-compose and a reverse proxy. You can use Let's Encrypt for easy SSL and then you can try out other docker images and routing them to different ports without exposing your actual many ports. Now if you want to do voice chatting and more things or try setting up NextCloud (which is nice). You can explore more here:
Maybe once I'm solid on my home server I can share my files, but I need to make a master env. list with variables so you cannot use my keys and such, which I suggest you start off doing first (unlike I did). So you can have a script for exporting those environment variables to use throughout the system.
So like the above StackOverflow posts (without using docker container), you can make environment lists and a script that exports those variables and references in dockerfiles and docker-compose. Or, just put most of your things in env variables for referencing.
For more security and DDos (denial of service attacks) prevention add CloudFlare, or AWS Shield, etc.
I hope this article is a bit insightful for you to get started if you ever wonder if it is possible to run your own server. Happy new year and have a great one! I know the article does not go in-depth in most points, but if you get stuck, use the internet and you can find a simple solution; but if you have any problems feel free to leave a comment and I can try helping out.