linux系统安装s3fs,[CentOS] 使用s3fs-fuse挂载S3Bucket到本地分区

准备工作

1.创建接入S3 Bucket的IAM用户

2.创建S3 Bucket,赋予IAM用户读写S3 Bucket的权限

测试环境

Amazon AMI Linux

CentOS 7.5

s3fs

s3fs allows Linux and macOS to mount an S3 bucket via FUSE. s3fs preserves the native object format for files, allowing use of other tools like s3cmd.

STEP1. 安装s3fs-fuse相关依赖包

# install automake fuse fuse-devel gcc-c++ git \

libcurl-devel libxml2-devel make openssl-devel

# install automake fuse fuse-devel gcc-c++ git \

libcurl-devel libxml2-devel make openssl-devel

STEP2.下载s3fs-fuse,编译安装s3fs-fuse

# cd /usr/local/

# git clone https://github.com/s3fs-fuse/s3fs-fuse.git

# cd s3fs-fuse

# ./autogen.sh

# ./configure

# make

# make install

# cd /usr/local/

# git clone https://github.com/s3fs-fuse/s3fs-fuse.git

# cd s3fs-fuse

# ./autogen.sh

# ./configure

# make

# make install

使用包管理器安装

# CentOS

yum install -y epel-release

yum install -y s3fs-fuse

# Ubuntu

# apt-get install -y s3fs-fuse

# CentOS

yum install -y epel-release

yum install -y s3fs-fuse

# Ubuntu

# apt-get install -y s3fs-fuse

STEP3.创建访问s3的.passwd-s3fs认证文件,将IAM用户的认证access key和access secret写入s3fs-fuse的认证文件

# echo MYIDENTITY:MYCREDENTIAL > ~/.passwd-s3fs

# chmod 600 ~/.passwd-s3fs

# echo MYIDENTITY:MYCREDENTIAL > ~/.passwd-s3fs

# chmod 600 ~/.passwd-s3fs

STEP4.挂载S3存储桶到本地

# mkdir /mnt/s3bucket

# s3fs -o passwd_file=~/.passwd-s3fs -o endpoint=us-east-2 -o allow_other s3_bucket_name /mnt/s3bucket

# mkdir /mnt/s3bucket

# s3fs -o passwd_file=~/.passwd-s3fs -o endpoint=us-east-2 -o allow_other s3_bucket_name /mnt/s3bucket

STEP5.配置fstab,开机自动挂载分区

# vim /etc/fstab

/usr/local/bin/s3fs#s3_bucket_name:/path /mnt/s3bucket fuse allow_other,url=https://s3-us-east-2.amazonaws.com 0 0

# vim /etc/fstab

/usr/local/bin/s3fs#s3_bucket_name:/path /mnt/s3bucket fuse allow_other,url=https://s3-us-east-2.amazonaws.com 0 0

参考

https://github.com/s3fs-fuse/s3fs-fuse

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值