A s3-compatible backup vps minio setup turns a spare VPS into your own private backup target. You keep the data on hardware you control, you pay no per-gigabyte storage bill, and any tool that speaks the S3 API can write to it. This guide walks through the whole thing: install MinIO in Docker, create a bucket and access key, connect restic, automate daily backups, and prove the restore works before you ever need it.
Why run your own S3 storage for backups
Most backup tools already speak S3. Restic, Borg, Duplicati, and rclone all treat an S3 endpoint as a normal target, so a self-hosted endpoint slots into tools you may already use. A minio object storage vps gives you that endpoint without a cloud account, and it stores objects on plain disk, so you can move the data elsewhere later with rclone if you change your mind.
The trade-off is honest: you now own the storage server too. If the MinIO box dies and holds your only copy, the backup dies with it. A self-hosted s3 backup works best as one leg of a wider plan, with a second copy somewhere else. If you want the full picture first, read the 3-2-1 backup rule for a single VPS before you start.
MinIO also fits small servers. It runs fine on a 1 GB VPS, and its web console means you rarely need the command line after setup. If you would rather compare hosted object storage first, see our comparison of S3, Backblaze B2, and Cloudflare R2 pricing.
What you need before you start
Use two machines, or one machine with a separate disk for the backup data. The cleanest layout is a production VPS for your sites and a second, cheaper VPS for MinIO. Keeping the backup target on the same disk as the data it protects helps against accidental deletion, but it does nothing for a dead disk or a dead provider.
- A VPS with Docker installed, Ubuntu 24.04 or Debian 12 works well.
- At least 20 GB of free disk for the backup data, more if you back up large sites.
- A domain or subdomain for the MinIO console, plus a firewall that only opens ports 9000 and 9001 to your IP.
- Restic installed on the machine you want to back up. On Ubuntu,
sudo apt install resticis enough.
Do not expose the MinIO console to the whole internet without a password and HTTPS. The console holds the keys to every backup you store, so treat it like a root login.
Set up a s3-compatible backup vps minio in four steps
Four steps take you from an empty server to a working backup target: run MinIO, create a bucket and access key, point restic at it, and run the first backup.
Step 1: Run MinIO with Docker
This minio docker setup starts with a data directory, then runs the container. Replace the example user and password with long random values of your own.
sudo mkdir -p /opt/minio/data docker run -d --name minio --restart unless-stopped -p 9000:9000 -p 9001:9001 -e MINIO_ROOT_USER=admin-backup -e MINIO_ROOT_PASSWORD='a-long-random-password-here' -v /opt/minio/data:/data quay.io/minio/minio server /data --console-address ":9001"
Port 9000 is the S3 API and port 9001 is the web console. Check the container with docker logs minio and look for the line that says the server started. If you see a password error, pick a longer one, MinIO rejects short root passwords.
MinIO is free and open source under the AGPLv3 license. Check the official MinIO docs for the current image tag and any license notes before you deploy it for a client.
Step 2: Create a bucket and an access key
Open the console at http://your-server-ip:9001, log in with the root user and password from the Docker command, and create a bucket called vps-backups. Bucket names must be lowercase.
Then create a dedicated access key for restic in the user or service account section, with read and write access to the vps-backups bucket only. Save the access key and secret key somewhere safe. A scoped key limits the damage if it ever leaks, so do not use the root credentials for backups.
Step 3: Point restic at MinIO
On the machine you want to back up, export the MinIO credentials and endpoint, then initialize a restic repository inside the bucket. A restic minio backup talks to MinIO over the S3 API, so the only MinIO-specific part is the endpoint URL.
export AWS_ACCESS_KEY_ID='your-access-key' export AWS_SECRET_ACCESS_KEY='your-secret-key' export RESTIC_REPOSITORY='s3:http://your-minio-server:9000/vps-backups' export RESTIC_PASSWORD='a-long-random-restic-password' restic init
Keep the restic password in a password manager. If you lose it, the backups are unreadable, and no one can recover them for you.
Step 4: Run the first backup
Back up the directories that matter and exclude the noise. For a typical WordPress VPS, that means the web root, the Nginx config, and a database dump. Restic does not dump MySQL itself, so take the dump first.
mysqldump --single-transaction -u root -p wordpress > /tmp/wordpress.sql restic backup /var/www /etc/nginx /tmp/wordpress.sql --exclude /var/www/*/wp-content/cache
The first run takes the longest because it uploads everything. Later runs only upload changed blocks, so a daily backup of a small site usually finishes in seconds. For a deeper walkthrough of restic with S3 storage, see our restic tutorial for encrypted backups to S3-compatible storage.
Automate daily backups
A backup you run by hand is a backup you will forget. Put the credentials in a file only root can read, then call restic from a small script and a cron job.
sudo install -m 600 /dev/null /root/.restic-env # edit /root/.restic-env and add the four export lines from step 3
#!/bin/bash set -e source /root/.restic-env mysqldump --single-transaction -u root -p'YOUR_DB_PASSWORD' wordpress > /tmp/wordpress.sql restic backup /var/www /etc/nginx /tmp/wordpress.sql --exclude /var/www/*/wp-content/cache restic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 6 --prune rm -f /tmp/wordpress.sql
Save the script as /usr/local/bin/backup-to-minio.sh, make it executable with chmod +x, and schedule it in root’s crontab:
0 3 * * * /usr/local/bin/backup-to-minio.sh >> /var/log/minio-backup.log 2>&1
The forget line sets the retention policy: seven daily snapshots, four weekly, and six monthly, then the rest are deleted. Without it, snapshots pile up until the disk fills. If you prefer systemd timers over cron, the same script works unchanged, see how to run scheduled tasks with systemd timers instead of cron.
Test the restore before you need it
A backup you have never restored is a guess, not a safety net. Once a week, restore the latest snapshot to a throwaway directory and check that the files open.
source /root/.restic-env mkdir -p /tmp/restore-test restic restore latest --target /tmp/restore-test ls -la /tmp/restore-test/var/www diff -r /tmp/restore-test/var/www /var/www --brief | head -20 rm -rf /tmp/restore-test
If the restore fails, fix it now, while the live site still works. Common causes are a wrong endpoint, an expired access key, or a full disk on the MinIO server. For a full routine you can repeat monthly, see how to test your VPS backup by restoring it before you actually need it.
Common problems and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
restic init fails with a connection error |
Port 9000 blocked, or the endpoint URL is wrong | Open port 9000 in the firewall and check the URL scheme matches your setup |
| 403 Forbidden on backup | Access key lacks write permission on the bucket | Recreate the key with read and write access to that bucket only |
| Backups slow down over time | Old snapshots pile up and restic scans more data | Run restic forget --prune on a schedule |
| MinIO container keeps restarting | Short root password, or the data directory is not writable | Use a password of at least 8 characters and check ownership of /opt/minio/data |
| Console login fails after a reboot | Container started without the same environment variables | Keep the docker run command in a compose file so restarts use the same settings |
Watch disk usage on the MinIO server too. A backup target that fills up fails silently at 3 a.m., and you only find out when you need the restore. Set an alert at 80 percent full.
When MinIO is not the right call
Self-hosted storage makes sense when you have a spare VPS, you want full control, and you are willing to watch the disk. It is the wrong call when you need a target that survives your whole infrastructure going down, because a second VPS from the same provider in the same region shares some of the same risks. Send a copy to a different provider or a hosted S3 service as well. Two cheap copies in two places beat one expensive copy in one place.
Start with the four steps above, let the cron job run for a week, and restore once to a test directory. When the restore works, you have a real backup, not a script you hope will work.