Install Server and Client Packages
# Install MinIO server package
rpm -ivh https://dl.minio.org.cn/server/minio/release/linux-amd64/minio-20230518000536.0.0.x86_64.rpm
# Install MinIO client package
rpm -ivh https://dl.minio.org.cn/client/mc/release/linux-amd64/mcli-20230518165900.0.0.x86_64.rpm
Define Environment Variibles for MinIO
Create /etc/default/mstorage with the following:
DATA_DIR="/mnt/storage"
LISTEN_ADDR=":9000"
CONSOLE_PORT=":9001"
ROOT_ID="superadmin"
ROOT_PASS="StrongPass!2024"
PUBLIC_ENDPOINT="http://<public_ip>:9000"
Prepare System User and Storage Path
# Add dedicated system user
useradd -r -s /sbin/nologin -d /mnt/storage -M mstorage
# Create storage directory
install -d -m 0750 -o mstorage -g mstorage /mnt/storage
# Set ownership for binaries and config
chown mstorage:mstorage /usr/local/bin/minio /usr/local/bin/mcli
chown mstorage:mstorage /etc/default/mstorage
chown -R mstorage:mstorage /mnt/storage
Configrue systemd Unit File
Edit /usr/lib/systemd/system/mstorage.service, ensuring these lines:
[Service]
User=mstorage
Group=mstorage
EnvironmentFile=/etc/default/mstorage
ExecStart=/usr/local/bin/minio server $DATA_DIR --address $LISTEN_ADDR --console-address $CONSOLE_PORT
Reload units and apply changes:
systemctl daemon-reexec
systemctl daemon-reload
Enable and Launch Service
systemctl enable --now mstorage
Access Web Console
Open http://<host_ip>:9001/ in a browser. Log in using ROOT_ID and ROOT_PASS defined earlier.
Configure and Operate via MinIO Client
Connect to the local server:
# Option 1: Provide credentials inline
mc alias set local http://<host_ip>:9000 superadmin StrongPass!2024 --api S3v4
# Option 2: Prompt for credentials
mc alias set local http://<host_ip>:9000 --api S3v4
Verify connection:
mc ls local
Create a bucket:
mc mb local/project-data
List buckets:
mc ls local
Upload objects:
mc cp ./app.tar.gz local/project-data/app/
mc cp ./jdk.tar.gz local/project-data/java/
Remove a folder recursively:
mc rm local/project-data/app --recursive --force
Delete a single object:
mc rm local/project-data/java/jdk.tar.gz
Remove a entire bucket forcibly:
mc rb local/project-data --force
Display known hosts:
mc config host list
Refer to the upstream template for advanced systemd integration:
https://github.com/minio/minio-service/tree/master/linux-systemd