Getting Started with MinIO

Today, we're diving into MinIO, a flexible, high-performance object storage solution that’s perfect for a wide variety of applications. Whether you’re a developer, an IT admin, or just a curious tech enthusiast, this guide will walk you through the essentials of getting started with MinIO. So let’s jump in!


What is MinIO?


MinIO is an open-source object storage server designed to deliver high performance and scalability, especially in cloud-native applications. It’s built with simplicity in mind and boasts compatibility with Amazon S3, meaning you can use it as a drop-in replacement for many existing S3-based applications.


Why Choose MinIO?


There are several reasons to consider using MinIO:

- Simplicity: Setting up MinIO is incredibly straightforward, making it accessible for users of all levels.
- High Performance: MinIO is designed to be fast, supporting high-throughput scenarios and large object sizes with ease.
- Scalability: Whether you’re storing a dozen objects or billions, MinIO can grow with your needs.

For this guide, we will be doing a docker-installed MinIO with self-managed SSL.

Prerequisites

  • Docker installed.
  • Full access to the folder or drive used for the persistent volume.
  • Certbot installed for LetsEncrypt Certificate.
  • Domain with A Record DNS pointing to the IP of the VPS

Make the volumes

We will need 2 docker volumes
minio-data and minio-root

You can generate them using the commands below:
docker volume create minio-data

docker volume create minio-root

Setting the DNS and getting the SSL certificate

WARNING:
THE FOLLOWING EXAMPLES WILL BE USING EXAMPLE.COM AND 192.0.2.1
CHANGE THAT TO YOUR DOMAIN AND IP RESPECTIVELY

In order for our minio to use a domain we will need to set an A record with our DNS registrar (Namecheap in my case)
Setting the A record is as simple as logging in and clicking on Create New Record -> A record and pointing the domain/subdomain to your IP
Here is an example

+-------------------+
|    DNS Settings    |
+-------------------+
| Domain Name       | example.com    |
| Record Type       | A              |
| IP Address        | 192.0.2.1      |
| TTL               | 3600           |
+-------------------+

After that you are ready to create the SSL certificate using:

  • certbot certonly -d example.com

MinIO wants the certificates to be private.key and public.crt instead of the normal LetsEncrypt fullchain.pem and privkey.pem
To sort out this issue do -

  • cd /etc/letsencrypt/live/example.com
  • cp fullchain.pem public.crt
  • cp privkey.pem private.key

Start the container and set the name/password

docker run -d --name Minio \
  -p 9000:9000 \
  -p 443:9001 \
  -e "MINIO_ROOT_USER=" \
  -e "MINIO_ROOT_PASSWORD=" \
  --mount type=volume,source=minio-data,target=/data \
  --mount type=bind,source=/etc/letsencrypt/live/example.com,target=/root/.minio/certs \
  --mount type=volume,source=minio-root,target=/root/.minio \
  quay.io/minio/minio:latest server /data --console-address ":9001" \
  --restart always
WARNING: MAKE SURE TO USE YOUR DOMAIN INSTEAD OF EXAMPLE.COM
In MINIO_ROOT_USER and MINIO_ROOT_PASSWORD type in the default admin username and password

Then do docker ps to see if everything is working as intended
And that's pretty much it
Now you can go to your domain - (example.com in this case) and you will be greeted by the MinIO login screen

As for the CLI setup, you will need the MinIO Client which can be downloaded by running the following commands:

  1. Download the client
curl https://dl.min.io/client/mc/release/linux-amd64/mc \
  --create-dirs \
  -o $HOME/minio-binaries/mc
  1. Make the Client executable and add it to $PATH
chmod +x $HOME/minio-binaries/mc

export PATH=$PATH:$HOME/minio-binaries/

To verify that everything is working do mc --help

After installing the MinIO Client you will need to add an alias for your storage node

You can do it with the following command

  • mc alias set myminio https://example.com ACCESS_KEY SECRET_KEY

You can then create a bucket with - mc mb myminio/mybucket

Upload a file to the bucket - mc cp /path/to/local/file myminio/mybucket

Download file from the bucket - mc cp myminio/mybucket/file /path/to/local/directory/

Download all files from the bucket - mc mirror myminio/mybucket /path/to/local/directory

List files in the bucket - mc ls myminio/mybucket

Conclusion


That’s it—your first steps into the world of MinIO! With this powerful storage solution, you can manage your data efficiently and enjoy its extensive capabilities.