Blame

cd4110 Terry 2025-12-05 05:55:32 1
# Minio
2
440afc Terry 2025-12-05 06:12:56 3
## 安装
cd4110 Terry 2025-12-05 05:55:32 4
5
```
6
dpkg -i minio.deb
7
```
440afc Terry 2025-12-05 06:12:56 8
## 检查启动服务
9
10
检查文件:`/usr/lib/systemd/system/minio.service`
11
12
一般不用修改
13
14
```bash
15
[Unit]
16
Description=MinIO
17
Documentation=https://docs.min.io
18
Wants=network-online.target
19
After=network-online.target
20
AssertFileIsExecutable=/usr/local/bin/minio
21
22
[Service]
23
Type=notify
24
25
WorkingDirectory=/usr/local
26
27
User=minio-user
28
Group=minio-user
29
ProtectProc=invisible
30
31
EnvironmentFile=-/etc/default/minio
32
ExecStart=/usr/local/bin/minio server $MINIO_OPTS $MINIO_VOLUMES
33
34
# Let systemd restart this service always
35
Restart=always
36
37
# Specifies the maximum file descriptor number that can be opened by this process
38
LimitNOFILE=1048576
39
40
# Turn-off memory accounting by systemd, which is buggy.
41
MemoryAccounting=no
42
43
# Specifies the maximum number of threads this process can create
44
TasksMax=infinity
45
46
# Disable timeout logic and wait until process is stopped
47
TimeoutSec=infinity
48
49
# Disable killing of MinIO by the kernel's OOM killer
50
OOMScoreAdjust=-1000
51
52
SendSIGKILL=no
53
54
[Install]
55
WantedBy=multi-user.target
56
57
# Built for ${project.name}-${project.version} (${project.name})
58
59
```
60
## 创建相关用户与文件夹
61
62
```bash
63
root@xxx# groupadd -r minio-user
64
root@xxx# useradd -M -r -g minio-user minio-user
65
root@xxx# mkdir /data/miniodat
66
root@xxx# chown minio-user:minio-user /data/miniodata/
67
```
68
69
## 创建环境变量文件
70
71
`/etc/default/minio` 创建环境变量文件
72
73
```shell
74
# MINIO_ROOT_USER and MINIO_ROOT_PASSWORD sets the root account for the MinIO server.
75
# This user has unrestricted permissions to perform S3 and administrative API operations on any resource in the deployment.
76
# Omit to use the default values 'minioadmin:minioadmin'.
77
# MinIO recommends setting non-default values as a best practice, regardless of environment
78
79
MINIO_ROOT_USER=myminioadmin # 设置账号
80
MINIO_ROOT_PASSWORD=9piSt@J8BXoc6 # 设置密码
81
82
# MINIO_VOLUMES sets the storage volume or path to use for the MinIO server.
83
84
MINIO_VOLUMES="/data/miniodata" # 设置目录
85
86
# MINIO_OPTS sets any additional commandline options to pass to the MinIO server.
87
# For example, `--console-address :9001` sets the MinIO Console listen port
88
MINIO_OPTS="--console-address :9001"
89
```
90
91
## 启动服务
92
93
在本地主机上发出以下命令来启动 MinIO SNSD 部署即服务:
94
```
95
systemctl start minio.service
96
```
97
98
使用以下命令确认服务是否在线和功能正常:
99
100
```
101
sudo systemctl status minio.service
102
journalctl -f -u minio.service
103
```
104
105
106
使用 `systemctl enable minio.service` 将进程作为主机引导的一部分,在服务器重启的过程中该进程会自动重启,而不用再进行手动管理。
107
```
108
systemctl enable minio.service
109
```
110
111
112
journalctl 的显示输出的样例如下面展示的内容:
113
114
```
115
Status: 1 Online, 0 Offline.
116
API: http://192.168.2.100:9000 http://127.0.0.1:9000
117
RootUser: myminioadmin
118
RootPass: minio-secret-key-change-me
119
Console: http://192.168.2.100:9090 http://127.0.0.1:9090
120
RootUser: myminioadmin
121
RootPass: minio-secret-key-change-me
122
123
Command-line: https://minio.org.cn/docs/minio/linux/reference/minio-mc.html
124
$ mc alias set myminio http://10.0.2.100:9000 myminioadmin minio-secret-key-change-me
125
126
Documentation: https://minio.org.cn/docs/minio/linux/index.html
127
```