centos环境minio安装踩坑指南2023年7月30日
MinIO的安装踩坑指南
环境centos7
1. 安装MinIO官方文档 Binary下载 , 按照官网的路径配置比较快
下载minio
wget https://dl.min.io/server/minio/release/linux-amd64/minio
修改minio的权限
chmod +x minio
移动下载的文件 到此文件夹下
sudo mv minio /usr/local/bin/
2. 创建minio.service 放到/etc/systemd/system/ 目录下 推荐使用MobaXterm操作方便,可视化操作
[Unit]
Description=MinIO
Documentation=https://min.io/docs/minio/linux/index.html
Wants=network-online.target
After=network-online.target
# 指的是下载的压缩 minio 文件路径 最后一个指的是文件
AssertFileIsExecutable=/usr/local/bin/minio
# 添加用户和分组后面会操作无需改动
[Service]
WorkingDirectory=/usr/local
User=minio-user
Group=minio-user
# 此文件需要注释掉 不识别此标识
# ProtectProc=invisible
#环境配置 需要创建一个minio文件 位置在 /etc/default/ 下
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})
3. 创建环境变量 **minio 文件无后缀只是个文件类型, 位置在/etc/default/ **下
# 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.
# 注意自己创建的文件,权限设置为777要不然报 file access denied ; 用来存放minio上传的文件,也可自行设置路径
MINIO_VOLUMES="/mnt/data"
# 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 服务器的端口(默认为 9000)查看端口 ip addr list xxx/20的就是
MINIO_SERVER_URL="http://本地服务器ip:9000"
4. 启动程序, ** 通过 journalctl -f -u minio.service **命令实时查看输出日志情况.
# 配置完后重新加载
systemctl daemon-reload
#启动minio
systemctl start minio.service
# 查看运行状态
sudo systemctl status minio.service
# 开启日志查看
journalctl -f -u minio.service
关闭minio
# systemctl stop minio.service
#开启开机自启
systemctl enable minio.service
5. 连接minio ,运行成功后Console如下图 后面的ip地址后的端口添加到,安全组, 然后用公网ip+此端口访问minio的管理平台页面
下面的错误是 自己创建的data没有设置777权限,所以运行失败 ,一直调试好久,看着日志才能更好的定位问题;
Error: unable to rename (/mnt/data/.minio.sys/tmp -> /mnt/data/.minio.sys/tmp-old/47f17c32-df74-49d3-8151-a079655e2557) file access denied, drive may be faulty please investigate (*fmt.wrapError)