一、安装
1.创建安装目录
mkdir -p /usr/local/soft/minio
2.下载文件
cd /usr/local/soft/minio
wget -q http://dl.minio.org.cn/server/minio/release/linux-amd64/minio
3.新建数据存储目录
mkdir -p /home/minio/data
4.授予可执行权限
chmod +x minio
5.设置账号密码
export MINIO_ACCESS_KEY=minioadmin
export MINIO_SECRET_KEY=minioadmin
6.后台启动,并打印日志
nohup ./minio server --address :9000 --console-address :9090 /home/minio/data > /home/minio/data/minio.log &
address 用于设置api调用端口
console-address用于设置控制台访问端口
7.防火墙开启端口
firewall-cmd --zone=public --add-port=9000/tcp --permanent
firewall-cmd --zone=public --add-port=9090/tcp --permanent
firewall-cmd --reload
8.查看控制台
二、注册服务
1.创建minio配置文件
vi /usr/local/soft/minio/minio.conf,内容如下:
MINIO_VOLUMES="/home/minio/data"
MINIO_OPTS="--address :9000 --console-address :9090"
MINIO_ROOT_USER="minioadmin"
MINIO_ROOT_PASSWORD="minioadmin"
2.在/etc/systemd/system目录下新建一个minio.service
vi /etc/systemd/system/minio.service,内容如下:
Unit]
Description=MinIO
Documentation=https://docs.min.io
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/usr/local/soft/minio/minio
[Service]
WorkingDirectory=/usr/local/soft/minio
EnvironmentFile=/usr/local/soft/minio/minio.conf
ExecStartPre=/bin/bash -c "if [ -z \"${MINIO_VOLUMES}\" ]; then echo \"Variable MINIO_VOLUMES not set in /opt/minio/conf/minio.conf\"; exit 1; fi"
ExecStart=/usr/local/soft/minio/minio server $MINIO_OPTS $MINIO_VOLUMES
# Let systemd restart this service always
Restart=always
# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65536
# Specifies the maximum number of threads this process can create
TasksMax=infinity
# Disable timeout logic and wait until process is stopped
TimeoutStopSec=infinity
SendSIGKILL=no
[Install]
WantedBy=multi-user.target
三、将服务设置为开机启动
systemctl enable minio
重新加载服务的配置文件
systemctl daemon-reload
启动/停止/重启服务
systemctl start minio
systemctl stop minio
systemctl restrat minio
查看服务状态
systemctl status minio