下载与启动

wget https://dl.minio.io/server/minio/release/linux-amd64/minio
chmod +x minio
./minio server /home/data

启动后会打印出AccessKey和SecretKey等信息

后台运行

nohup /usr/local/bin/minio server  /home/minio/data > /home/minio/data/minio.log 2>&1 &

自定义MINIO_ACCESS_KEY和MINIO_SECRET_KEY

export MINIO_ACCESS_KEY=jdminio
export MINIO_SECRET_KEY=lyc.123456
./minio server /home/data

自定义端口号

# 启动
./minio server --address IP:PORT /home/data
# 文件夹路径
export MINIO_VOLUMES="/home/minio/data"
# 后台启动
nohup ./minio server  /home/minio/data > /home/minio/data/minio.log 2>&1 &



````

### 服务器重启后启动minio 失败
> ERROR Unable to initialize server switching into safe-mode: Unable to handle encrypted backend for config, iam and policies: Credentials missing
```shell
# 源于初始化得数据文件夹内存在文件
# 解决方法:更换初始化文件夹,移动所有文件
cp -r /data/*  /home 

minio 上传下载文件失败

The difference between the request time and the server’s time is too large.

# 查看系统时间
date 
# 查看硬件时间
hwclock 
# 安装ntpdate工具
yum -y install ntp ntpdate
ntpdate cn.pool.ntp.org
# 同步时间
hwclock --systohc

设置开机自启 并保存账号密码

创建文件

vim /etc/default/minio

配置内容

MINIO_ACCESS_KEY="bfminio"
MINIO_SECRET_KEY="lyc.123456"
MINIO_VOLUMES="/mnt/data/miniodata/files/"
MINIO_OPTS="--address :9000"

创建minio.service

vim /etc/systemd/system/minio.service

配置内容

[Unit]	
Description=Minio
Documentation=https://docs.minio.io
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/mnt/data/miniodata/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=/mnt/data/miniodata/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 daemon-reload
systemctl enable minio.service   
systemctl start minio
systemctl status minio.service
systemctl stop minio