Bootstrap

Minio配置https证书

1.安装启动minio

cd /usr/local/bin

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

#下载minio client
wget https://dl.minio.org.cn/client/mc/release/linux-amd64/mc

chmod +x mc minio


#验证
[root@localhost bin]# minio -v
minio version RELEASE.2024-10-02T17-50-41Z (commit-id=ded0b19d97bb9f73f4d78382eb131ff80003e272)
Runtime: go1.22.8 linux/amd64
License: GNU AGPLv3 - https://www.gnu.org/licenses/agpl-3.0.html
Copyright: 2015-2024 MinIO, Inc.



#创建数据存放目录
mkdir /data/miniodata

#创建密码存放文件
vim /etc/default/minio

#用户名和密码
MINIO_ROOT_USER=minioadmin
MINIO_ROOT_PASSWORD=minioadmin
#文件存储位置
MINIO_VOLUMES="/data/miniodata"
#控制台访问端口
MINIO_OPTS="--console-address :9001"

#加载环境变量
source /etc/default/minio

配置systemctl启动

vim /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]
Type=notify
WorkingDirectory=/usr/local/

#启动用户和用户组
User=root
Group=root
ProtectProc=invisible

#Minio密钥文件
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_VOLUMES  $MINIO_OPTS

Restart=always
LimitNOFILE=65535
MemoryAccounting=no
TasksMax=infinity
TimeoutStopSec=infinity
SendSIGKILL=no
SuccessExitStatus=0

[Install]
WantedBy=multi-user.target



#启动
[root@localhost ~]# systemctl start minio
[root@localhost ~]# netstat -tnlp|grep 9000
tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN      31456/minio         
tcp6       0      0 :::9000                 :::*                    LISTEN      31456/minio         
tcp6       0      0 ::1:9000                :::*                    LISTEN      31456/minio         
[root@localhost ~]# systemctl status  minio
● minio.service - MinIO
   Loaded: loaded (/usr/lib/systemd/system/minio.service; disabled; vendor preset: disabled)
   Active: active (running) since 一 2024-10-28 15:05:06 CST; 45s ago
     Docs: https://docs.min.io
  Process: 31453 ExecStartPre=/bin/bash -c if [ -z "${MINIO_VOLUMES}" ]; then echo "Variable MINIO_VOLUMES not set in /etc/default/minio"; exit 1; fi (code=exited, status=0/SUCCESS)
 Main PID: 31456 (minio)
   CGroup: /system.slice/minio.service
           └─31456 /usr/local/bin/minio server /data/miniodata --console-address :9001

10月 28 15:05:06 sone-gateway minio[31456]: MinIO Object Storage Server
10月 28 15:05:06 sone-gateway minio[31456]: Copyright: 2015-2024 MinIO, Inc.
10月 28 15:05:06 sone-gateway minio[31456]: License: GNU AGPLv3 - https://www.gnu.org/licenses/agpl-3.0.html
10月 28 15:05:06 sone-gateway minio[31456]: Version: RELEASE.2024-10-02T17-50-41Z (go1.22.8 linux/amd64)
10月 28 15:05:06 sone-gateway minio[31456]: API: http://192.168.10.20:9000  http://127.0.0.1:9000
10月 28 15:05:06 sone-gateway minio[31456]: WebUI: http://192.168.10.20:9001 http://127.0.0.1:9001
10月 28 15:05:06 sone-gateway minio[31456]: Docs: https://docs.min.io
10月 28 15:05:06 sone-gateway minio[31456]: WARN: Detected Linux kernel version older than 4.0 release, there are some known potential performa...rformance
10月 28 15:05:06 sone-gateway minio[31456]: WARN: Detected default credentials 'minioadmin:minioadmin', we recommend that you change these valu...variables
10月 28 15:05:06 sone-gateway systemd[1]: Started MinIO.
Hint: Some lines were ellipsized, use -l to show in full.


#访问
ip+9000

2.申请域名证书

申请免费证书我这里就不写了,过程很简单,域名映射,申请证书,很简单。

这里我用的是云服务器,证书申请的阿里免费证书,下载其他证书

将xxxxx.key重命名为private.key

将xxxxx.pem重命名为public.crt

因为minio只认识key和crt文件

将修改好的文件放置在/root/.minio/certs的目录下

3.修改启动文件并验证

修改hosts文件

vim /etc/hosts
192.168.x.x  xxx.com			#本机的内网ip 域名


修改环境变量文件

vim /etc/default/minio

#用户名和密码
MINIO_ROOT_USER=minioadmin
MINIO_ROOT_PASSWORD=minioadmin
#文件存储位置
MINIO_VOLUMES="/data/miniodata"
#控制台访问端口
MINIO_OPTS="--console-address :9001"
MINIO_OPTS_api="--address \"xxx.com:9000\""


#重新加载
source /etc/default/minio

修改system的minio.service

vim /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]
Type=notify
WorkingDirectory=/usr/local/

#启动用户和用户组
User=root
Group=root
ProtectProc=invisible

#Minio密钥文件
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_VOLUMES  $MINIO_OPTS_api $MINIO_OPTS 

Restart=always
LimitNOFILE=65535
MemoryAccounting=no
TasksMax=infinity
TimeoutStopSec=infinity
SendSIGKILL=no
SuccessExitStatus=0

[Install]
WantedBy=multi-user.target



#启动
systemctl daemon-reload
systemctl restart minio
systemctl status minio

访问验证

;