Adding Minio to my homelab
I wanted to create some object storage for my homelab. Mainly for backups for things like CloudnativePG or Longhorn. Instead of using my WD Cloud, which in turn isn't a great NAS.
This is how I achieved it.
Setting up the VM
First I needed to create a new VM within my Proxmox Cluster. As this VM is just going to be used for storage, I gave it:
- 1 core
- 2 Gi RAM
- 200 Gi Storage
I thought as this was just going to be used for backups, I didn't need a lot of storage. Mainly because, well this is a Homelab and some of my backups have a retention of 30days. The OS I used for this VM was Ubuntu server minimal.
After installing Ubuntu server I installed a few other things that aren't bundle with the minimal version of the OS and gave it a static IP and increased the storage volume to take up all the disk.
# update system
sudo apt-get update -y && sudo apt-get upgrade -y
# ubuntu minimal
sudo apt install curl nano jq git ufw net-tools lsof -y
# install qemu
sudo apt-get install qemu-guest-agent -y && sudo systemctl start qemu-guest-agent && sudo systemctl enable qemu-guest-agent
# expand root filesystem
sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
sudo resize2fs /dev/ubuntu-vg/ubuntu-lv
Setting the static IP was simple for this Ubuntu server image the netplan
file is located here: /etc/netplan/50-cloud-init.yaml
# This is the network config written by 'subiquity'
network:
version: 2
renderer: networkd
ethernets:
ens18:
addresses:
- 192.168.6.69/22
routes:
- to: default
via: 192.168.4.1 # router ip
nameservers:
addresses: [192.168.4.10, 1.1.1.1] # AdGuard / cloudflare
Save file and run sudo netplan apply
and give it a reboot. Once rebooted connect via the new static IP
Setting up Minio
Download the MinIO Server
For my personal use I am going for a Single-Node Single-Drive deployment for ease of use, but there are other options such as Multi-Node Multi-Drive (Distributed).
First I needed to create a directory for my storage, instead of using a separate disk on my VM I am going to use the boot drive. This clearly isn't best practice but this is a playground. I may move to a dedicated storage disk later on. Let's create that directory.
sudo mkdir /storage
Now I have my storage directory it's time to hook it up to Minio, first install the stable Minio DEB
wget https://dl.min.io/server/minio/release/linux-amd64/archive/minio_20241013133411.0.0_amd64.deb -O minio.deb
sudo dpkg -i minio.deb
Create the systemd
Service File
Once installed a system file is needed. The .deb
or .rpm
packages install the following systemd service file to /usr/lib/systemd/system/minio.service
.
The file that was automatically created will look like this:
[Unit]
Description=MinIO
Documentation=https://min.io/docs/minio/linux/index.html
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/usr/local/bin/minio
[Service]
WorkingDirectory=/usr/local
User=minio-user
Group=minio-user
ProtectProc=invisible
EnvironmentFile=-/etc/default/minio
ExecStartPre=/bin/bash -c "if [ -z \"${MINIO_VOLUMES}\" ]; then echo \"Variable MINIO_VOLUMES not set in /etc/default/minio\"; exit 1; fi"
ExecStart=/usr/local/bin/minio server $MINIO_OPTS $MINIO_VOLUMES
Restart=always
LimitNOFILE=65536
TasksMax=infinity
TimeoutStopSec=infinity
SendSIGKILL=no
[Install]
WantedBy=multi-user.target
The minio.service
file runs as the minio-user
User and Group by default. You can create the user and group using the groupadd
and useradd
commands. The following example creates the user and group, and sets permissions to access the folder paths intended for use by MinIO. These commands typically require root (sudo
) permissions.
sudo groupadd -r minio-user
sudo useradd -M -r -g minio-user minio-user
sudo chown minio-user:minio-user /storage # change this to your mounted drive or the directory created
The drive path in my example is specified by the MINIO_VOLUMES
environment variable. Change the value here and in the environment variable file (get into that in a mo) to match the path to the drive intended for use by MinIO.
Create the Environment Variable File
Next you have to create an environment variable file at /etc/default/minio
. The MinIO Server container can use this file as the source of all environment variables.
sudo nano /etc/default/minio
Here is an example:
MINIO_ROOT_USER=myminioadmin
MINIO_ROOT_PASSWORD=minio-secret-key-change-me
MINIO_VOLUMES="/storage"
MINIO_OPTS="--console-address :9001"
MINI0_DOMAIN="minio.70ld.home"
Start the MinIO Service
Now there both files are setup it's time to start the service.
sudo systemctl start minio.service
As the MinIO service does not automatically start on host reboot. You must use systemctl enable minio.service
to start the process as part of the host boot.
sudo systemctl enable minio.service
Connect to the MinIO Service
Now everything is up and running you can connect to the console from the UI (this is how I do things, but you can use the CLI). In your browser head over to
http://<hostname or ip>:9001
The log in with the MINIO_ROOT_USER
and MINIO_ROOT_PASSWORD
configured in the environment file specified. You can then use the MinIO Console for general administration tasks like Identity and Access Management, Metrics and Log Monitoring, or Server Configuration. Each MinIO server includes its own embedded MinIO Console.
You can even interact with your minio instance via the AWS S3 CLI too
aws s3 ls --endpoint-url http://minio.70ld.home:9000 --profile homelab
More to come on using Minio now I have it up and running.