阿里云ECS安装ossfs
git clone https://github.com/aliyun/ossfs.git
cd ossfs
./autogen.sh
./configure
make
make install
出现如下错误:
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for common_lib_checking... no
configure: error: Package requirements (fuse >= 2.8.4 libcurl >= 7.0 libxml-2.0 >= 2.6) were not met:
No package 'fuse' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
解决办法,使用root用户安装
yum -y install libxml2-devel fuse fuse-* glib2 glib2-*
查看安装的fuse
rpm -qa |grep fuse
echo my-bucket:my-access-key-id:my-access-key-secret > /etc/passwd-ossfs
chmod 640 /etc/passwd-ossfs
mkdir /tmp/ossfs
将oss bucket mount到指定目录(ossfs my-bucket my-mount-point -ourl=my-oss-endpoint)
如果使用ossfs的机器是阿里云ECS,可以使用内网域名来避免流量收费和 提高速度:
ossfs my-bucket /tmp/ossfs -ourl=http://oss-cn-hangzhou-internal.aliyuncs.com
如果出现错误使用-f参数
完成后向/tmp/ossfs 拷贝文件测试,然后在阿里云控制台中查看文件是否上传到了指定的bucket中
参考: