本文分享在 Azure Linux 上安装并使用对象存储 RustFS 的过程。
关于 RustFS
RustFS 是一款用 Rust 语言编写的分布式存储系统,兼容 S3 协议,是 MinIO 的国产化平替。详情可以前往 RustFS 官网。目前,RustFS 支持二进制、Docker 安装方式,可以在 Linux、MacOS、Windows 上进行安装。下面分享在 Linux 上 安装并使用 RustFS 的过程。
环境准备
- 一台 Linux 服务器
本文使用的服务器是从 azure 上创建的,操作系统为 Ubuntu 22.04。
开始安装
使用 root 用户,在服务器上执行如下命令:
arduino
curl -O https://rustfs.com/install_rustfs.sh && bash install_rustfs.sh
会看到如下结果
less
curl -O https://rustfs.com/install_rustfs.sh && bash install_rustfs.sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6050 100 6050 0 0 26295 0 --:--:-- --:--:-- --:--:-- 26419
[INFO] All required commands are present.
[INFO] OS and architecture check passed: x86_64.
Please enter RustFS service port (default: 9000):
[INFO] Port 9000 is available.
Tip: You can use TAB for path completion.
Please enter data storage directory (default: /data/rustfs0):
[INFO] Data directory ready: /data/rustfs0.
[INFO] Log directory ready: /var/logs/rustfs.
[INFO] Downloading RustFS package...
--2025-07-13 01:15:57-- https://dl.rustfs.com/artifacts/rustfs/rustfs-x86_64-unknown-linux-musl.zip
Resolving dl.rustfs.com (dl.rustfs.com)... 220.181.167.213, 240e:904:800:2802:3::3fb
Connecting to dl.rustfs.com (dl.rustfs.com)|220.181.167.213|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 51166107 (49M) [application/zip]
Saving to: 'rustfs.zip'
rustfs.zip 100%[====================================================>] 48.79M 37.8MB/s in 1.3s
2025-07-13 01:15:59 (37.8 MB/s) - 'rustfs.zip' saved [51166107/51166107]
Archive: rustfs.zip
inflating: rustfs
[INFO] RustFS binary installed.
[INFO] systemd service file created.
[INFO] RustFS config file created.
Created symlink /etc/systemd/system/multi-user.target.wants/rustfs.service → /lib/systemd/system/rustfs.service.
[INFO] RustFS service enabled and started.
RustFS has been installed and started successfully!
Service port: 9000, Data directory: /data/rustfs0
最后会提示安装成功,并且服务端口为 9000。可以通过查看 rustfs 进程或者版本的方法来确认是否安装成功。
- 进程查看
yaml
systemctl status rustfs
● rustfs.service - RustFS Object Storage Server
Loaded: loaded (/lib/systemd/system/rustfs.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2025-07-13 01:16:01 UTC; 1h 30min ago
Docs: https://rustfs.com/docs/
Main PID: 12788 (rustfs)
Status: "Starting..."
Tasks: 7
Memory: 74.8M
CPU: 2.767s
CGroup: /system.slice/rustfs.service
└─12788 /usr/local/bin/rustfs /data/rustfs0
Jul 13 01:16:01 xiaomage systemd[1]: Starting RustFS Object Storage Server...
Jul 13 01:16:01 xiaomage systemd[1]: Started RustFS Object Storage Server.
-
版本查看
rustfs -V
rustfs 1.0.0-alpha.17
接着可以在服务器上使用 ip:9000 来访问 RustFS 服务:

使用默认的用户名 rustfsadmin
和密码 rustfsadmin
来登录控制台:

接下来分享使用方法。
开始使用 RustFS
创建存储桶(Bucket)
点击右上角的 Create Bucket 选项,输入 Bucket 名称。

点击创建即可创建成功:

上传文件
点击上述创建的 rustfs bucket,会看到如下界面:

选择上传文件/目录选项,选择要上传的文件即可。

可以看到上传进度:

上传成功后可以看到:

点击可以查看该文件的详情,比如在 RustFS Bucket 中的 URL
perl
http://your-ip:9000/rustfs-ob/attention-is-all-your-need.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=1C9PJY049C7S3KX33153%2F20250713%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250713T022534Z&X-Amz-Expires=3600&X-Amz-Security-Token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJwYXJlbnQiOiJydXN0ZnNhZG1pbiIsImV4cCI6MTc1MjQxNjEzOH0.w45TPfjGopkZ1oWqnfJU1vSnlwzyUtLvkTApBtJ9ZlSPLW6_QkT7nii7BSNFmLUPIfaiB-HJicLQmxVBRDZpug&X-Amz-Signature=b0a831d1a1e309a76c4a80156eca515bea661b396f6d8f136efb76505323bcbd&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject
通过 SDK 使用 RustFS
目前 RustFS 提供了 Java、Python、JavaScript SDK。可以通过 SDK 来对 RustFS 进行操作使用。下面通过 Python SDK 来创建 RustFS Bucket 并上传文件。
ini
import boto3
from botocore.client import Config
s3 = boto3.client(
's3',
endpoint_url='http://143.64.182.51:9000',
aws_access_key_id='rustfsadmin',
aws_secret_access_key='rustfsadmin',
config=Config(signature_version='s3v4'),
region_name='us-east-1'
)
bucket_name = 'rustfs-ob-2'
try:
s3.create_bucket(Bucket=bucket_name)
print(f'Bucket {bucket_name} created.')
except s3.exceptions.BucketAlreadyOwnedByYou:
print(f'Bucket {bucket_name} already exists.')
将上面的内容放入到一个 python 文件中,直接运行即可。可以看到 rustfs-ob-2 被创建成功。可以在 RustFS 控制台上看到:

可以使用如下代码下载存储在 rustfs-ob 中的 pdf 文件:
bash
s3.download_file('rustfs-ob', 'attention-is-all-your-need.pdf','attention-is-all-your-need.pdf')
print('File downloaded.')
关于 RustFS 的更多玩法,我们后面介绍!