安装MinIO

进入MinIO官网,这一步可能要翻墙访问速度下会更好
https://min.io/download#/linux
image.png
在Architecture (CUP指令集)一栏下拉有 amd64、arm64、ppc64le、s390x
如果操作系统上是Architecture是x86_64或者amd64直接选择amd64(复杂指令集)、如果是arm64选择arm64(精简指令集)。ppc64le、s390x有待补充
查看CentOS7上CPU指令集
[root@jrpt-2 ~]# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 8
On-line CPU(s) list: 0-7
Thread(s) per core: 1
Core(s) per socket: 8
Socket(s): 1
NUMA node(s): 1
Vendor ID: HygonGenuine
CPU family: 24
Model: 0
Model name: Hygon Dhyana Processor (Cloudview)
Stepping: 1
CPU MHz: 1999.997
BogoMIPS: 3999.99
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 32K
L1i cache: 64K
L2 cache: 512K
L3 cache: 8192K
NUMA node0 CPU(s): 0-7
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm art rep_good nopl xtopology extd_apicid amd_dcm eagerfpu pni ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext retpoline_amd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 arat
服务器上显示是Architecture是x86_64,然后我们选择amd64,同时选择Binary二进制安装
image.png
我们将要下载的二进制文件放在 /opt/minio下面,
[root@jrpt-2 opt]# mkdir minio
[root@jrpt-2 opt]# cd minio/
[root@jrpt-2 minio]#
复制 wget https://dl.min.io/server/minio/release/linux-amd64/minio 命令进行下载
[root@jrpt-2 minio]# wget https://dl.min.io/server/minio/release/linux-amd64/minio
—2021-04-14 11:03:27— https://dl.min.io/server/minio/release/linux-amd64/minio
Resolving dl.min.io (dl.min.io)… 178.128.69.202
Connecting to dl.min.io (dl.min.io)|178.128.69.202|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 50716672 (48M) [application/octet-stream]
Saving to: ‘minio’

32% [=========================> ] 16,637,952 1.95MB/s eta 24s
等待下载完后增加二进制文件可执行权限
[root@jrpt-2 minio]# chmod +x minio

MinIO配置与管理脚本

然后用vim新增 minio服务管理脚本或者本地写好下面的脚本内容然后上传到/opt/minio目录下面。
[root@jrpt-2 minio]# vim minio.sh
复制以下sh内容,ACCESS_KEY、SECRET_KEY、MINIO_HOST、
MINIO_PORT 与其他参数根据需求自己修改。MINIO_HOST用127.0.0.1有些网络环境下面会用不了,最好通过ifconfig命令查看本机ip, 然后修改为本机ip
[root@jrpt-2 minio]# ifconfig
eth0: flags=4163 mtu 1500
inet 192.168.1.226 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::f816:3eff:fe27:7cd3 prefixlen 64 scopeid 0x20
ether fa:16:3e:27:7c:d3 txqueuelen 1000 (Ethernet)
RX packets 444396 bytes 875076472 (834.5 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 407134 bytes 48983455 (46.7 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73 mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1000 (Local Loopback)
RX packets 55 bytes 4791 (4.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 55 bytes 4791 (4.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
我的服务器本机ip是192.168.1.226,修改MINIO_HOST为192.168.1.226
minio.sh 脚本内容
#!/bin/sh
# chkconfig: 2345 67 92
# description: minio service#执行程序启动所使用的系统用户
RUNNING_USER=root
###################################
#环境变量及程序执行参数
###################################
MINIO_HOME=/opt/minio
MINIO_DATA_HOME=/opt/min-data
MINIO_LOGFILE=${MINIO_HOME}/minio.log
MINIO_HOST=192.168.1.226
MINIO_PORT=9090
#accesskey and secretkey
ACCESS_KEY=minio
SECRET_KEY=minio123
#初始化psid变量(全局)
psid=0
checkpid() {
pidps=ps -ef|grep ${MINIO_DATA_HOME}|grep -v grep
if [ -n “${pidps}” ]; then
psid=echo ${pidps} | awk '{print $2}'
else
psid=0
fi
}
###################################
#(函数)启动程序
###################################
start() {
checkpid
if [ ${psid} -ne 0 ]; then
echo “================================”
echo “warn: minio already started! (pid=${psid})”
echo “================================”
else
echo -n “Starting minio, data path: ${MINIO_DATA_HOME} …”
START_CMD=”MINIO_ACCESS_KEY=${ACCESS_KEY} MINIO_SECRET_KEY=${SECRET_KEY} nohup ${MINIO_HOME}/minio server —address “${MINIO_HOST}:${MINIO_PORT}” ${MINIO_DATA_HOME} > ${MINIO_LOGFILE} 2>&1 &”
su - ${RUNNING_USER} -c “${START_CMD}”
checkpid
if [ ${psid} -ne 0 ]; then
echo “(pid=$psid) [OK]”
else
echo “[Failed]”
fi
fi
}
###################################
#(函数)停止程序
###################################
stop() {
checkpid
if [ ${psid} -ne 0 ]; then
echo -n “Stopping minio …(pid=${psid}) “
su - ${RUNNING_USER} -c “kill -9 ${psid}”
if [ $? -eq 0 ]; then
echo “[OK]”
else
echo “[Failed]”
fi
checkpid
if [ ${psid} -ne 0 ]; then
stop
fi
else
echo “================================”
echo “warn: minio is not running”
echo “================================”
fi
}
###################################
#(函数)检查程序运行状态
###################################
status() {
checkpid

if [ ${psid} -ne 0 ]; then
echo “minio is running! (pid=${psid})”
else
echo “minio is not running”
fi
}
###################################
#读取脚本的第一个参数($1),进行判断
#参数取值范围:{start|stop|restart|status}
#如参数不在指定范围之内,则打印帮助信息
###################################
case “$1” in
‘start’)
start
;;
‘stop’)
stop
;;
‘restart’)
stop
start
;;
‘status’)
status
;;
*)
echo “Usage: $0 {start|stop|restart|status}”exit 1esac exit 0

如果vim复制时会出现乱码,按两下esc将vim由插入模式切换正常模型,再输入:将vim切换到命令模式,然后在命令模式下面输入q!放弃修改退出
[root@jrpt-2 minio]# echo $LANG
en_US.UTF-8
先修改linux系统默认字符集。
[root@jrpt-2 minio]# echo $LANG
en_US.UTF-8
当前为en_US.UTF-8,先看查系统支持中文件字符集再修改为中文。
[root@jrpt-2 minio]# locale -a | grep zh_CN
locale: Cannot set LC_CTYPE to default locale: No such file or directory
zh_CN
zh_CN.gb18030
zh_CN.gb2312
zh_CN.gbk
zh_CN.utf8
系统字符集修改为zh_CN.utf8
[root@jrpt-2 minio]# LANG=zh_CN.utf8
查看修改后的字符集
[root@jrpt-2 minio]# echo $LANG
zh_CN.utf8
启动MinIO服务
[root@jrpt-2 minio]# sh minio.sh start
Starting minio, data path: /opt/min-data …(pid=113754) [OK]
查看MinIO服务对应进程
[root@jrpt-2 minio]# ps -ef |grep minio| grep -v grep
root 113754 1 1 11:32 pts/1 00:00:01 /opt/minio/minio server —address 127.0.0.1:9090 /opt/min-data

浏览器访问MinIO服务

根据MinIO所在服务器对应的公网ip与影射的公网port访问MinIO服务,输入配置的Access Key 与 Secret Key 访问服务
image.png
点击MinIO Browser 右下脚的红色的+号操作,选择Create bucket 创建 bucket
image.png
创建名为default的bucket, 输入default后回车,在 MinIO Browser 左侧菜单栏将看到新创建的default的bucket
image.png
image.png
管理default bucket访问的权限
image.pngprefix代表default下面的某个目录,可以配置目录对应的是文件读取与写入权限
image.png