在CentOS环境下安装MinIO可以分为几个步骤,包括准备环境、下载和安装MinIO、配置MinIO服务、启动MinIO服务以及验证安装。以下是详细的步骤:
1. 环境准备
-
更新系统:
sudo yum update -y
-
安装依赖包:
sudo yum install -y wget unzip
-
创建目录和数据存储路径:
sudo mkdir -p /data/minio sudo chown -R $(whoami) /data/minio
2. 下载MinIO
-
下载MinIO二进制文件:
wget https://dl.min.io/server/minio/release/linux-amd64/minio
-
赋予执行权限:
chmod +x minio
3. 配置MinIO服务
-
创建Minio服务配置文件: 创建
/etc/systemd/system/minio.service
文件并添加以下内容:[Unit] Description=MinIO Server Documentation=https://min.io/docs/minio/linux/index.html Wants=network-online.target After=network-online.target AssertFileIsExecutable=/usr/local/bin/minio [Service] WorkingDirectory=/usr/local/minio User=minio Group=minio ProtectProc=invisible EnvironmentFile=-/etc/default/minio ExecStartPre=/bin/bash -c "if [ -z \"${MINIO_VOLUMES}\" ]; then echo \"Variable MINIO_VOLUMES not set in /etc/default/minio\"; exit 1; fi" ExecStart=/usr/local/bin/minio server $MINIO_OPTS $MINIO_VOLUMES Restart=always LimitNOFILE=65536 TasksMax=infinity TimeoutStopSec=infinity SendSIGKILL=no [Install] WantedBy=multi-user.target
-
创建环境变量文件: 创建
/etc/default/minio
文件并添加以下内容:MINIO_ROOT_USER=minioadmin MINIO_ROOT_PASSWORD=minioadmin MINIO_VOLUMES=/data/minio MINIO_OPTS="--console-address :9000"
4. 启动MinIO服务
-
启动MinIO服务:
sudo systemctl daemon-reload sudo systemctl start minio
-
设置开机自启动:
sudo systemctl enable minio
5. 验证安装
-
检查服务状态:
sudo systemctl status minio
-
使用
mc
命令行工具验证: 下载并安装mc
:wget https://dl.min.io/client/mc/release/linux-amd64/mc chmod +x mc sudo mv mc /usr/local/bin/
配置
mc
连接到MinIO服务器:./mc config host add your_alias minioadmin minioadmin
列出集群中的桶:
./mc ls