本文档概述了在新的 CentOS服务器上安装 Minio 的过程。它提供了本文底部参考资料中的过程的更多细节。
# wget https://dl.minio.io/server/minio/release/linux-amd64/minio
# chmod 755 minio
# chown root:root minio
# mv minio /usr/local/bin
# firewall-cmd --zone=public --add-port=9000/tcp --permanent
# firewall-cmd --reload
# mkdir miniodir
# minio server miniodir
您应该会看到类似以下内容的内容(记录 AccessKey 和 SecretKey 以备后用):
Endpoint: http://192.168.1.81:9000 http://172.17.0.1:9000 http://127.0.0.1:9000
AccessKey: 5D0EN4B8SF7EYUJH1V8I
SecretKey: BjtgRNuLHBSEUU4e2Yzz/lBVjoFVnIvCr6rGFRXo
Browser Access:
http://192.168.1.81:9000 http://172.17.0.1:9000 http://127.0.0.1:9000
Command-line Access: https://docs.minio.io/docs/minio-client-quickstart-guide
$ mc config host add myminio http://192.168.1.81:9000 5D0EN4B8SF7EYUJH1V8I BjtgRNuLHBSEUU4e2Yzz/lBVjoFVnIvCr6rGFRXo
Object API (Amazon S3 compatible):
Go: https://docs.minio.io/docs/golang-client-quickstart-guide
Java: https://docs.minio.io/docs/java-client-quickstart-guide
Python: https://docs.minio.io/docs/python-client-quickstart-guide
JavaScript: https://docs.minio.io/docs/javascript-client-quickstart-guide
.NET: https://docs.minio.io/docs/dotnet-client-quickstart-guide
Drive Capacity: 38 GiB Free, 40 GiB Total
在您的 Windows 网络浏览器上,您现在应该能够通过网络浏览器访问主机,即
将 Git Bash shell 中的 AccessKey 和 SecretKey 复制并粘贴到浏览器中以登录。
完成后,返回 Git Bash 并使用 ^C 退出测试服务器并继续。
这允许 Minio 在系统重新启动时自动启动。
# useradd -r minio-user -s /sbin/nologin
# mkdir -p /data/minio/data
# chown minio-user:minio-user /data/minio/data
# cat <<EOT > /etc/default/minio
MINIO_ACCESS_KEY="AKaHEgQ4II0S7BjT6DjAUDA4BX"
MINIO_SECRET_KEY="SKFzHq5iDoQgF7gyPYRFhzNMYSvY6ZFMpH"
MINIO_VOLUMES="/data/minio/data/"
MINIO_OPTS="--address :9000"
MINIO_ROOT_USER="admin"
MINIO_ROOT_PASSWORD="password"
EOT
在 /etc/systemd/system 中创建一个名为 minio.service 的新文件,并在其中添加以下内容:
[Unit]
Description=Minio
Documentation=https://docs.minio.io
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/usr/local/bin/minio
[Service]
WorkingDirectory=/usr/local/
User=minio-user
Group=minio-user
PermissionsStartOnly=true
EnvironmentFile=-/etc/default/minio
ExecStartPre=/bin/bash -c "[ -n \"${MINIO_VOLUMES}\" ] || echo \"Variable MINIO_VOLUMES not set in /etc/default/minio\""
ExecStart=/usr/local/bin/minio server $MINIO_OPTS $MINIO_VOLUMES
StandardOutput=journal
StandardError=inherit
# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65536
# Disable timeout logic and wait until process is stopped
TimeoutStopSec=0
# SIGTERM signal is used to stop Minio
KillSignal=SIGTERM
SendSIGKILL=no
SuccessExitStatus=0
[Install]
WantedBy=multi-user.target
# systemctl enable minio
# systemctl start minio
# systemctl status minio
# systemctl stop minio
创建 Minio 集群,只需要按之前步骤配置4台一样配置的单节点,然后再按如下修改配置文件即可形成集群,注意4个节点的数据目录都需要为空,不能有单节点时目录下生成的文件
vi /etc/default/minio
MINIO_ACCESS_KEY="AKaHEgQ4II0S7BjT6DjAUDA4BX"
MINIO_SECRET_KEY="SKFzHq5iDoQgF7gyPYRFhzNMYSvY6ZFMpH"
#MINIO_VOLUMES="/data/minio/data/"
MINIO_VOLUMES="http://192.168.174.128:9000/data/minio/data http://192.168.174.133:9000/data/minio/data http://192.168.174.134:9000/data/minio/data http://192.168.174.135:9000/data/minio/data"
MINIO_OPTS="--address :9000"
MINIO_ROOT_USER="admin"
MINIO_ROOT_PASSWORD="password"
此时,您应该能够重新启动服务器并且 Minio 应该会自动启动。