【Linux】单节点单硬盘部署MinIO

1) 下载MinIO服务器文件

下载二进制文件

AMD64:

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

ARM64:

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

移动文件

chmod +x minio
sudo mv minio /usr/local/bin/

2) 创建系统启动服务文件

在 MinIO 主机上手动创建minio.service文件,路径为/usr/lib/systemd/system/

cd /usr/lib/systemd/system/
sudo touch minio.service

systemd 命令启动前,系统内部会检查 /etc/systemd/… 这个路径,是否存在启动系统文件,如果冲突请在/usr/lib/systemd/… 路径,找到对应文件,避免重复创建后的冲突

为了避免冲突或意外的配置选项,请确保该文件仅存在于 /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 用户和组身份运行。 您可以使用 groupadduseradd 命令创建用户和组. 以下示例创建用户、组并设置权限以访问MinIO预定用于存储的文件夹路径。 这些命令通常需要管理员 (sudo) 权限。

groupadd -r minio-user
useradd -M -r -g minio-user minio-user
chown minio-user:minio-user /mnt/disk1 /mnt/disk2 /mnt/disk3 /mnt/disk4

也可以直接将配置文件中将以下内容修改为当前的用户组

User=minio-user
Group=minio-user

3) 创建环境变量文件

在指定位置创建一个环境变量文件 /etc/default/minio. 对于Windows主机,请指定一个类似Windows风格的路径: C:\minio\config.

以下示例提供了一个启动的环境变量配置文件:

# 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=myminioadmin
MINIO_ROOT_PASSWORD=minio-secret-key-change-me

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

MINIO_VOLUMES="/mnt/data"

# MINIO_OPTS sets any additional commandline options to pass to the MinIO server.
# 例如, `--console-address :9001` sets the MinIO Console listen port
MINIO_OPTS="--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"

4) 启动MinIO服务

在本地主机上发出以下命令来启动 MinIO SNSD 部署即服务:

sudo systemctl start minio.service

使用以下命令确认服务是否在线和功能正常:

sudo systemctl status minio.service
journalctl -f -u minio.service

在这里插入图片描述

MinIO服务不会在主机重新启动时自动启动。 您必须使用 systemctl enable minio.service 将进程作为主机引导的一部分,在服务器重启的过程中该进程会自动重启,而不用再进行手动管理。

sudo systemctl enable minio.service

5) 连接到MinIO服务

您可以通过在首选的浏览器中输入MinIO服务器 Console控制台 中的任何主机名或IP地址来访问MinIO控制台,例如http://localhost:9001

登录MinIO的用户名和密码配置参数为 MINIO_ROOT_USERMINIO_ROOT_PASSWORD 这些配置可以在在容器指定的环境文件中进行修改。

在这里插入图片描述

您可以使用MinIO控制台进行一般管理任务,如身份和访问管理、指标和日志监控或服务器配置。每个MinIO服务器都包含其自己的嵌入式MinIO控制台。 如果您的本地主机防火墙允许外部访问控制台端口,则同一网络上的其他主机可以使用您的本地主机的IP地址或主机名访问控制台。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值