MinIO is a high-performance, distributed object storage system compatible with the Amazon S3 API. It is ideal for managing unstructured data such as photos, videos, log files, backups, and container images. This guide provides a step-by-step tutorial on how to install and configure MinIO on an Ubuntu system.


Prerequisites

  1. Ubuntu server: Ensure you have a system running Ubuntu 20.04 or later.
  2. Root or Sudo Access: Administrative privileges to install and configure software.
  3. Basic Tools: Update your system and ensure essential tools like wget and curl are installed:
sudo apt update && sudo apt install -y wget curl

Step 1: Download the MinIO Binary

MinIO provides precompiled binaries for Linux. Use the following commands to download the MinIO server binary:

wget https://dl.min.io/server/minio/release/linux-amd64/minio

After downloading, make the binary executable:

chmod +x minio

Move the binary to a system-wide accessible directory, such as /usr/local/bin:

sudo mv minio /usr/local/bin/

Step 2: Create a Dedicated User for MinIO

For security purposes, it’s recommended to run MinIO as a non-root user. Create a user and group for MinIO:

sudo useradd -r minio-user -s /sbin/nologin

Step 3: Configure Data Directory

Choose a directory to store your MinIO data. For example, use /mnt/data/minio:

sudo mkdir -p /mnt/data/minio
sudo chown -R minio-user:minio-user /mnt/data/minio

Step 4: Create file for config access and password

# Set the hosts and volumes MinIO uses at startup
# The command uses MinIO expansion notation {x...y} to denote a
# sequential series.
#
# The following example covers four MinIO hosts
# with 4 drives each at the specified hostname and drive locations.
# The command includes the port that each MinIO server listens on
# (default 9000)

MINIO_VOLUMES="/mnt/data/minio"

# Set all MinIO server options
#
# The following explicitly sets the MinIO Console listen address to
# port 9001 on all network interfaces. The default behavior is dynamic
# port selection.
MINIO_OPTS="--console-address :9001 --address :9010"

# Set the root username. This user has unrestricted permissions to
# perform S3 and administrative API operations on any resource in the
# deployment.
#

# Defer to your organizations requirements for superadmin user name.
MINIO_ROOT_USER=minio-admin
# Set the root password
#
# Use a long, random, unique string that meets your organizations
# requirements for passwords.

MINIO_ROOT_PASSWORD=hmzh&XN4

# Set to the URL of the load balancer for the MinIO deployment
# This value *must* match across all MinIO servers. If you do
# not have a load balancer, set this value to to any *one* of the
# MinIO hosts in the deployment as a temporary measure.
#MINIO_SERVER_URL="https://minio.example.net:9000"

Step 5: Configure Systemd Service

Create a systemd service file to manage MinIO as a service. Open the service file for editing:

sudo nano /etc/systemd/system/minio.service

Add the following content:

[Unit]
Description=MinIO
Documentation=https://docs.min.io
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/usr/local/bin/minio

[Service]
WorkingDirectory=/usr/local

User=skm-minio
Group=skm-minio
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

# Let systemd restart this service always
Restart=always

# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65536

# Specifies the maximum number of threads this process can create
TasksMax=infinity

# Disable timeout logic and wait until process is stopped
TimeoutStopSec=infinity
SendSIGKILL=no

[Install]
WantedBy=multi-user.target

# Built for ${project.name}-${project.version} (${project.name})

Step 6: Reload Systemd and Start MinIO

Reload systemd to apply the changes:

sudo systemctl daemon-reload

Start and enable the MinIO service:

sudo systemctl start minio
sudo systemctl enable minio

Check the service status:

sudo systemctl status minio

Step 7: Access MinIO Web Interface

MinIO runs on port 9000 by default. But we was change it to 9001. Open your browser and navigate to:

http://<your-server-ip>:9001

Log in using the credentials you configured in the systemd service file.


Optional Steps

Configure Firewall

If you have a firewall enabled, allow access to port 9000:

sudo ufw allow 9001
sudo ufw reload

Secure with HTTPS

MinIO supports HTTPS out of the box. To configure HTTPS, provide an SSL certificate and key by placing them in a directory and starting MinIO with:

minio server --certs-dir /path/to/certs /mnt/minio

Loading

Leave a Reply

Your email address will not be published. Required fields are marked *