Setting Up MinIO as S3 Storage: A Comprehensive Guide 🚀

in #s325 days ago

MinIO is a high-performance, distributed object storage system that's compatible with Amazon S3 APIs. It's designed to handle large amounts of unstructured data, making it a perfect solution for modern data storage needs. In this guide, we'll walk you through the process of setting up MinIO as your S3 storage.

IMG_3927.png

Prerequisites 📝

Before you begin, ensure you have the following:

  • A Linux-based server.
  • Docker and Docker Compose installed.
  • Basic command line knowledge.

Step 1: Install Docker and Docker Compose 🐋

If Docker and Docker Compose are not already installed on your server, use the following script to install them:

#!/bin/bash

# Function to install Docker
install_docker() {
    echo "Installing Docker..."
    curl -fsSL https://get.docker.com -o get-docker.sh
    sh get-docker.sh
    sudo usermod -aG docker $USER
    rm get-docker.sh
    echo "Docker installed successfully."
}

# Function to install Docker Compose
install_docker_compose() {
    echo "Installing Docker Compose..."
    sudo curl -L "https://github.com/docker/compose/releases/download/v2.3.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
    sudo chmod +x /usr/local/bin/docker-compose
    echo "Docker Compose installed successfully."
}

# Check if Docker is installed
if ! [ -x "$(command -v docker)" ]; then
    install_docker
else
    echo "Docker is already installed."
fi

# Check if Docker Compose is installed
if ! [ -x "$(command -v docker-compose)" ]; then
    install_docker_compose
else
    echo "Docker Compose is already installed."
fi

echo "Please log out and log back in for Docker permissions to take effect if Docker was just installed."

Save this script as install_docker.sh, make it executable, and run it:

chmod +x install_docker.sh
./install_docker.sh

Step 2: Create the docker-compose.yml File 📦

The docker-compose.yml file defines the services that Docker will manage. Here's how you can set up MinIO using Docker Compose:

version: '3.3'

services:
  minio:
    image: minio/minio
    command: server /data
    ports:
      - "9000:9000"
    environment:
      MINIO_ROOT_USER: minioadmin
      MINIO_ROOT_PASSWORD: minioadmin
    volumes:
      - minio-data:/data

volumes:
  minio-data:

Step 3: Start MinIO Container 🚀

Start your Docker containers with the following command:

docker-compose up -d

This command runs your services in the background. Verify that your services are running:

docker ps

You should see a container running for MinIO.

Step 4: Access MinIO Dashboard 🌐

Open your web browser and navigate to http://<your-server-ip>:9000. You should see the MinIO login page.

Use the following default credentials to log in:

  • Access Key: minioadmin
  • Secret Key: minioadmin

Step 5: Create a Bucket 🗂️

Once logged in, you can create a new bucket:

  1. Click on the "Buckets" link.
  2. Click on the "Create Bucket" button.
  3. Enter a name for your bucket and click "Create".

Step 6: Use MinIO Client (Optional) 💻

MinIO provides a command-line client (mc) that you can use to interact with your MinIO server. You can install it by following these steps:

  1. Download the MinIO client:

    wget https://dl.min.io/client/mc/release/linux-amd64/mc
    
  2. Make the binary executable:

    chmod +x mc
    
  3. Move the binary to your PATH:

    sudo mv mc /usr/local/bin/
    
  4. Configure the client to connect to your MinIO server:

    mc alias set myminio http://<your-server-ip>:9000 minioadmin minioadmin
    
  5. You can now use the mc command to interact with your MinIO server. For example, to list all buckets:

    mc ls myminio
    
Sort:  

Congratulations, your post has been upvoted by @upex with a 0.80% upvote. We invite you to continue producing quality content and join our Discord community here. Keep up the good work! #upex

Coin Marketplace

STEEM 0.18
TRX 0.13
JST 0.029
BTC 57831.03
ETH 3136.64
USDT 1.00
SBD 2.42