VPS如何挂载对象存储

要将对象存储对接到 VPS,您可以按照以下步骤进行操作,通常使用 S3FS-FUSE 工具来挂载对象存储。以下是具体步骤:

步骤 1:安装 S3FS-FUSE

通过 SSH 登录到您的 VPS,并执行以下命令安装 S3FS-FUSE:

对于 Debian/Ubuntu 系统:

bashsudo apt-get update
sudo apt-get install build-essential git libfuse-dev libcurl4-openssl-dev libxml2-dev mime-support automake libtool pkg-config libssl-dev
git clone https://github.com/s3fs-fuse/s3fs-fuse
cd s3fs-fuse/
./autogen.sh
./configure --prefix=/usr --with-openssl
make
sudo make install

对于 CentOS/RHEL 系统:

bashsudo yum install gcc libstdc++-devel gcc-c++ fuse fuse-devel curl-devel libxml2-devel mailcap git automake make openssl-devel
git clone https://github.com/s3fs-fuse/s3fs-fuse
cd s3fs-fuse/
./autogen.sh
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
./configure --prefix=/usr --with-openssl
make
sudo make install

步骤 2:获取对象存储 API 信息

  1. 登录到您的对象存储提供商的控制面板(如 Wasabi、AWS S3 等)。
  2. 创建一个存储桶(Bucket),并记录下以下信息:
    • 访问密钥(Access Key)
    • 秘密密钥(Secret Key)
    • API 端点(Endpoint)

步骤 3:创建凭据文件

在 VPS 上创建一个凭据文件以存储您的访问密钥和秘密密钥:

bashecho "your_access_key:your_secret_key" > /etc/passwd-s3fs
chmod 600 /etc/passwd-s3fs

your_access_keyyour_secret_key 替换为您从对象存储提供商获取的实际值。

步骤 4:创建挂载点

创建一个目录作为挂载点,例如 /mnt/mybucket

bashmkdir /mnt/mybucket

步骤 5:挂载对象存储

使用 S3FS 挂载对象存储到您刚刚创建的挂载点:

bashs3fs your_bucket_name /mnt/mybucket -o passwd_file=/etc/passwd-s3fs -o url=https://your_api_endpoint -o allow_other -o use_path_request_style

your_bucket_name 替换为您的存储桶名称,your_api_endpoint 替换为您的 API 端点。

步骤 6:确保重启后自动挂载

要确保在系统重启后自动挂载,可以将挂载命令添加到 /etc/fstab 文件中。打开该文件并添加以下行:

texts3fs#your_bucket_name /mnt/mybucket fuse _netdev,allow_other,passwd_file=/etc/passwd-s3fs,url=https://your_api_endpoint,use_path_request_style 0 0

步骤 7:验证挂载

运行以下命令检查是否成功挂载:

bashdf -h

您应该能够看到 /mnt/mybucket 显示为已挂载的文件系统。

通过以上步骤,您可以成功将对象存储对接到您的 VPS,并像使用本地文件系统一样访问它。

Citations:

  1. https://www.vps911.com/vpsjc/1052.html
  2. https://wzfou.com/rclone-cos-fuse-ossfs/
  3. https://www.chz.one/2022/08/19/32-scwoss/
  4. https://www.vps911.com/vpsjc/1053.html
  5. https://blog.csdn.net/KH_FC/article/details/124915989
  6. https://wasabi.com
  7. https://www.cnblogs.com/AmazonwebService/p/17844238.html
  8. https://www.reddit.com/r/webhosting/comments/lzqpv3/is_wasabi_the_cheapest_object_storage/
  9. https://blog.csdn.net/awschina/article/details/134509866
  10. https://www.alibabacloud.com/tc/product/swas?_p_lc=1
  11. https://www.x-od.com/wasabi/
  12. https://www.zhihu.com/question/300550572
  13. https://www.vpsvsvps.com/discuss/a/1676472032247681024.html
  14. https://www.vpsss.net/7108.html
  15. https://aws.amazon.com/cn/what-is/vps/
  16. https://www.ywsj365.com/archives/jiang-jia-gu-wen-mian-fei-20g-dui-xiang-cun-chu-gua-zai-dao-ren-yi-vps
  17. https://www.hostwinds.cn/tutorials/how-to-mount-object-storage-to-a-vps-ubuntu-18-04
  18. https://wzfou.com/linode-object-storage/
  19. https://github.com/readloud/Awesome-Stars/blob/main/README.md
  20. https://blog.einverne.info/post/2023/02/rclone-mount-remote-storage-vps.html
  21. https://www.tencentcloud.com/zh/document/product/628/47386
  22. http://www.bilibili.com/read/cv33361756/
  23. https://www.vpsce.com/vps_wiki/QYqsjb.html
  24. https://wzfou.com/free-object-storage/
  25. https://zhujitips.com/1260
  26. https://support.huaweicloud.com/topic/135549-1-V/
  27. https://iweec.com/700.html
  28. https://uit.stanford.edu/storage/wasabi-cloud-storage
  29. https://zh.sharktech.net/s3/
  30. https://wasabi.com/solutions/cloud-computing
  31. https://wasabi.com/cloud-object-storage

留下评论