skip to content
Jiaxin的仓库
Table of Contents

配置minIO的教程点击这一篇文章

下载安装rclone

你可以从rclone官网了解更多信息

如果你使用的是macOS,或者linux,可以直接使用下面的命令行安装

Terminal window
sudo -v ; curl https://rclone.org/install.sh | sudo bash

如果你在macOS安装了homebrew,你可以使用

Terminal window
brew install rclone

如果是windows,直接使用安装包安装就可以了。

安装好之后,可以在终端中查看是否安装成功

➜ ~ rclone version
rclone v1.63.1
- os/version: darwin 14.2 (64 bit)
- os/kernel: 23.2.0 (arm64)
- os/type: darwin
- os/arch: arm64 (ARMv8 compatible)
- go/version: go1.20.6
- go/linking: dynamic
- go/tags: cmount

开始配置

然后根据rclone官方的配置教程, 你可以直接进行配置。 下面我简单演示一下操作的具体步骤和注意事项

1. 进入rclone CLI

首先在命令行输入rclone config,开始配置

➜ ~ rclone config
Current remotes:
Name Type
==== ====
b2 b2
up s3
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> n

2. 新建远程储存桶

如果你之前有配置过,你的桶会显示在列表中。如果没有配置过,直接输入n开始配置新的桶。这里你需要给你的桶设定一个储存在rclone下的名字。和你的远程minIO桶没有任何关系,只是为了rclone的记录。

Enter name for new remote.
name> minio

3. 选择S3协议

输入名字之后,需要你选择具体的储存桶协议,这里我们选择5。因为配置minIO的时候,我们需要走S3兼容。

5 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, ArvanCloud, Ceph, China Mobile, Cloudflare, GCS, DigitalOcean, Dreamhost, Huawei OBS, IBM COS, IDrive e2, IONOS Cloud, Liara, Lyve Cloud, Minio, Netease, Petabox, RackCorp, Scaleway, SeaweedFS, StackPath, Storj, Tencent COS, Qiniu and Wasabi
\ (s3)
Storage> 5

4. 选择minIO运营商

完成协议选择之后,我们需要选择具体的运营商。这里我们直接输入16,选择minIO。

16 / Minio Object Storage
\ (Minio)
provider> 16

5.跳过环境变量

接下来按照步骤,env_auth直接回车跳过,或者输入1

Option env_auth.
Get AWS credentials from runtime (environment variables or EC2/ECS meta data if no env vars).
Only applies if access_key_id and secret_access_key is blank.
Choose a number from below, or type in your own boolean value (true or false).
Press Enter for the default (false).
1 / Enter AWS credentials in the next step.
\ (false)
2 / Get AWS credentials from the environment (env vars or IAM).
\ (true)
env_auth>

6. 输入access_key 和 secret_key

然后在access_key_id中,直接复制粘贴你从webUI中获取的access ID

Option access_key_id.
AWS Access Key ID.
Leave blank for anonymous access or runtime credentials.
Enter a value. Press Enter to leave empty.
access_key_id> 1

再输入你的secret_id

Option secret_access_key.
AWS Secret Access Key (password).
Leave blank for anonymous access or runtime credentials.
Enter a value. Press Enter to leave empty.
secret_access_key> 1

7. 自定义地区设置

如果你在minIO中没有自定义过地区的话,这一步直接回车跳过

Option region.
Region to connect to.
Leave blank if you are using an S3 clone and you don't have a region.
Choose a number from below, or type in your own value.
Press Enter to leave empty.
/ Use this if unsure.
1 | Will use v4 signatures and an empty region.
\ ()
/ Use this only if v4 signatures don't work.
2 | E.g. pre Jewel/v10 CEPH.
\ (other-v2-signature)
region>

8. 输入API endpoint

接下来最重要的一个步骤是输入你的minIO API的链接,这里只需要把你之前设置的API带上HTTPS放进来就可以了。之前的例子中,我设置的是minioapi.abc.com,那么这里的endpoint应该输入https://minioapi.pjx.ac.cn

Option endpoint.
Endpoint for S3 API.
Required when using an S3 clone.
Enter a value. Press Enter to leave empty.
endpoint> https://minioapi.pjx.ac.cn

9. 跳过地区设置

Option location_constraint.
Location constraint - must be set to match the Region.
Leave blank if not sure. Used when creating buckets only.
Enter a value. Press Enter to leave empty.
location_constraint>

10. 选择储存桶的访问模式

这里需要注意,如果你的储存桶设置为私有private, 那么这里你可能会遇到拒绝访问的请求。所以一个比较妥协的办法就是在webUI中将你的储存桶设置为public-read,例如: image.png

然后你在rclone中配置acl的时候直接选择2 public-read,应该就不会遇到访问错误的问题了。

Option acl.
Canned ACL used when creating buckets and storing or copying objects.
This ACL is used for creating objects and if bucket_acl isn't set, for creating buckets too.
Choose a number from below, or type in your own value.
Press Enter to leave empty.
/ Owner gets FULL_CONTROL.
1 | No one else has access rights (default).
\ (private)
/ Owner gets FULL_CONTROL.
2 | The AllUsers group gets READ access.
\ (public-read)
/ Owner gets FULL_CONTROL.
3 | The AllUsers group gets READ and WRITE access.
| Granting this on a bucket is generally not recommended.
\ (public-read-write)
/ Owner gets FULL_CONTROL.
4 | The AuthenticatedUsers group gets READ access.
\ (authenticated-read)
/ Object owner gets FULL_CONTROL.
5 | Bucket owner gets READ access.
| If you specify this canned ACL when creating a bucket, Amazon S3 ignores it.
\ (bucket-owner-read)
/ Both the object owner and the bucket owner get FULL_CONTROL over the object.
6 | If you specify this canned ACL when creating a bucket, Amazon S3 ignores it.
\ (bucket-owner-full-control)
acl> 2

11. 跳过加密模式

Option server_side_encryption.
The server-side encryption algorithm used when storing this object in S3.
Choose a number from below, or type in your own value.
Press Enter to leave empty.
1 / None
\ ()
2 / AES256
\ (AES256)
3 / aws:kms
\ (aws:kms)
server_side_encryption>
Option sse_kms_key_id.
If using KMS ID you must provide the ARN of Key.
Choose a number from below, or type in your own value.
Press Enter to leave empty.
1 / None
\ ()
2 / arn:aws:kms:*
\ (arn:aws:kms:us-east-1:*)
sse_kms_key_id>

12. 高级配置选项

如果你有进阶需求,选择自行设置。但一般来讲,到这里就赢可以正常使用了,直接选择n就可以了。

Edit advanced config?
y) Yes
n) No (default)
y/n> n

13. 保存配置

在这一步,你可以看到看到你之前配置的信息,如果没有问题,直接y保存就可以了。

Configuration complete.
Options:
- type: s3
- provider: Minio
- access_key_id: 1
- secret_access_key: 1
- endpoint: https://minioapi.pjx.ac.cn
- acl: public-read
Keep this "min" remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y

14.测试

配置完成之后,你随便找一张照片测试一下你的配置是否有问题。输入以下代码

注意这里的bucketname是你的minIO桶的名字,不是你在rclone中设置的名字。

如果没有返回错误,那就说明成功了

Terminal window
~ rclone copy /path/to/test.jpg minio:bucketname/folder
~