Linux上配置MinIO环境的实用步骤
一 环境准备与安装
sudo mkdir -p /data/minio/{bin,data,conf,logs}wget -P /data/minio/bin https://dl.min.io/server/minio/release/linux-amd64/miniochmod +x /data/minio/bin/minioecho 'export PATH=$PATH:/data/minio/bin' | sudo tee -a /etc/profile && source /etc/profile/data/minio/bin/minio --versionapt install minio 或 yum install minio),但生产环境更推荐二进制直装以便版本可控与升级便捷。二 单机版快速启动与访问
export MINIO_ROOT_USER=adminexport MINIO_ROOT_PASSWORD=YourStrongPass@123(建议长度≥12字符)./minio server /data/minio --console-address ":9001"nohup ./minio server /data/minio --console-address ":9001" > /data/minio/logs/minio.log 2>&1 &http://服务器IP:9001(使用上面设置的账号密码登录)curl http://localhost:9000/minio/health/live(应返回 {"status":"ok"})--console-address ":9001" 固定。三 以 systemd 托管并设置开机自启
/etc/default/minio
MINIO_ROOT_USER="admin"
MINIO_ROOT_PASSWORD="YourStrongPass@123"
MINIO_VOLUMES="/data/minio"
MINIO_OPTS="--address :9000 --console-address :9001"
/etc/systemd/system/minio.service
[Unit]
Description=MinIO Object Storage
Documentation=https://docs.min.io
After=network-online.target
Wants=network-online.target
[Service]
User=minio
Group=minio
EnvironmentFile=/etc/default/minio
ExecStart=/usr/local/bin/minio server $MINIO_OPTS $MINIO_VOLUMES
Restart=always
RestartSec=5s
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
sudo useradd -s /sbin/nologin -M miniosudo chown -R minio:minio /data/miniosudo systemctl daemon-reloadsudo systemctl enable --now miniosudo systemctl status miniojournalctl -u minio -f四 防火墙与网络访问
sudo firewall-cmd --permanent --add-port=9000/tcp --add-port=9001/tcp && sudo firewall-cmd --reloadsudo ufw allow 9000,9001/tcp五 安全加固与运维工具
sudo mkdir -p /etc/minio/certssudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout /etc/minio/certs/private.key -out /etc/minio/certs/public.crt -subj "/CN=$(hostname)"echo 'MINIO_OPTS="$MINIO_OPTS --certs-dir /etc/minio/certs"' | sudo tee -a /etc/default/miniosudo systemctl restart miniowget https://dl.min.io/client/mc/release/linux-amd64/mc && chmod +x mc && sudo mv mc /usr/local/bin/mc alias set myminio http://服务器IP:9000 admin 'YourStrongPass@123'mc ls myminio、mc mb myminio/mybucket、mc cp /path/file myminio/mybucket/--address :9000 --console-address :9001 启动,并通过 MINIO_VOLUMES 指定所有节点的卷地址列表。