Mac安装minio
本文介绍使用 mac 安装 MinIO。
所有软件安装优先参考官网:MinIO Object Storage for MacOS --- MinIO Object Storage for MacOS
bash
#使用 brew 安装 minio
brew install minio/stable/minio
#找到 minio
tong ~ $ brew list minio
/opt/homebrew/Cellar/minio/RELEASE.2024-03-26T22-10-45Z_1/bin/minio
#进入 minio,发现是目录
tong ~ $ cd /opt/homebrew/Cellar/minio/RELEASE.2024-03-26T22-10-45Z_1/bin/minio
cd: not a directory: /opt/homebrew/Cellar/minio/RELEASE.2024-03-26T22-10-45Z_1/bin/minio
#进入 minio 上一级
tong ~ $ cd /opt/homebrew/Cellar/minio/RELEASE.2024-03-26T22-10-45Z_1/bin/
#ll查看
tong /opt/homebrew/Cellar/minio/RELEASE.2024-03-26T22-10-45Z_1/bin (stable)$ ll
total 211136
drwxr-xr-x@ 3 tong admin 96B Mar 27 09:06 .
drwxr-xr-x@ 5 tong admin 160B Mar 27 09:09 ..
-r-xr-xr-x@ 1 tong staff 103M Mar 27 06:54 minio
#创建 data 存储目录
tong /opt/homebrew/Cellar/minio/RELEASE.2024-03-26T22-10-45Z_1/bin (stable)$ mkdir data
#给权限
tong /opt/homebrew/Cellar/minio/RELEASE.2024-03-26T22-10-45Z_1/bin (stable)$ chmod +x data
#启动 minio,报错
tong /opt/homebrew/Cellar/minio/RELEASE.2024-03-26T22-10-45Z_1/bin (stable)$ MINIO_ROOT_USER=admin MINIO_ROOT_PASSWORD=123456 ./minio server ./data --console-address ":9001"
#指定 账号 密码 当前可执行文件 server 存储路径 端口
#密码不符合规范
ERROR Unable to validate credentials inherited from the shell environment: Invalid credentials
> Please provide correct credentials
HINT:
Access key length should be at least 3, and secret key length at least 8 characters
#修改后,重新启动成功
tong /opt/homebrew/Cellar/minio/RELEASE.2024-03-26T22-10-45Z_1/bin (stable)$ MINIO_ROOT_USER=admin MINIO_ROOT_PASSWORD=12345678 ./minio server ./data --console-address ":9001"
Formatting 1st pool, 1 set(s), 1 drives per set.
WARNING: Host local has more than 0 drives of set. A host failure will result in data becoming unavailable.
MinIO Object Storage Server
Copyright: 2015-2024 MinIO, Inc.
License: GNU AGPLv3 <https://www.gnu.org/licenses/agpl-3.0.html>
Version: RELEASE.2024-03-26T22-10-45Z (go1.21.8 darwin/arm64)
API: http://192.168.0.46:9000 http://127.0.0.1:9000
RootUser: admin
RootPass: 12345678
WebUI: http://192.168.0.46:9001 http://127.0.0.1:9001
RootUser: admin
RootPass: 12345678
CLI: https://min.io/docs/minio/linux/reference/minio-mc.html#quickstart
$ mc alias set 'myminio' 'http://192.168.0.46:9000' 'admin' '12345678'
Docs: https://min.io/docs/minio/linux/index.html
Status: 1 Online, 0 Offline.
STARTUP WARNINGS:
- The standard parity is set to 0. This can lead to data loss.
浏览器访问:http://localhost:9001/login,输入账号密码登录
附:后台运行 minio,指定文件位置,指定端口号,指定输出日志路径,以及一键启动 minio脚本。
后台执行minio命令
bash
MINIO_ROOT_USER=admin MINIO_ROOT_PASSWORD=12345678 \
nohup /opt/homebrew/Cellar/minio/RELEASE.2024-03-26T22-10-45Z_1/bin/minio \
server /Users/tong/Environment/minio/miniodata \
--console-address ":9001" > minio.log 2>&1 &
这段脚本是用来启动 Minio 服务器的。让我逐步解释它的含义:
MINIO_ROOT_USER=admin
:设置 Minio 服务器的根用户为 "admin"。MINIO_ROOT_PASSWORD=12345678
:设置 Minio 服务器的根用户密码为 "12345678"。nohup
:这是一个命令,用于在后台运行指定的命令,并且忽略挂起信号。/opt/homebrew/Cellar/minio/RELEASE.2024-03-26T22-10-45Z_1/bin/minio
:指定 Minio 可执行文件的路径,用于启动 Minio 服务器。server /Users/tong/Environment/minio/miniodata
:告诉 Minio 启动服务器模式,并指定数据存储目录为 "/Users/tong/Environment/minio/miniodata"。--console-address ":9001"
:设置 Minio 控制台的地址为 ":9001",表示监听在本地 9001 端口上。> minio.log 2>&1
:将标准输出(stdout)重定向到名为 "minio.log" 的文件中,并将标准错误输出(stderr)重定向到标准输出。这样可以将所有输出都记录到 "minio.log" 文件中。&
:这个符号用于将整个命令放入后台运行。
综合起来,这个脚本的作用是以后台方式启动 Minio 服务器,使用指定的根用户和密码,数据存储目录为 "/Users/tong/Environment/minio/miniodata",并将所有输出记录到名为 "minio.log" 的文件中。
将脚本保存为minio.sh文件,上传至服务器,给权限 744 或者 777,注意这里所有用到的文件夹和文件统一都要给读写权限,miniodata,minio.sh
sh
tong ~/Environment $ vim minio.sh
tong ~/Environment $ ./minio.sh
tong ~/Environment $ sudo lsof -i:9001
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
minio 27608 tong 21u IPv6 0xd3a8cf22ccf4a4dd 0t0 TCP *:etlservicemgr (LISTEN)
tong ~/Environment $ ps aux | grep minio
tong 27663 0.0 0.0 408495824 1136 s006 R+ 11:09AM 0:00.00 grep --color=auto minio
tong 27608 0.0 1.6 412458448 275712 s006 S 11:09AM 0:00.43 /opt/homebrew/Cellar/minio/RELEASE.2024-03-26T22-10-45Z_1/bin/minio server /opt/homebrew/Cellar/minio/RELEASE.2024-03-26T22-10-45Z_1/bin/data --console-address :9001
如果文档对您有帮助,或者有疑问,欢迎私信交流学习!~