(Last Updated On: January 30, 2019)

Do you want to setup your private S3 compatible Object storage server?. Minio is a lightweight object storage server compatible with Amazon S3 cloud storage service. Minio is written in Go and licensed under Apache License v2.0.


Object storage is best suited for storing unstructured data such as videos, photos, log files, container images, VM images, and backups. Each size of an object can range from a few KBs to a maximum of 5TB.

How to Install Minio Object Storage Server on Linux

Minio object storage server can be installed from a binary file or by running it in a container. I won’t do container installation because it is not an ideal way of setting up a storage server.

Step 1: Download Minio

Download Minio binary.

wget https://dl.minio.io/server/minio/release/linux-amd64/minio
chmod +x minio
sudo mv minio /usr/local/bin/

You can query package details using version option.

$ minio  version
Version: 2019-01-23T23:18:58Z
Release-Tag: RELEASE.2019-01-23T23-18-58Z
Commit-ID: bd25f31100f44646cffae99dfec23179366593e2

Step 2: Prepare Object Storage disk

After Minio is downloaded, let’s prepare a block device that we’ll use to store objects. The path used can just be a directory inside your file system root.

For convenience and reliability, I’m using a secondary disk in my server.

# lsblk  | grep sdb
sdb 8:16 0 10G 0 disk

I’ll create a new partition and mount this disk to /data directory.

sudo parted -s -a optimal -- /dev/sdb mklabel gpt
sudo parted -s -a optimal -- /dev/sdb mkpart primary 0% 100%
sudo parted -s -- /dev/sdb align-check optimal 1
sudo mkfs.ext4 /dev/sdb1
echo "/dev/sdb1 /data ext4 defaults 0 0" | sudo tee -a /etc/fstab
sudo mkdir /data
sudo mount -a

Confirm disk mount

$ df -h | grep /data
/dev/sdb1 9.8G 37M 9.3G 1% /data

Step 3: Start Minio service

You have three options of starting a Minio Server.

  • From command line – interactive session
  • Using Systemd
  • Using Sysvinit / Upstart

Managing Minio Service with systemd

For guys running a system with systemd init system, create a user and group for running Minio service.

sudo groupadd --system minio
sudo useradd -s /sbin/nologin --system -g minio minio

Give minio user ownership for the /data directory.

sudo chown -R minio:minio /data/

Create systemd service unit file for Minio.

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

Add below contents to the file.

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

[Service]
WorkingDirectory=/data
User=minio
Group=minio

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

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

[Install]
WantedBy=multi-user.target

Create Minio environment file /etc/default/minio

sudo mkdir -p /etc/default/

cat <<EOF | sudo tee /etc/default/minio
# Volume to be used for Minio server.
MINIO_VOLUMES="/data"
# Use if you want to run Minio on a custom port.
MINIO_OPTS="--address :9000"
# Access Key of the server.
MINIO_ACCESS_KEY=BKIKJAA5BMMU2RHO6IBB
# Secret key of the server.
MINIO_SECRET_KEY=V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
EOF

MINIO_ACCESS_KEY: Access key of minimum 3 characters in length.

MINIO_SECRET_KEY: Secret key of minimum 8 characters in length.

Reload systemd and start minio service

sudo systemctl daemon-reload
sudo systemctl start minio

A check on status should show running.

You can also set the service to start on boot.

sudo systemctl enable minio

Step 4: Configure Firewall

If you have an active firewall service, allow port 9000.

For UFW, use:

sudo ufw allow 9000

For firewalld, use:

sudo firewall-cmd --zone=public --add-port=9000/tcp --permanent
sudo firewall-cmd --reload

Step 5: Access Minio Web interface

Now that we have installed Minio, started the service and configured firewall, we can visit the web dashboard URL to finish login and create the first test bucket.

Visit the URL http://[serverip|localhost]:9000 from your browser and login with the configured Access and Secret key.

On logging, you should get to an object web interface which looks similar to below.

You can create a test bucket from the UI by clicking on the “+” button at the right bottom corner.

Provide bucket name and press enter key.

Step 6: Test Minio with mc client

mc provides a modern alternative to UNIX commands like ls, cat, cp, mirror, diff etc. Download mc to your Linux.

wget https://dl.minio.io/client/mc/release/linux-amd64/mc
chmod +x mc
sudo mv mc /usr/local/bin
mc --help

Setup autocompletion

sudo wget https://raw.githubusercontent.com/minio/mc/master/autocomplete/bash_autocomplete
sudo mv bash_autocomplete /etc/bash_completion.d/mc
source /etc/bash_completion.d/mc

And enjoy tab completion feature.

$ mc <TAB>

Configure mc for Minio:

mc config host add <ALIAS> <YOUR-S3-ENDPOINT> <YOUR-ACCESS-KEY> <YOUR-SECRET-KEY> <API-SIGNATURE>

Example:

mc config host add minio http://10.0.2.15 BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 --api S3v4

Sample output:

Follow the complete guide on Use mc with Minio Server to get started with mc.

You can also explore further like using AWS CLI, s3cmd e.t.c.

See How to Install and Use AWS CLI on Linux – Ubuntu / Debian / CentOS

Reference:

Minio Documentation

For Ceph, check: How to Install Ceph Storage Cluster on Ubuntu 18.04 LTS

Tags:

  • How can I setup Object storage server on Linux
  • S3 Object storage server setup on Ubuntu / Debian / CentOS
  • Minio Object Storage server
  • Setup S3 Compatible Object Storage Server with Minio