一、下载minio服务端
# 下载服务端
wget https://dl.min.io/server/minio/release/linux-amd64/minio
# 将下载所得minio文件拷贝到指定文件夹并赋权
sudo cp minio /usr/local/bin/
sudo chmod +x /usr/local/bin/minio
二、设置对象存储位置
#创建一个存储目录
sudo mkdir /data
启动MinIO,并指定存储目录和访问地址
sudo minio server /data --console-address ":9099"
三、设置自启动
#将MinIO的配置统一写入一个配置文件
sudo nano /etc/default/minio
配置内容:
# 指定数据存储目录
MINIO_VOLUMES="/home/test-ubuntu2204/minio/data"
# 监听端口 -端口号不能一样
MINIO_OPTS="--address :9000 --console-address :9099"
# 老版本使用MINIO_ACCESS_KEY/MINIO_SECRET_KEY,新版本已不建议使用
# Access key (账号)
# MINIO_ACCESS_KEY="sdxhminio"
# Secret key (密码)
# MINIO_SECRET_KEY="sdxh7777"
# 新版本使用;指定默认的用户名和密码,其中用户名必须大于3个字母,否则不能启动-随意更改
MINIO_ROOT_USER="sdxhminio"
MINIO_ROOT_PASSWORD="sdxh7777"
# 区域值,标准格式是“国家-区域-编号”,
MINIO_REGION="cn-north-1"
# 域名
# MINIO_DOMAIN=minio.your_domain.com
创建minio.service
sudo nano /usr/lib/systemd/system/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/
ProtectProc=invisible
# 指向3.1节中的配置文件
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 (1M) 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
SuccessExitStatus=0
[Install]
WantedBy=multi-user.target
Alias=minio.service
保存退出–ctrl+x
# 重新加载服务配置文件,使服务生效
systemctl daemon-reload
# 将服务设置为开机启动
systemctl enable minio
# 服务立即启动
systemctl start minio
# 查看minio服务当前状态
systemctl status minio