centos7 安装minio

1. 下载安装包
# 没有wget的自行安装,命令如下yum -y installwget# 其实就是把minio可执行文件下载到/usr/local/bin/目录下并添加可执行权限wgethttps://dl.min.io/server/minio/release/linux-amd64/minio -O /usr/local/bin/minio &&chmod777 /usr/local/bin/minio
# 这里如果下载不下来就自己再/usr/local/bin/minio 目录下创建个,内容如下
2. 设置开机自启动
# 官方提供的wgethttps://raw.githubusercontent.com/minio/minio-service/master/linux-systemd/minio.service -O /usr/lib/systemd/system/minio.service
#编辑minio.service文件:vim /usr/lib/systemd/system/minio.service
# 把其中的User和Group都注释掉(当然也可以创建一个用户和组填进去):#User=minio-user#Group=minio-usersystemctl daemon-reload
minio.service 如下
[Unit]Description=MinIO
Documentation=https://docs.min.io
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/usr/local/bin/minio
[Service]WorkingDirectory=/usr/local/
User=minio-user
Group=minio-user
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# Let systemd restart this service alwaysRestart=always
# Specifies the maximum file descriptor number that can be opened by this processLimitNOFILE=65536
# Disable timeout logic and wait until process is stoppedTimeoutStopSec=infinity
SendSIGKILL=no
[Install]WantedBy=multi-user.target
# Built for ${project.name}-${project.version} (${project.name})
3. 配置
填写minio配置文件
由于我们使用systemctl来管理minio的启动,所以配置要被minio.service调用。
编辑minio的配置文件(这个文件是在minio.service中的这句EnvironmentFile=/etc/default/minio中被调用的):
vim /etc/default/minio
#### 将一下内容复制进去# 指定数据存储目录(注意这个目录要存在)MINIO_VOLUMES="/data/minio"# 指定监听端口(也可以不监听具体ip,只写 :59999即可)MINIO_OPTS="--address 127.0.0.1:59999"# Access key,相当于账号MINIO_ACCESS_KEY="admin"# Secret key,相当于密码MINIO_SECRET_KEY="你的密码"# 区域值,这是完全自己写的,比如你愿意的话写“abcd”也行,但标准格式是“国家-区域-编号”,# 如“中国-华北-1号”就可写成“cn-north-1”,又比如“美国-西部-2号”可写成“us-west-1”MINIO_REGION="cn-south-1"# 域名MINIO_DOMAIN=minio.xxx.com
其中的参数自己看着修改,比如数据存储目录你想放其它地方,就自己修改,但要保证所指定的目录是存在的,域名MINIO_DOMAIN要与nginx反向代理的域名一致。


[Unit]
Description=MinIO
Documentation=https://docs.min.io
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/usr/local/bin/minio
[Service]
WorkingDirectory=/usr/local/
User=minio-user
Group=minio-user
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
# Let systemd restart this service always
Restart=always
# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=1048576
# 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
# Built for ${project.name}-${project.version} (${project.name})