Categories
Server admin

Installing OMV on Raspberry Pi

Open media vault allows you to run a NAS server on your raspberry pi. the easiest way to install it on your pi is to install the default “lite” version of the OS. That is the one with no “Desktop” and then run the following script:

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

After that completes, you’ll also want to run this one:

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

Give it a few minutes to run, and it should be accessible through the website at it’s ip address. You will then use the default username and password to log in. The default username is “admin” and the default password is “openmediavault”
Source: https://www.reddit.com/r/OpenMediaVault/comments/16qcny4/guide_for_setting_up_omv_on_raspberry_pi/

Categories
Server admin

Backing up Raspberry Pi

Why!?!?

“Why!?!?” That’s what I was asking when my pi stopped working. After days of configuration and tinkering it just wouldn’t connect to the network anymore. I said to myself “Welp, I guess I’ll reinstall from scratch” and spent the next few hours installing and setting everything back up again.

Solution? Make a Backup using a Mac

Obviously this is what I should have done from the beginning. Now what’s the “right” backup solution?

The simplest one is to insert an identical sd card into a card reader and insert that into the USB port. And then running this command from the terminal while the pi is off. Replace /dev/mmcblk0 with the location of your pi installation drive, and /dev/sda with where you want to store it to.

On mac, you can see all the drives and their paths by using this command. Source: https://pbxbook.com/other/dd_clone.html

diskutil list

The output should inform you on what disk you should be copying from. If it says /dev/disk5, then use /dev/rdisk5 that is just prepend an ‘r’ in front of the drive name and it will work faster. For details see https://superuser.com/questions/631592/why-is-dev-rdisk-about-20-times-faster-than-dev-disk-in-mac-os-x

# Warning: Do not do this on a raspberry pi system that is powered on. It might work, but might not since your system may write stuff at the same time.
sudo dd if=/dev/rdisk5 of=/dev/sda bs=4M status=progress

If you’d like to save the data to a file on your computer, use the following command. When running this on my own system, it took a long time (about 25 minutes or so), and doesn’t provide any output while running, so be patient with it when it is running. Source: https://forums.raspberrypi.com/viewtopic.php?t=46911

sudo dd bs=4M if=/dev/rdisk5 | gzip > ~/image`date +%d%m%y`.gz

To restore to a disk, use the following code. Source: https://forums.raspberrypi.com/viewtopic.php?t=46911

sudo gzip -dc /home/your_username/image.gz | dd bs=4M of=/dev/sdb

Then at the end, I swapped the SD cards to verify that the backup worked and it did!

For the people willing to install more stuff

Additionally if you installed zstd and pv, you can use combine them for a small and fast file with estimation replace 60906M with your estimate of the transfer size or use it without the -s and 60906M to just have a progress bar without a time estimate:

sudo dd bs=4M if=/dev/rdisk5 | pv -s 60906M | zstd -3 > ~/ddpvomv64_image`date +%y%m%d`.img.zst

And to restore use:

sudo zstd -dc /Users/shawn/Downloads/omv16_duckdns_image240116.img.zst | pv -s 15700M | sudo dd bs=4M of=/dev/rdisk5

Thanks, Sources:

Others using dd: https://forums.raspberrypi.com/viewtopic.php?t=46911
To get progress working: https://askubuntu.com/questions/215505/how-do-you-monitor-the-progress-of-dd
For a more complete solution: https://github.com/RichardMidnight/pi-safe

Categories
Server admin

Ubuntu has a firewall enabled by default

So when setting up my ubuntu server. I was running into issues connecting from different machines on my local network. I ran a port scan using nmap to see that many ports were filtered. I tried many things, but in the end one simple command fixed it.

sudo ufw disable
Categories
Server admin

Upgrading portainer

To make this, I followed the guide posted here. https://docs.portainer.io/v/ce-2.9/start/upgrade/docker The latest portainer at the time of writing is portainer version 2.14.1 please replace that string with the latest version when using the following commands.

sudo docker stop portainer
sudo docker rm portainer
sudo docker pull portainer/portainer-ce:2.14.1
sudo docker run -d -p 8000:8000 -p 9000:9000 -p 9443:9443 \
    --name=portainer --restart=always \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v portainer_data:/data \
    portainer/portainer-ce:2.14.1
Categories
Server admin

Installing Docker and Portainer

So I recently needed to install docker and portainer so that I could run a few services on my server.

Installing docker

This is just helpful links for installing docker on ubuntu or lubuntu for me on lubuntu 22.04.
the most important commands on that were:

sudo apt update && sudo apt upgrade -y
sudo apt install docker.io
docker --version

After that you should be able to to test that your installation is installed and running.

How to install portainer once you have docker running

My main source for this section is https://docs.portainer.io/v/ce-2.9/start/install/server/docker/linux
The most important important commands to run from that article are below.

sudo docker volume create portainer_data
sudo docker container run -d --name portainer -p 8080:9000 \
--restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data portainer/portainer
sudo docker start portainer
sudo docker container ls

To login to portainer

To login to portainer, the instructions say to use https://localhost:9443 of course I’m logging in remotely, so I thought that I could just replace localhost with the ip address of my server, but that didn’t work, but port forwarding with an ssh tunnel did work. To forward the port, I had to run the following command

ssh -L localhost:9443:localhost:9443 [email protected]
in chrome: https://localhost:9443

Only after running that command, could I use the localhost address in chrome on my remote machine.