MinIO

MinIO is an open-source object storage platform designed to store large amounts of data securely and quickly. MinIO is compatible with the Amazon S3 protocol, enabling integration with various applications and services that use S3. This solution is widely used for cloud-native storage needs, such as big data, machine learning, backups, and containerization.

MinIO excels in high performance, scalability, and simplicity of implementation. With multi-cloud support, MinIO can be used on on-premises infrastructure, public clouds, or hybrid clouds. Data security in MinIO is ensured through end-to-end encryption, along with features like data versioning and erasure coding to ensure redundancy and protection against data loss.

1. System Requirements

The recommended system requirements for MinIO are:

  • 4 CPUs
  • 8 GB RAM
  • 100 GB SSD
  • 1GB/s network bandwidth
  • Ubuntu 20.04 LTS

This deployment guide uses the following configuration:

  • MinIO Single Node Single Drive (SNSD) topology
  • Cloud VPS with 1 CPU, 1 GB RAM
  • 100 GB Block Storage
  • OS: Ubuntu 24.04 LTS
  • MinIO Open Source
  • Subdomains: minio-console.contoh.com, minio-api.contoh.com

2. Storage Preparation

Update the system

sudo apt update
sudo apt upgrade -y

Block storage has already been installed previously.
Show block devices.

sudo lsblk

Example of the output:

NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda       8:0    0  100G  0 disk 
vda     253:0    0   25G  0 disk 
├─vda1  253:1    0   24G  0 part /
├─vda14 253:14   0    4M  0 part 
├─vda15 253:15   0  106M  0 part /boot/efi
└─vda16 259:0    0  913M  0 part /boot
vdb     253:16   0  482K  1 disk

The sda device will be used.
Partition and format sda with the XFS filesystem.

sudo parted -s /dev/sda mklabel gpt	
sudo parted -s /dev/sda unit mib mkpart primary 0% 100%
sudo mkfs.xfs /dev/sda1

Verify the partitioning step.

sudo lsblk

Example of the output:

NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda       8:0    0  100G  0 disk 
└─sda1    8:1    0  100G  0 part 
vda     253:0    0   25G  0 disk 
├─vda1  253:1    0   24G  0 part /
├─vda14 253:14   0    4M  0 part 
├─vda15 253:15   0  106M  0 part /boot/efi
└─vda16 259:0    0  913M  0 part /boot
vdb     253:16   0  482K  1 disk 

The block storage sda with partition sda1 is now active.

Create a directory and mount the sda1 partition.

sudo mkdir /mnt/minio-storage
sudo mount /dev/sda1 /mnt/minio-storage	

Verify the mounting step.

df -hT

Example of the output:

Filesystem     Type   Size  Used Avail Use% Mounted on
tmpfs          tmpfs   97M  1.0M   96M   2% /run
/dev/vda1      ext4    24G  5.3G   18G  23% /
tmpfs          tmpfs  481M     0  481M   0% /dev/shm
tmpfs          tmpfs  5.0M     0  5.0M   0% /run/lock
/dev/vda16     ext4   881M   61M  758M   8% /boot
/dev/vda15     vfat   105M  6.1M   99M   6% /boot/efi
tmpfs          tmpfs   97M   12K   97M   1% /run/user/1000
/dev/sda1      xfs    100G  2.0G   98G   2% /mnt/minio-storage

The partition sda1 has been successfully mounted at /mnt/minio-storage.

Open the fstab file.

sudo nano /etc/fstab

Add the auto-mount configuration for sda1.

/dev/sda1  /mnt/minio-storage  xfs  defaults  0  0

3. Install MinIO Server

Download and install the MinIO server.

wget https://dl.min.io/server/minio/release/linux-amd64/minio_20241218131544.0.0_amd64.deb
sudo dpkg -i minio*.deb

Buat user minio-user

sudo useradd -r minio-user -s /sbin/nologin
sudo chown minio-user:minio-user /mnt/minio-storage	

Create the configuration file.

sudo nano /etc/default/minio

Enter the configuration.

MINIO_VOLUMES="/mnt/minio-storage"
MINIO_OPTS="--address :9000 --console-address :9001"
MINIO_ROOT_USER=minio_admin
MINIO_ROOT_PASSWORD=minio_password

Start the MinIO service.

sudo systemctl start minio
sudo systemctl enable minio
sudo systemctl status minio

4. Configuring Nginx

Install Nginx.

sudo apt install nginx -y

Create a reverse proxy configuration for the console.

sudo nano /etc/nginx/conf.d/minio-console.conf

Enter the configuration.

server {
   listen 80;
   server_name  minio-console.contoh.com;

   ignore_invalid_headers off;
   client_max_body_size 0;
   proxy_buffering off;
   proxy_request_buffering off;

   location / {
      proxy_set_header Host $http_host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_set_header X-NginX-Proxy true;

      real_ip_header X-Real-IP;
      proxy_connect_timeout 300;

      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";

      chunked_transfer_encoding off;

      proxy_pass http://127.0.0.1:9001;
   }

   access_log /var/log/nginx/minio-console.access.log;
   error_log /var/log/nginx/minio-console.error.log;
}

Create a reverse proxy configuration for the API.

sudo nano /etc/nginx/conf.d/minio-api.conf

Enter the configuration.

server {
   listen 80;
   server_name  minio-api.contoh.com;

   ignore_invalid_headers off;
   client_max_body_size 0;
   proxy_buffering off;
   proxy_request_buffering off;

   location / {
      proxy_set_header Host $http_host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;

      proxy_connect_timeout 300;
      proxy_http_version 1.1;
      proxy_set_header Connection "";
      chunked_transfer_encoding off;

      proxy_pass http://127.0.0.1:9000;
   }

   access_log /var/log/nginx/minio-api.access.log;
   error_log /var/log/nginx/minio-api.error.log;
}

Restart the Nginx server.

sudo systemctl restart nginx

Install Certbot.

sudo apt install certbot python3-certbot-nginx -y

Install the SSL certificate.

sudo certbot --non-interactive \
-m [email protected] \
--agree-tos \
--no-eff-email \
--nginx -d minio-console.contoh.com \
--redirect

sudo certbot --non-interactive \
-m [email protected] \
--agree-tos \
--no-eff-email \
--nginx -d minio-api.contoh.com \
--redirect

5. Testing

Console Testing

  • Access https://minio-console.contoh.com
  • Create a bucket
  • Browse the bucket
  • Upload a file to the bucket
  • Create a user

API Testing
Install the MinIO client.

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

Create a connection to the MinIO server.

mc alias set myminio/ https://minio-api.contoh.com MYUSERNAME MYPASSWORD

List all objects located in myminio.

mc ls myminio

List all objects located in mybucket.

mc ls myminio/mybucket

The MinIO server deployment is complete and ready for use.