CentOs上安装minio

MINIO安装

一、下载二进制文件

wget https://dl.minio.org.cn/server/minio/release/linux-amd64/minio

 

二、授权,并移动到指定目录

chmod +x minio

sudo mv minio /usr/local/bin/

 

二、创建服务文件

/usr/lib/systemd/system/minio.service

 

内容如下:

 

[Unit]

Description=MinIO

Documentation=https://minio.org.cn/docs/minio/linux/index.html

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

 

# 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.service 文件默认以 minio-user 用户和组身份运行。 您可以使用 groupadd 和 useradd``命令创建用户和组. 以下示例创建用户、组并设置权限以访问MinIO预定用于存储的文件夹路径。 这些命令通常需要管理员 (``sudo) 权限。

groupadd -r minio-user

useradd -M -r -g minio-user minio-user

 

创建文件存储目录

mkdir /home/minio

给目录授权为刚创建的用户

chown minio-user:minio-user /home/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=minioadmin

MINIO_ROOT_PASSWORD=minioadmin

 

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

 

MINIO_VOLUMES="/home/minio"

 

# MINIO_OPTS sets any additional commandline options to pass to the MinIO server.

# 例如, `--console-address :9001` sets the MinIO Console listen port

MINIO_OPTS="--address :9000 --console-address :9001"

 

# 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

 

# Uncomment the following line and replace the value with the correct hostname for the local machine and port for the MinIO server (9000 by default).

 

#MINIO_SERVER_URL="http://minio.example.net:9000"

 

 

五、启动服务

sudo systemctl enable minio.service

sudo systemctl start minio.service

 

六、查询服务是否正常

sudo systemctl status minio.service

journalctl -f -u minio.service

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章