When managing large volumes of unstructured data — images, logs, or backups — object storage is often the best fit. MinIO is an open-source, S3-compatible object storage server you can run on your own infrastructure. This guide automates installing and configuring MinIO using Ansible on Ubuntu or Debian (e.g. Debian 12).
You will use a single playbook that updates the system, installs the MinIO binary, creates a dedicated user and directories, configures environment variables and a systemd service, and starts MinIO. The S3 API will listen on port 9000 and the web console on port 9001.
Prerequisites: Ansible installed on your control node (see How to Install and Configure Ansible on Rocky Linux or install via pip/apt); SSH access to one or more Ubuntu or Debian hosts; an inventory file defining your target hosts (e.g. citizixsrv).
What is Object Storage?
Object storage is a way of storing data as objects, rather than as files in a hierarchy or blocks on a disk. It’s ideal for large-scale, distributed systems. MinIO brings this architecture to your own infrastructure and is often used as a self-hosted alternative to AWS S3.
Why Use Ansible?
Ansible is an agentless configuration management tool that allows you to describe server configuration using YAML. It’s perfect for automating repeatable tasks like software installation and systemd configuration.
What This Playbook Does
This playbook will:
- Update and upgrade system packages
- Install common utilities like
vim,git, andufw - Download the latest MinIO binary
- Create a non-login system user for MinIO
- Set up the necessary directory structure
- Configure environment variables and a systemd service
- Start and enable the MinIO service
Set Up Required Variables
Here are the core variables used in the playbook. These make the playbook more reusable and configurable:
| |
You can update the password or path values to match your environment. Security: avoid committing plain-text passwords to version control. Use Ansible Vault to encrypt minio_root_password (e.g. in a vars file or --extra-vars) and pass the vault password at run time.
Step-by-Step Breakdown
Update the OS
We start by ensuring the server is up-to-date:
| |
Install Useful Utilities
These are helpful tools to have on any server:
| |
Download the MinIO Binary
We fetch the MinIO binary directly from MinIO’s official release:
| |
Create a Dedicated System User
We’ll run MinIO as a non-login system user for security:
| |
Create Required Directories
Create the working and data directories for MinIO:
| |
Set Up MinIO Environment Configuration
We define runtime configuration in /etc/default/minio:
| |
Create systemd Service
This service file ensures MinIO is managed by systemd:
| |
Enable and Start the MinIO Service
This ensures MinIO starts on boot and is running:
| |
Full Playbook: setup-minio.yml
Here is the complete playbook for reference:
| |
Running the Playbook
Save the playbook as setup-minio.yml and run it with your inventory (replace inventory with your inventory file or group name):
| |
If you use Ansible Vault for minio_root_password, add --ask-vault-pass or provide a vault password file.
Verifying MinIO
After a successful run, MinIO should be listening on the target host:
- S3 API: http://your-server-ip:9000
- Web Console: http://your-server-ip:9001
Check the service:
1ssh your-user@your-server-ip 'systemctl status minio'Open the console: In a browser, go to
http://your-server-ip:9001and log in withminio_root_userandminio_root_passwordfrom your vars.Test the API: Use the MinIO Client (
mc) or any S3-compatible client (e.g. AWS CLI with--endpoint-url http://your-server-ip:9000).
If you enabled ufw on the host, allow ports 9000 and 9001 (e.g. ufw allow 9000/tcp, ufw allow 9001/tcp, ufw reload) or restrict them to your IP/subnet.
Troubleshooting
- Service fails to start: Check
journalctl -u minio -n 50. EnsureMINIO_VOLUMESis set in/etc/default/minioand the data directory exists and is owned by the MinIO user. Ensure the binary atminio_bin_pathis executable (chmod +x /usr/local/bin/minio). - Port already in use: Another process may be using 9000 or 9001. Change
MINIO_OPTSin the env file (e.g.--address :9002 --console-address :9003) and reload the playbook or service. - Ansible “Permission denied” or “Failed to connect”: Ensure SSH keys or credentials are set up for the inventory host and that
become(sudo) is allowed for the user.
Summary
You automated MinIO installation on Ubuntu or Debian with Ansible: system update, MinIO binary, dedicated user, directories, environment file, and systemd service. MinIO gives you S3-compatible object storage on your own infrastructure for backups, logs, or custom applications.
For other deployment options, see How to Run MinIO in Docker and Docker Compose or How to Set Up MinIO as Object Storage on Rocky Linux.
Related Posts
- How to Run MinIO in Docker and Docker Compose – MinIO in containers
- How to Set Up MinIO as Object Storage on Rocky Linux – Manual MinIO on Rocky Linux
- How to Install and Configure Ansible on Rocky Linux – Install Ansible
- How to Install Docker Engine in Debian 11 Using Ansible – Ansible on Debian