如何在FreeNAS中运行Minio

在本文中,我们将学习如何使用FreeNAS运行Minio。

1. 前提条件

  • FreeNAS已经安装并运行,如果没有,请参考安装说明
  • 你有一个FreeNAS Jail path set,如果没有,请参考jails configuration

    2. 安装步骤

创建一个新的Jail

在FreeNAS UI中找到Jails -> Add Jail,点击 Advanced,然后输入如下信息:

  1. Name:Minio
  2. Template:---(unset, defaults to FreeBSD)
  3. VImage:Unticked

为你的环境配置相关的网络设置。点击OK,等待Jail下载并安装。

添加存储

找到Jails -> View Jails -> Storage,点击Add Storage,然后输入如下信息:

  1. Jail:Minio
  2. Source:</path/to/your/dataset>
  3. Destination:</path/to/your/dataset/inside/jail>(usually the same as'Source' dataset for ease of use)
  4. ReadOnly:Unticked
  5. CreateDirectory:Ticked

下载Minio

下载Minio到jail:

  1. curl -Lo/<jail_root>/Minio/usr/local/bin/minio https://dl.minio.io/server/minio/release/freebsd-amd64/minio
  2. chmod +x /<jail_root>/Minio/usr/local/bin/minio

创建Minio服务

创建一个Minio服务的文件:

  1. touch /<jail_root>/Minio/usr/local/etc/rc.d/minio
  2. chmod +x /<jail_root>/Minio/usr/local/etc/rc.d/minio
  3. nano /<jail_root>/Minio/usr/local/etc/rc.d/minio

添加下面的内容:

  1. #!/bin/sh
  2. # PROVIDE: minio
  3. # KEYWORD: shutdown
  4. # Define these minio_* variables in one of these files:
  5. # /etc/rc.conf
  6. # /etc/rc.conf.local
  7. # /etc/rc.conf.d/minio
  8. #
  9. # DO NOT CHANGE THESE DEFAULT VALUES HERE
  10. #
  11. # Add the following lines to /etc/rc.conf to enable minio:
  12. #
  13. #minio_enable="YES"
  14. #minio_config="/etc/minio"
  15. minio_enable="${minio_enable-NO}"
  16. minio_config="${minio_config-/etc/minio}"
  17. minio_disks="${minio_disks}"
  18. minio_address="${minio_address-:443}"
  19. ./etc/rc.subr
  20. load_rc_config ${name}
  21. name=minio
  22. rcvar=minio_enable
  23. pidfile="/var/run/${name}.pid"
  24. command="/usr/sbin/daemon"
  25. command_args="-c -f -p ${pidfile} /usr/local/bin/${name} -C \"${minio_config}\" server --address=\"${minio_address}\" ${minio_disks}"
  26. run_rc_command "$1"

配置Minio启动

编辑/<jail_root>/Minio/etc/rc.conf:

  1. nano /<jail_root>/Minio/etc/rc.conf

添加如下内容:

  1. minio_enable="YES"
  2. minio_config="/etc/minio"
  3. minio_disks="</path/to/your/dataset/inside/jail>"
  4. minio_address="<listen address / port>"(Defaults to :443)

创建Minio配置目录

  1. mkdir -p /<jail_root>/Minio/etc/minio/certs

创建Minio Private key和Public Key (可选,如果需要HTTPS并且minio_address设置成443端口)

  1. nano /<jail_root>/Minio/etc/minio/certs/public.crt
  2. nano /<jail_root>/Minio/etc/minio/certs/private.key

启动Minio Jail

在FreeNAS UI中找到找到Jails -> View Jails ,选择 Minio,然后点击Start按钮 (从左边开始第三个):

测试Minio

找到http(s)://<ip_address>:<port>并确认Minio加载。

原文: https://docs.minio.io/cn/how-to-run-minio-in-freenas.html