Installing and Using MinIO on Linux

MinIO is a high-performance cloud-native object storage solution that is compatible with the Amazon S3 API. Below is a detailed explanation of its installation and deployment on Linux systems.

Installing and Using MinIO on Linux

1. MinIO Installation Methods

Method 1: Direct Installation from Binary

  1. Download the latest version

bash

wget https://dl.min.io/server/minio/release/linux-amd64/miniochmod +x miniosudomv minio /usr/local/bin/
  1. Create Storage Directory and Start

bash

sudomkdir-p /opt/minio/datasudo ./minio server /opt/minio/data --console-address ":9001"

The default console port is 9001, and the API port is 9000.

Method 2: Docker Container Deployment

bash

docker run -d\-p9000:9000 -p9001:9001 \-v /mnt/minio/data:/data \-e"MINIO_ROOT_USER=admin"\-e"MINIO_ROOT_PASSWORD=your_password"\   minio/minio server /data --console-address ":9001"

2. System Service Configuration

  1. Create Dedicated User and Set Permissions

bash

sudouseradd-r minio-user -s /sbin/nologinsudochown-R minio-user:minio-user /opt/minio
  1. Create System Service File Create <span>/etc/systemd/system/minio.service</span>:

ini

[Unit]Description=MinIO Object StorageAfter=network.target[Service]User=minio-userGroup=minio-userExecStart=/usr/local/bin/minio server /opt/minio/data --console-address ":9001"Restart=always[Install]WantedBy=multi-user.target
  1. Start and Set to Auto-Start on Boot

bash

sudo systemctl daemon-reloadsudo systemctl enable miniosudo systemctl start miniosudo systemctl status minio  # Verify status

3. Firewall Configuration and Access

  1. Open Necessary Ports

bash

sudo firewall-cmd --permanent --add-port=9000/tcpsudo firewall-cmd --permanent --add-port=9001/tcpsudo firewall-cmd --reload
  1. Access Console via Browser

text

http://服务器IP:9001

Log in using the account and password set at startup (default minioadmin/minioadmin).

4. Basic Usage Practices

  1. Create Buckets and Upload Files

  • After logging into the console, click “Create Bucket” to create a bucket.

  • Upload test files using the “Upload” button.

  • Bucket policies can be set to enable public/private access.

  • Command Line Client Operations

  • bash

    # Install clientwget https://dl.min.io/client/mc/release/linux-amd64/mcchmod +x mc&amp;&amp;sudomvmc /usr/local/bin/# Configure connectionmcaliasset myminio http://localhost:9000 admin your_password# Create bucket and upload filemc mb myminio/my-bucketmccp document.pdf myminio/my-bucket

    5. Important Configurations for Production Environment

    1. TLS/SSL Certificate Configuration

    bash

    mc admin config set myminio cert_file=/path/to/public.crt key_file=/path/to/private.key
    1. Multi-Node Distributed Deployment It is recommended to have at least 4 nodes in a production environment, with each node’s startup command specifying the addresses of other nodes:

    bash

    minio server http://minio{1...4}.example.com/data
    1. Data Backup Strategy

    bash

    # Use mc mirror for cross-cluster synchronizationmc mirror --watch myminio/src-bucket myminio/dest-bucket

    6. Troubleshooting and Monitoring

    1. View Logs

    bash

    journalctl -u minio -f# View real-time logs
    1. Health Check Interface

    bash

    curl http://localhost:9000/minio/health/live
    1. Performance Monitoring Metrics MinIO automatically provides metrics in Prometheus format, which can be accessed via <span>http://localhost:9000/minio/v2/metrics/cluster</span>.

    By following the above steps, you have successfully set up the MinIO object storage service on a Linux system. Its simple architecture and compatibility with S3 make it an ideal choice for private cloud storage, big data analysis, and backup disaster recovery. In actual production, choose between single-node or distributed deployment based on business scale, and regularly perform data integrity checks.

    Leave a Comment