centos7.8安装s3fs

197 阅读2分钟

一. 离线安装s3fs

1. 制作yum源

参见:制作centos本地yum源

2. 安装s3fs依赖

yum install gcc libstdc++-devel gcc-c++ fuse fuse-devel curl-devel libxml2-devel mailcap git automake make -y

yum install openssl-devel -y

3. 安装s3fs

上传安装包

下载地址:github.com/s3fs-fuse/s…

上传到目录:/root/s3fsPackages , 然后解压

mkdir -p /root/s3fsPackages

cd /root/s3fsPackages

tar -xvf s3fs-fuse-1.95.tar.gz

安装s3fs

cd /root/s3fsPackages/s3fs-fuse-1.95/

./autogen.sh

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

./configure --prefix=/usr  --with-openssl

make && make install

验证是否安装成功

s3fs -h

4. 挂载对象存储桶

创建对象存储桶的ak,sk信息

vi  /etc/passwd-s3fs

加入桶的ak,sk信息,中间用冒号分隔。

admin:adminadmin

修改配置文件权限

chmod  600 /etc/passwd-s3fs

挂载对象存储桶

# 创建挂载点
mkdir /mnt/oeos

# 挂载桶
s3fs oeosbucket /mnt/oeos -o curl=http://127.0.0.1:9000 -o use_path_request_style -o allow_other -o nomultipart -o max_write=131072 -o multireq_max=50

# 注释
# oeosbucket   | 对象存储桶名称
# /mnt/oeos    | 本地挂载点
# http://127.0.0.1:9000  | oeos对象存储租户地址
# -o use_path_request_style   | 表示以路径模式 (pathstyle)访问对象存储,而不是主机模式。
# -o allow_other  |  允许其他用户访问。如果是root用户挂载,非root用户也可访问
# -o nomultipart  | 
# -o max_write=131072  | 增加写入数据块的大小为128KB
# -o multireq_max=50   | 列出对象的并发线程数

5. nfs共享

安装nfs

yum  install  nfs-utils -y

导出nfs共享

vi /etc/exports

加入如下内容


/mnt/oeos *(rw,fsid=0,no_root_squash)

# rw   |  赋于读写权限
# fsid=0  |  使用root用户的id
# no_root_squash   | 使用非root用户挂载访问时,赋于root用户权限
# 

刷新配置、重启nfs

exportfs  -rv

systemctl status nfs-server

systemctl restart nfs-server

6. nfs客户端挂载访问

# 制作挂载点
mkdir /mnt/s3fs

# 挂载nfs服务
# 66.66.66.201   | 为nfs服务ip地址
mount -t  nfs  66.66.66.201:/mnt/oeos  /mnt/s3fs

参考:share.note.youdao.com/ynoteshare/…