目录
一、介绍
二、环境信息
三、下载安装包
1、MinIO官网下载地址
2、选择版本
(1)MinIO Server
(2)MinIO Client
(3)MinIO SDK
四、MinIO SDK安装步骤
1、安装minio库
2、导入minio库报错:SyntaxError: future feature annotations is not defined
3、升级Python3
4、安装minio库
5、导入minio库正常
五、MinIO客户端服务端安装步骤
1、拷贝文件到安装目录
2、修改权限、所属用户、所属组
3、修改/etc/profile
4、启动服务端
5、WEB页面创建存储桶
6、命令行创建存储桶
(1)配置MinIO服务器的别名
(2)查看MinIO服务器的别名
(3)创建存储桶
(4)验证存储桶创建
(5)设置存储桶匿名访问策略
(6)查看存储桶匿名访问策略
六、配置开机自启服务
1、新建/etc/systemd/system/MinIO.service
2、设置MinIO环境变量
3、启用MinIO服务在系统启动时自动启动
4、启动MinIO服务
5、查看MinIO服务状态
一、介绍
MinIO 是一个高性能、兼容 S3 的对象存储。它专为大规模 AI/ML、数据湖和数据库工作负载而构建。它是软件定义的,可在任何云或本地基础架构上运行。MinIO 在开源 GNU AGPL v3 和商业企业许可证下获得双重许可。
二、环境信息
名称 | 值 |
CPU | Intel(R) Core(TM) i5-1035G1 CPU @ 1.00GHz |
操作系统 | CentOS Linux release 7.9.2009 (Core) |
内存 | 4G |
逻辑核数 | 4 |
MinIO版本 | minio version RELEASE.2024-06-13T22-53-53Z (commit-id=20960b6a2ddb9594ee418035b3c7c7fe92ae6a12) Runtime: go1.22.4 linux/amd64 License: GNU AGPLv3 - https://www.gnu.org/licenses/agpl-3.0.html Copyright: 2015-2024 MinIO, Inc. |
三、下载安装包
1、MinIO官网下载地址
MinIO安装包下载地址
2、选择版本
1)开源或企业版。
2)操作系统。
3)CPU架构。
4)安装包类型。
5)下载按钮。
(1)MinIO Server
(2)MinIO Client
(3)MinIO SDK
软件开发工具包没有C,我选择Python,这个大家可以根据自己需求进行下载,对于安装部署没有影响。
四、MinIO SDK安装步骤
不需要安装软件开发工具Python包的可以跳过此节。
1、安装minio库
[gbase@czg0 ~]$ pip3 install minio
Defaulting to user installation because normal site-packages is not writeable
Collecting minioDownloading minio-7.2.7-py3-none-any.whl (93 kB)|████████████████████████████████| 93 kB 107 kB/s
Requirement already satisfied: typing-extensions in /usr/local/lib/python3.6/site-packages (from minio) (4.1.1)
Requirement already satisfied: pycryptodome in /usr/local/lib64/python3.6/site-packages (from minio) (3.20.0)
Requirement already satisfied: argon2-cffi in /usr/local/lib/python3.6/site-packages (from minio) (21.3.0)
Requirement already satisfied: urllib3 in /usr/local/lib/python3.6/site-packages (from minio) (1.26.19)
Requirement already satisfied: certifi in /usr/local/lib/python3.6/site-packages (from minio) (2024.6.2)
Requirement already satisfied: dataclasses in /usr/local/lib/python3.6/site-packages (from argon2-cffi->minio) (0.8)
Requirement already satisfied: argon2-cffi-bindings in /usr/local/lib64/python3.6/site-packages (from argon2-cffi->minio) (21.2.0)
Requirement already satisfied: cffi>=1.0.1 in /usr/local/lib64/python3.6/site-packages (from argon2-cffi-bindings->argon2-cffi->minio) (1.14.6)
Requirement already satisfied: pycparser in /usr/local/lib/python3.6/site-packages (from cffi>=1.0.1->argon2-cffi-bindings->argon2-cffi->minio) (2.20)
Installing collected packages: minio
Successfully installed minio-7.2.7
2、导入minio库报错:SyntaxError: future feature annotations is not defined
[gbase@czg0 ~]$ python3
Python 3.6.8 (default, Nov 16 2020, 16:55:22)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import minio
Traceback (most recent call last):File "<stdin>", line 1, in <module>File "/home/gbase/.local/lib/python3.6/site-packages/minio/__init__.py", line 41, in <module>from .api import Minio as MinioFile "/home/gbase/.local/lib/python3.6/site-packages/minio/api.py", line 28from __future__ import absolute_import, annotations^
SyntaxError: future feature annotations is not defined
>>> quit()
报了一个语法错误,初步怀疑是python版本太低,我们升级一下Python版本试试。如果没有报错就跳过此步。
3、升级Python3
请参考之前的博客:《Linux-学习-06-Python3安装与卸载》
4、安装minio库
[root@czg0 Python-3.12.4]# pip3 install minio
Collecting minioDownloading minio-7.2.7-py3-none-any.whl.metadata (6.4 kB)
Collecting certifi (from minio)Downloading certifi-2024.6.2-py3-none-any.whl.metadata (2.2 kB)
Collecting urllib3 (from minio)Downloading urllib3-2.2.2-py3-none-any.whl.metadata (6.4 kB)
Collecting argon2-cffi (from minio)Downloading argon2_cffi-23.1.0-py3-none-any.whl.metadata (5.2 kB)
Collecting pycryptodome (from minio)Downloading pycryptodome-3.20.0-cp35-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.4 kB)
Collecting typing-extensions (from minio)Downloading typing_extensions-4.12.2-py3-none-any.whl.metadata (3.0 kB)
Collecting argon2-cffi-bindings (from argon2-cffi->minio)Downloading argon2_cffi_bindings-21.2.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.7 kB)
Collecting cffi>=1.0.1 (from argon2-cffi-bindings->argon2-cffi->minio)Downloading cffi-1.16.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB)
Collecting pycparser (from cffi>=1.0.1->argon2-cffi-bindings->argon2-cffi->minio)Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes)
Downloading minio-7.2.7-py3-none-any.whl (93 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 93.5/93.5 kB 476.6 kB/s eta 0:00:00
Downloading argon2_cffi-23.1.0-py3-none-any.whl (15 kB)
Downloading certifi-2024.6.2-py3-none-any.whl (164 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 164.4/164.4 kB 391.0 kB/s eta 0:00:00
Downloading pycryptodome-3.20.0-cp35-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.1 MB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 542.8 kB/s eta 0:00:00
Downloading typing_extensions-4.12.2-py3-none-any.whl (37 kB)
Downloading urllib3-2.2.2-py3-none-any.whl (121 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.4/121.4 kB 257.9 kB/s eta 0:00:00
Downloading argon2_cffi_bindings-21.2.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (86 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 86.2/86.2 kB 144.0 kB/s eta 0:00:00
Downloading cffi-1.16.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (477 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 477.6/477.6 kB 297.8 kB/s eta 0:00:00
Downloading pycparser-2.22-py3-none-any.whl (117 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 501.1 kB/s eta 0:00:00
Installing collected packages: urllib3, typing-extensions, pycryptodome, pycparser, certifi, cffi, argon2-cffi-bindings, argon2-cffi, minio
Successfully installed argon2-cffi-23.1.0 argon2-cffi-bindings-21.2.0 certifi-2024.6.2 cffi-1.16.0 minio-7.2.7 pycparser-2.22 pycryptodome-3.20.0 typing-extensions-4.12.2 urllib3-2.2.2
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv[notice] A new release of pip is available: 24.0 -> 24.1
[notice] To update, run: pip install --upgrade pip
5、导入minio库正常
[root@czg0 Python-3.12.4]# python3
Python 3.12.4 (main, Jun 22 2024, 21:10:08) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import minio
>>>
五、MinIO客户端服务端安装步骤
1、拷贝文件到安装目录
[root@czg0 GcdwPkg]# cp mc /opt/GCDW/MinIO/[root@czg0 GcdwPkg]# cp minio /opt/GCDW/MinIO/
2、修改权限、所属用户、所属组
[root@czg0 MinIO]# pwd
/opt/GCDW/MinIO[root@czg0 MinIO]# chown -R gbase:gbase /opt/GCDW[root@czg0 MinIO]# chmod -R 755 /opt/GCDW/[root@czg0 MinIO]# ll
总用量 126940
-rwxr-xr-x 1 gbase gbase 26800280 6月 23 17:12 mc
-rwxr-xr-x 1 gbase gbase 103178392 6月 23 17:13 minio
3、修改/etc/profile
添加内容如下,主要是为了方便调用MinIO相关命令。
export PATH=$PATH:/opt/GCDW/MinIO
生效配置文件
[root@czg0 MinIO]# . /etc/profile
4、启动服务端
[gbase@czg0 MinIO]$ nohup ./minio server Data &
[1] 116303
[gbase@czg0 MinIO]$ nohup: 忽略输入并把输出追加到"nohup.out"[gbase@czg0 MinIO]$ tail -f nohup.out
STARTUP WARNINGS:
- Detected Linux kernel version older than 4.0.0 release, there are some known potential performance problems with this kernel version. MinIO recommends a minimum of 4.x.x linux kernel version for best performance
- Detected default credentials 'minioadmin:minioadmin', we recommend that you change these values with 'MINIO_ROOT_USER' and 'MINIO_ROOT_PASSWORD' environment variables
- The standard parity is set to 0. This can lead to data loss.┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ You are running an older version of MinIO released 1 week before the latest release ┃
┃ Update: Run `mc admin update ALIAS` ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛[gbase@czg0 MinIO]$ ll
总用量 126944
drwxrwxr-x 3 gbase gbase 24 6月 23 17:33 Data
-rwxr-xr-x 1 gbase gbase 26800280 6月 23 17:12 mc
-rwxr-xr-x 1 gbase gbase 103178392 6月 23 17:13 minio
-rw------- 1 gbase gbase 1778 6月 23 17:33 nohup.out
我的操作系统内核版本比较低有性能问题,不过默默当作没看到。
5、WEB页面创建存储桶
登录http://你的IP:9000,登录用户和密码是默认的:minioadmin
选择Buckets->Create Bucket。
起一个只包含小写字符、下划线、点等的名字。其他的存储桶特征选项我就默认了,这里有几个概念介绍一下:
名称 | 描述 |
存储桶 | MinIO 使用存储桶来组织对象。存储桶类似于文件系统中的文件夹或目录,其中每个存储桶可以容纳任意数量的对象。 |
版本控制 | 允许将同一对象的多个版本保留在同一键下。 |
对象锁 | 可防止删除对象。需要支持保留和法定保留。只能在创建存储桶时启用。 |
配额 | 限制存储桶中的数据量。 |
保留 | 强制执行规则,以防止在一段时间内删除对象。必须启用版本控制才能设置存储桶保留策略。 |
创建成功。
6、命令行创建存储桶
(1)配置MinIO服务器的别名
[gbase@czg0 MinIO]$ mc config host add CzgMinIO0 http://192.168.142.10:9000 minioadmin minioadmin
Added `CzgMinIO0` successfully.
(2)查看MinIO服务器的别名
[gbase@czg0 MinIO]$ mc config host ls
CzgMinIO0URL : http://192.168.142.10:9000AccessKey : minioadminSecretKey : minioadminAPI : s3v4Path : autogcs URL : https://storage.googleapis.comAccessKey : YOUR-ACCESS-KEY-HERESecretKey : YOUR-SECRET-KEY-HEREAPI : S3v2Path : dnslocal URL : http://localhost:9000AccessKey : SecretKey : API : Path : autoplay URL : https://play.min.ioAccessKey : Q3AM3UQ867SPQQA43P2FSecretKey : zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TGAPI : S3v4Path : autos3 URL : https://s3.amazonaws.comAccessKey : YOUR-ACCESS-KEY-HERESecretKey : YOUR-SECRET-KEY-HEREAPI : S3v4Path : dns
(3)创建存储桶
[gbase@czg0 MinIO]$ mc mb CzgMinIO0/zxj.bucket
Bucket created successfully `CzgMinIO0/zxj.bucket`.[gbase@czg0 MinIO]$ ll Data/
总用量 0
drwxrwxr-x 2 gbase gbase 6 6月 23 18:15 czg.bucket
drwxrwxr-x 2 gbase gbase 6 6月 23 19:33 zxj.bucket
(4)验证存储桶创建
[gbase@czg0 MinIO]$ mc ls CzgMinIO0
[2024-06-23 18:15:59 CST] 0B czg.bucket/
[2024-06-23 19:33:30 CST] 0B zxj.bucket/
(5)设置存储桶匿名访问策略
MinIO的匿名访问策略允许未经身份验证的用户(即匿名用户)对存储桶中的对象进行读取或写入操作。这通常用于公共存储桶,其中数据被设计为任何人都可以访问,而无需提供任何密钥。
[gbase@czg0 MinIO]$ mc anonymous set public CzgMinIO0/zxj.bucket
Access permission for `CzgMinIO0/zxj.bucket` is set to `public`
(6)查看存储桶匿名访问策略
MinIO支持多种策略类型,包括none
(私有),download
(公共下载),upload
(公共上传),public
(公共读写),delete
(公共删除),以及自定义策略。
[gbase@czg0 MinIO]$ mc anonymous list CzgMinIO0/zxj.bucket
zxj.bucket/* => readwrite
六、配置开机自启服务
这一步选做。
1、新建/etc/systemd/system/MinIO.service
其中内容大家根据实际环境填写。
[root@czg0 package]# cat /etc/systemd/system/MinIO.service
[Unit]
Description=MinIO
After=network.target
Wants=network.target[Service]
User=gbase
Group=gbase
Type=simple
EnvironmentFile=-/etc/default/minio
ExecStart=/opt/GCDW/MinIO/minio server /opt/GCDW/MinIO/Data
Restart=on-failure
RestartSec=5[Install]
WantedBy=multi-user.target
2、设置MinIO环境变量
创建或编辑/etc/default/minio
文件,设置MinIO服务的环境变量。
[root@czg0 package]# cat /etc/default/minio
MINIO_ACCESS_KEY=minioadmin
MINIO_SECRET_KEY=minioadmin
3、启用MinIO服务在系统启动时自动启动
[root@czg0 package]# systemctl enable MinIO.service
Created symlink from /etc/systemd/system/multi-user.target.wants/MinIO.service to /etc/systemd/system/MinIO.service.
4、启动MinIO服务
[root@czg0 package]# systemctl start MinIO.service
5、查看MinIO服务状态
[root@czg0 package]# systemctl status MinIO.service
● MinIO.service - MinIOLoaded: loaded (/etc/systemd/system/MinIO.service; enabled; vendor preset: disabled)Active: active (running) since 日 2024-06-23 20:09:40 CST; 1min 25s agoMain PID: 6227 (minio)Tasks: 9Memory: 81.6MCGroup: /system.slice/MinIO.service└─6227 /opt/GCDW/MinIO/minio server /opt/GCDW/MinIO/Data6月 23 20:09:41 czg0 minio[6227]: API: http://192.168.142.10:9000 http://192.168.122.1:9000 http://127.0.0.1:9000
6月 23 20:09:41 czg0 minio[6227]: WebUI: http://192.168.142.10:18861 http://192.168.122.1:18861 http://127.0.0.1:18861
6月 23 20:09:41 czg0 minio[6227]: Docs: https://min.io/docs/minio/linux/index.html
6月 23 20:09:41 czg0 minio[6227]: Status: 1 Online, 0 Offline.
6月 23 20:09:41 czg0 minio[6227]: STARTUP WARNINGS:
6月 23 20:09:41 czg0 minio[6227]: - Detected Linux kernel version older than 4.0.0 release, there are some known potential performance problems with this kernel version....t performance
6月 23 20:09:41 czg0 minio[6227]: - Detected default credentials 'minioadmin:minioadmin', we recommend that you change these values with 'MINIO_ROOT_USER' and 'MINIO_ROO...ent variables
6月 23 20:09:41 czg0 minio[6227]: - The standard parity is set to 0. This can lead to data loss.
6月 23 20:09:42 czg0 minio[6227]: You are running an older version of MinIO released 1 week before the latest release
6月 23 20:09:42 czg0 minio[6227]: Update: Run `mc admin update ALIAS`
Hint: Some lines were ellipsized, use -l to show in full.