在本文中,我们将学习如何使用FreeNAS运行Minio。
- FreeNAS已经安装并运行,如果没有,请参考安装说明
- 你有一个FreeNAS Jail path set,如果没有,请参考jails configuration
在FreeNAS UI中找到Jails -> Add Jail
,点击 Advanced
,然后输入如下信息:
Name: Minio
Template: --- (unset, defaults to FreeBSD)
VImage: Unticked
为你的环境配置相关的网络设置。点击OK
,等待Jail下载并安装。
找到Jails -> View Jails -> Storage
,点击Add Storage
,然后输入如下信息:
Jail: Minio
Source: </path/to/your/dataset>
Destination: </path/to/your/dataset/inside/jail> (usually the same as 'Source' dataset for ease of use)
Read Only: Unticked
Create Directory: Ticked
下载Minio到jail:
curl -Lo/<jail_root>/Minio/usr/local/bin/minio https://dl.minio.io/server/minio/release/freebsd-amd64/minio
chmod +x /<jail_root>/Minio/usr/local/bin/minio
创建一个Minio服务的文件:
touch /<jail_root>/Minio/usr/local/etc/rc.d/minio
chmod +x /<jail_root>/Minio/usr/local/etc/rc.d/minio
nano /<jail_root>/Minio/usr/local/etc/rc.d/minio
添加下面的内容:
#!/bin/sh
# PROVIDE: minio
# KEYWORD: shutdown
# Define these minio_* variables in one of these files:
# /etc/rc.conf
# /etc/rc.conf.local
# /etc/rc.conf.d/minio
#
# DO NOT CHANGE THESE DEFAULT VALUES HERE
#
# Add the following lines to /etc/rc.conf to enable minio:
#
#minio_enable="YES"
#minio_config="/etc/minio"
minio_enable="${minio_enable-NO}"
minio_config="${minio_config-/etc/minio}"
minio_disks="${minio_disks}"
minio_address="${minio_address-:443}"
. /etc/rc.subr
load_rc_config ${name}
name=minio
rcvar=minio_enable
pidfile="/var/run/${name}.pid"
command="/usr/sbin/daemon"
command_args="-c -f -p ${pidfile} /usr/local/bin/${name} -C \"${minio_config}\" server --address=\"${minio_address}\" ${minio_disks}"
run_rc_command "$1"
编辑/<jail_root>/Minio/etc/rc.conf
:
nano /<jail_root>/Minio/etc/rc.conf
添加如下内容:
minio_enable="YES"
minio_config="/etc/minio"
minio_disks="</path/to/your/dataset/inside/jail>"
minio_address="<listen address / port>" (Defaults to :443)
mkdir -p /<jail_root>/Minio/etc/minio/certs
nano /<jail_root>/Minio/etc/minio/certs/public.crt
nano /<jail_root>/Minio/etc/minio/certs/private.key
在FreeNAS UI中找到找到Jails -> View Jails
,选择 Minio
,然后点击Start
按钮 (从左边开始第三个):
找到http(s)://<ip_address>:<port>
并确认Minio加载。