linux服务器Minio简易版OSS安装指南

学习 · 2023-09-17

前置

  1. 服务器一台
  2. minio安装包(国内镜像),下载对应版本的minio运行文件

配置文件

/etc/default 目录创建 minio 配置文件,如下:

配置文件不能有中文,请将下面中文提示删除

# MINIO_ROOT_USER and MINIO_ROOT_PASSWORD sets the root account for the MinIO server.
# This user has unrestricted permissions to perform S3 and administrative API operations on any resource in the deployment.
# Omit to use the default values 'minioadmin:minioadmin'.
# MinIO recommends setting non-default values as a best practice, regardless of environment

MINIO_ROOT_USER=minioadmim # 控制台账号
MINIO_ROOT_PASSWORD=minioadmin # 控制台密码

# MINIO_VOLUMES sets the storage volume or path to use for the MinIO server.

MINIO_VOLUMES="/www/wwwroot/minio"
MINIO_OPTS="--console-address :9001 --address :9000"
# MINIO_SERVER_URL sets the hostname of the local machine for use with the MinIO Server
# MinIO assumes your network control plane can correctly resolve this hostname to the local machine
MINIO_SERVER_URL="http://127.0.0.1:9000"

部署minio文件

部署之前先处理好服务配置文件,在/etc/systemd/system目录创建minio.service服务配置文件,如下:

配置文件不能有中文,请将下面中文提示删除

[Unit]
Description=MinIO
Documentation=https://min.io/docs/minio/linux/index.html
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/usr/local/bin/minio # minio运行文件所在位置

[Service]
WorkingDirectory=/usr/local

User=root # 运行的用户
Group=root # 运行的用户组
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 # 运行指令,记得路径一致不要错

# MinIO RELEASE.2023-05-04T21-44-30Z adds support for Type=notify (https://www.freedesktop.org/software/systemd/man/systemd.service.html#Type=)
# This may improve systemctl setups where other services use `After=minio.server`
# Uncomment the line to enable the functionality
# Type=notify

# 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

# Built for ${project.name}-${project.version} (${project.name})

部署minio, 将下载好的文件上传至服务配置内的目录,上面的配置路径是/usr/local/bin,所以就上传到这里

## 启动测试

./minio server /data

没问题咱就停止测试并重载服务配置 systemctl deamon-reload

服务启动

# 启动
systemctl start minio
# 停止
systemctl stop minio
# 查看
systemctl status minio
# 自启动
systemctl enable minio.service
# 取消自启动
systemctl disable minio.service
linux minio oss
Theme Jasmine by Kent Liao | 桂ICP备15008025号-6