How to install MinIO on Linux

How to install MinIO on Linux – Step by Step Practical Guide

Last Updated on April 19, 2024 by cscontents

Introduction

MinIO is an open-source, high-performance object storage solution and it is designed for modern data infrastructure needs. With its lightweight architecture, distributed design, and compatibility with the Amazon S3 API, MinIO offers a powerful solution for building cloud-native storage environments.

MinIO is a freely available and easy-to-install storage solution. So, we can leverage it for learning, development, and other project usage. Taking one analogy, suppose you need to use AWS s3 storage for any of your projects. In that case, you can easily set up MinIO in a local Linux machine and utilize it.

Another important point is, suppose you don’t want to store your data in any cloud-provided storage solution for security reasons. In that case, you can use MinIO to store your data which will keep your data in the host machine.

In this guide, we discussed the steps to install MinIO on a Ubuntu machine.

Prerequisite

To complete this guide, you need to fulfill the below prerequisites.

  • One Linux machine is required. In our case, we will be using an Ubuntu machine.
  • To perform the installation a non-root user should be there with proper sudo privileges.
  • MinIO uses port 9000 & 9001. Please make sure you have allowed inbound connection over these ports in your machine network.
  • You should have experience in using Linux commands.

Steps to install MinIO

Below are the steps to install MinIO on an Ubuntu machine.

Step 1: Download MinIO Binary files

Execute the below command to download the MinIO binary files.

wget https://dl.min.io/server/minio/release/linux-amd64/archive/minio_20240315010719.0.0_amd64.deb -O minio.deb

Step 2: Install MinIO

Run the below command to install MinIO,

sudo dpkg -i minio.deb

Step 3: Launch the MinIO Server

Execute the below commands to launch the MinIO server.

mkdir ~/minio
minio server ~/minio --console-address :9001

The above will give the below output. This output has the default ‘username’ and ‘password’ of the MinIO UI.

Output:

Formatting 1st pool, 1 set(s), 1 drives per set.
WARNING: Host local has more than 0 drives of set. A host failure will result in data becoming unavailable.
MinIO Object Storage Server
Copyright: 2015-2024 MinIO, Inc.
License: GNU AGPLv3 <https://www.gnu.org/licenses/agpl-3.0.html>
Version: RELEASE.2024-03-15T01-07-19Z (go1.21.8 linux/amd64)

API: http://10.1.0.4:9000  http://172.17.0.1:9000  http://192.168.49.1:9000  http://127.0.0.1:9000
   RootUser: minioadmin
   RootPass: minioadmin

WebUI: http://10.1.0.4:9001 http://172.17.0.1:9001 http://192.168.49.1:9001 http://127.0.0.1:9001
   RootUser: minioadmin
   RootPass: minioadmin

CLI: https://min.io/docs/minio/linux/reference/minio-mc.html#quickstart
   $ mc alias set 'myminio' 'http://10.1.0.4:9000' 'minioadmin' 'minioadmin'

Docs: https://min.io/docs/minio/linux/index.html
Status:         1 Online, 0 Offline.
STARTUP WARNINGS:
- Detected default credentials 'minioadmin:minioadmin', we recommend that you change these values with 'MINIO_ROOT_USER' and 'MINIO_ROOT_PASSWORD' environment variables
- The standard parity is set to 0. This can lead to data loss.

Default credentials,

Username: minioadmin

Password: minioadmin

Now, access the MinIO web UI using a browser using the IP address of the machine. In my case, I will be using the public IP of my machine. In the below URL, replace the ‘machine_ip’ by your IP address.

http://machine_ip:9001

Note:

Please make sure you have allowed inbound connection over port 9000 & 9001 in your machine network.

  • MinIO API uses port 9000
  • And MinIO web UI uses port 9001

MinIO installation

Step 4: Run MinIO as a Systemd process (Recommended)

In the previous step, we launched the MinIO server, but this way of launching MinIO won’t persist if we reboot or shut down the host machine (or) if we press ctrl + c on the keyboard, the MinIO session will be stopped.

To make the MinIO process persistent we will run it as a Systemd process.

For this, we need to create a Systemd file at /etc/systemd/system/ location. Run the below command to create a Systemd file.

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

Copy and paste the below content in the above minio.service file.

[Unit]
Description=MinIO
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/usr/local/bin/minio

[Service]
WorkingDirectory=/usr/local

User=minio-server-user
Group=minio-server-group
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

Save the file.

In the above file, we have used ‘minio-server-user‘ user and ‘minio-server-group‘ group.

Run the below command to create the user.

sudo useradd minio-server-user

Run the below command to create the group.

sudo groupadd minio-server-group

Now, add the ‘minio-server-user‘ user and ‘minio-server-group‘ group.

sudo usermod -aG minio-server-group minio-server-user

Next, we will create a directory for MinIO to store the data.

we will use /mnt/minio_data directory for storing the minio data. You can create the directory by running the below command.

sudo mkdir /mnt/minio_data

Next, we need to change the ownership of this directory.

sudo chown -R minio-server-user:minio-server-group /mnt/minio_data

Next, we need to create /etc/default/minio file. Run the below command to create the file.

sudo vi /etc/default/minio

Copy and paste the below content in the /etc/default/minio file.

# Volume or directory to be used for MinIO server.
MINIO_VOLUMES="/mnt/minio_data"
# Use if you want to run MinIO on a custom port.
MINIO_OPTS="--address :9000 --console-address :9001"
## Root user for the server. This username will be used for logging into web UI
MINIO_ROOT_USER=minioadmin
## Root password for the server. This password will be used for logging into web UI.
MINIO_ROOT_PASSWORD=miniopassword

MINIO_CONFIG_ENV_FILE=/etc/default/minio

Note: In the above file, we have “MINIO_ROOT_USER” and “MINIO_ROOT_PASSWORD”, these details will be used while logging into the web UI.

Step 5: Start the MinIO service and check the status

Execute the below command to start the MinIO service.

sudo systemctl start minio

To start the MinIO service automatically when the server boots up, we need to enable the minio service.

sudo systemctl enable minio

Now to check the status of the minio service.

systemctl status minio

Output:

● minio.service - MinIO
     Loaded: loaded (/etc/systemd/system/minio.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2024-03-24 18:09:49 UTC; 21min ago
   Main PID: 3371 (minio)
      Tasks: 8
     Memory: 142.6M
     CGroup: /system.slice/minio.service
             └─3371 /usr/local/bin/minio server --address :9000 --console-address :9001 /mnt/minio_data

Mar 24 18:09:49 ubuntu02 minio[3371]: Version: RELEASE.2024-03-15T01-07-19Z (go1.21.8 linux/amd64)
Mar 24 18:09:49 ubuntu02 minio[3371]: API: http://10.1.0.4:9000  http://172.17.0.1:9000  http://192.168.49.1:9000  http://127.0.0.1:9000
Mar 24 18:09:49 ubuntu02 minio[3371]: WebUI: http://10.1.0.4:9001 http://172.17.0.1:9001 http://192.168.49.1:9001 http://127.0.0.1:9001
Mar 24 18:09:49 ubuntu02 minio[3371]: Docs: https://min.io/docs/minio/linux/index.html
Mar 24 18:09:49 ubuntu02 minio[3371]: Status:         1 Online, 0 Offline.
Mar 24 18:09:49 ubuntu02 minio[3371]: STARTUP WARNINGS:
Mar 24 18:09:49 ubuntu02 minio[3371]: - The standard parity is set to 0. This can lead to data loss.
Mar 24 18:09:49 ubuntu02 minio[3371]:  You are running an older version of MinIO released 6 days before the latest release
Mar 24 18:09:49 ubuntu02 minio[3371]:  Update: Run `mc admin update ALIAS`
Mar 24 18:30:14 ubuntu02 systemd[1]: /etc/systemd/system/minio.service:12: Unknown key name 'ProtectProc' in section 'Service', ignoring.

If you get any issues or errors, you can check the logs by running the below command.

journalctl -u minio

In the above command,

journalctl is a command line utility used for checking logs of any systemd service.

-u: it means “unit”, we need to specify the concerned Systemd service or unit name.

Reference Documents

 

Thank you.

If you are interested in learning DevOps, please have a look at the below articles, which will help you greatly.