Professionalize your home lab with a Raspberry PI and a NAS — Part 3
Table of Content
Part 3: Setting up our Ubuntu server
TL;DR of part 2
In part 2 we have installed Open Media Vault and configured our NAS to provide us with NFS and CIFS/Samba. We extended the default OMV installation with OMV-Extras and installed the autoshutdown plugin to shutdown our NAS in case of non existent activity (electricity’s unfortunately not for free). Extending on the energy saving approach we additionally set up a cron job for OMV powering it off every day at a specific time.
Why the hell did you chose a Raspberry Pi? Doesn’t it lack the strength of handling services like Nextcloud?
Easy, the Raspberry Pi is unbelievably cheap and not using a lot of electricity. On top of that the new model 4 gives you the option of 8GB RAM, it the ideal server (if you want to know more about the electricity costs, part 1 is dealing with it!). Regarding the Pi’s power I can only say that it’s working really good for me, powering Nextcloud, GitLab, Calibre and different dockerized Apaches is not a problem at all. Of course it’s not a server with 64 cores and 128GB of RAM, but let’s be honest: If I have to wait some seconds more, it’s still fine.
Setting up Ubuntu on our Raspberry Pi
As in part 2 I won’t be covering how to install Ubuntu on our Raspberry Pi, as there are a lot of great tutorials freely available. Once again, I chose to buy a new Raspberry Pi 4b with 8 GB of Ram. This will help us to host memory consuming services like Elasticsearch (used for OCR indexing of our Nextcloud files) and GitLab.
This part will not be a lot of reading material but after the exhausting setup described in part 2 I think that’s okay! Now, let’s have a look on what we’ll be doing today.
Connect your Pi to your network
The biggest pain in the a** of installing a RPI (with the exception of the headless mode) is to configure our Wifi. It doesn’t matter how often I’ve already configured and connected a Linux computer to my network, it’s still really annoying to find a “free” monitor and plug it in. On top of that you also need a preferrably wireless keyboard. Well, sorry for complaining, let’s get back to business. Check the name of your wireless interface with the following command:
ip link show
For me, the name of the wireless interface is wlan0. Keep it in mind and issue the following command:
sudo nano /etc/netplan/50-cloud-init.yaml
Your file will probably look like this:
Add the following part
# Here is where you should add your config
That’s it! Now issue the following command and you should be provided with access to the internet.
sudo netplan apply
Configure a static ip
You have the same two possibilities as in part 2: either you configure it manually, this time through the 50-cloud-init.yaml file or you just head over to your router and check the option which is saying “always assign the same ip”. If you need help configuring a static IP, drop me a comment and I’ll add an example.
Install docker and docker-compose
We will use PiHole later on as our internal DNS server. If you would not start docker with your system rebooting, name resolution inside your network would not work out!
sudo apt install docker docker-compose
Enable docker startup on reboot
Let’s have a look at the documenation side of docker: https://docs.docker.com/engine/install/linux-postinstall/#configure-docker-to-start-on-boot
sudo systemctl enable docker.service
sudo systemctl enable containerd.service
Now is a good time to reboot your Raspberry Pi and check if all the things you have configured, are actuall working:
- Static IP
- docker will be loaded at startup
That’s it! Quick’n’easy this time!