Linux

How to Install and Use MinIO for Object Storage on Ubuntu

How to Install and Use MinIO for Object Storage on Ubuntu

MinIO is a high-performance, open-source object storage solution designed for cloud-native applications. It provides an Amazon S3-compatible interface, making it easy to store and retrieve unstructured data such as photos, videos, log files, backups, and container images. In this article, we’ll guide you through the process of installing and using MinIO on an Ubuntu system.

Prerequisites
Before you begin, ensure that you have:

  • A server running Ubuntu 18.04 or later.
  • A non-root user with sudo privileges.
  • Access to the terminal or SSH client to connect to your server.

Step 1: Update the System
Start by updating your package list and upgrading your existing packages to their latest versions. Open a terminal and run the following commands:

sudo apt update
sudo apt upgrade -y

Step 2: Install Dependencies
MinIO requires a few dependencies to function properly. Install wget and curl if they are not already installed:

sudo apt install wget curl -y

Step 3: Download MinIO
You can download the latest MinIO server binary using the following command. As of this writing, the latest version is RELEASE.2024-01-01T00-00-00Z.

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

After downloading, make the MinIO binary executable:

chmod +x minio

Step 4: Move MinIO to a System Directory
Move the MinIO binary to /usr/local/bin to make it accessible from anywhere in the terminal:

sudo mv minio /usr/local/bin/

Step 5: Create a MinIO User and Directory
For security purposes, it is best to run MinIO as a non-root user. Create a user specifically for running MinIO:

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

Next, create a directory where MinIO will store its data. This directory will house all your object data:

sudo mkdir /usr/local/share/minio
sudo chown minio-user:minio-user /usr/local/share/minio

Step 6: Create a MinIO Configuration File
To easily manage MinIO, create a configuration file. Open a new file in /etc/default/minio with your preferred text editor (e.g., nano):

sudo nano /etc/default/minio

Add the following lines to configure MinIO:

# MinIO service configuration
MINIO_VOLUMES=/usr/local/share/minio
MINIO_USER=minio-user
MINIO_ACCESS_KEY=YOUR_ACCESS_KEY
MINIO_SECRET_KEY=YOUR_SECRET_KEY
MINIO_REGION=us-east-1
MINIO_OPTS=””

Replace YOUR_ACCESS_KEY and YOUR_SECRET_KEY with your desired credentials. Ensure these keys are kept secure as they will be used to access your MinIO instance.

Step 7: Create a Systemd Service File
To run MinIO as a service, create a systemd service file. Use the following command to create the file:

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

Add the following content to the file:

[Unit]
Description=MinIO
Documentation=https://docs.min.io
After=network.target

[Service]
User=minio-user
Group=minio-user
ExecStart=/usr/local/bin/minio server /usr/local/share/minio –address “:9000” –console-address “:9001”
Restart=always

[Install]
WantedBy=multi-user.target

Step 8: Start and Enable the MinIO Service
After saving the service file, start the MinIO service and enable it to start on boot:

sudo systemctl start minio
sudo systemctl enable minio

You can check the status of the MinIO service with the following command:

sudo systemctl status minio

If everything is set up correctly, you should see the service active and running.

Step 9: Access the MinIO Console
MinIO provides a web-based management console. You can access it by navigating to http://:9001 in your web browser. Log in using the access key and secret key you set earlier.

Step 10: Using MinIO
Now that MinIO is up and running, you can start uploading objects. You can use the MinIO client (mc) to interact with your MinIO server easily. First, download and install the mc tool:

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

Next, configure the MinIO client:

mc alias set myminio http://:9000 YOUR_ACCESS_KEY YOUR_SECRET_KEY

Now you can use the mc commands to manage your object storage. Here are a few common commands:

Create a bucket:

mc mb myminio/mybucket

Upload a file:

mc cp /path/to/file.txt myminio/mybucket

List objects in a bucket:

mc ls myminio/mybucket

MinIO Documentation 

Thank you for visiting our page! If you’re interested in exploring more articles about Linux systems and setting up a Samba File Server, feel free to check out the links below.

How to Set Up a Samba File Server on Ubuntu

 

Related Articles

Leave a Reply

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

Back to top button