1、安装所需的一些工具
yum -y install automake fuse fuse-devel gcc-c++ git libcurl-devel libxml2-devel make openssl-devel
2、克隆s3fs-fuse到本地
git clone https://github.com/s3fs-fuse/s3fs-fuse.git
3、编译安装
cd /root/s3fs-fuse/
./autogen.sh
./configure && make && make install
echo AK:SK > /mnt/key
获取AK和SK的方法如下所示:
https://support.huaweicloud.com/usermanual-obs/zh-cn_topic_0074831620.html#
4、挂载桶
chmod 600 /mnt/key
mkdir /mnt/tong
s3fs 桶名 本地挂载目录 -o url=区域终端节点地址 -o endpoint=区域 挂载参数
其中:
区域名称 区域 终端节点
中国华北区1 cn-north-1 obs.cn-north-1.myhwclouds.com
中国华东区1 cn-east-2 obs.cn-east-2.myhwclouds.com
中国华南区1 cn-south-1 obs.cn-south-1.myhwclouds.com
5、查看是否挂载成功
cd /mnt/monitor/
ll
6、实现开机自动挂载obs
cd /etc
ll|grep rc.local
添加命令:
vi /etc/rc.local
# This script will be mount obs
cd /root/s3fs-fuse/
./autogen.sh
s3fs 桶名 本地挂载目录 -o url=区域终端节点地址 -o endpoint=区域 挂载参数
eg:s3fs mybucket /mnt/tong -o url=http://obs.cn-north-1.myhwclouds.com -o endpoint=cn-north-1 -o passwd_file=/mnt/key
7、常见异常
7.1、Error: Package: libquadmath-devel-4.8.5-11.el7.x86_64 (@base)
Requires: gcc = 4.8.5-11.el7
Removing: gcc-4.8.5-11.el7.x86_64 (@base)
gcc = 4.8.2-16.el7
gcc = 4.8.5-11.el7
Updated By: gcc-4.8.5-28.el7_5.1.x86_64 (updates)
gcc = 4.8.5-28.el7_5.1
gcc = 4.8.2-16.el7_5
Removing: gcc-4.8.5-28.el7.x86_64 (installed)
gcc = 4.8.2-16.el7
gcc = 4.8.5-28.el7
Updated By: gcc-4.8.5-28.el7_5.1.x86_64 (updates)
gcc = 4.8.5-28.el7_5.1
gcc = 4.8.2-16.el7_5
You could try using --skip-broken to work around the problem
解决办法:
yum -y install automake fuse fuse-devel gcc-c++ git libcurl-devel libxml2-devel make openssl-devel --skip-broken
7.2、clone错误:
yum update nss curl
7.3、yum清除缓存:
yum clean all
7.4、重新安装异常,无法安装
当执行删除操作时出现rm: cannot remove ‘/mnt/tong’: Is a directory这个提示
使用umount /mnt/tong