CentOS 7.0:源码安装ossfs 备注:挂载目录性能下降,建议只用作同步,如将正式环境的用sync同步过来,然后挂载oss目录
yum install automake gcc-c++ git libcurl-devel libxml2-devel fuse-devel make openssl-devel
然后你可以从GitHub下载源代码并编译安装工具的代码:
git clone https://github.com/aliyun/ossfs.git
cd ossfs
./autogen.sh
./configure
make
sudo make install
如何获取AccessKeyId和AccessKeySecret
1登录阿里云控制台。
2将鼠标放在右上方的用户名区域,在弹出的快捷菜单中选择accesskeys。
3系统弹出安全提示对话框,单击继续使用AccessKey。页面显示AccessKeyId和AccessKeySecret。
将'my-bucket'存储桶挂载到'/ tmp / ossfs'目录,AccessKeyId为'faint',AccessKeySecret为'123',OSS端点为' http://oss-cn-hangzhou.aliyuncs.com '。重点备注一大坑,域名链接必须是Endpoint(地域节点)外网访问,否则无法挂载,同城可以使用内网域名ourl
echo my-bucket:faint:123 > /etc/passwd-ossfs
chmod 640 /etc/passwd-ossfs
mkdir /tmp/ossfs
ossfs my-bucket /tmp/ossfs -ourl=http://oss-cn-hangzhou.aliyuncs.com
ossfs my-bucket /home/ossfs -o nonempty -ourl=http://oss-cn-hangzhou.aliyuncs.com -o allow_other #正式环境
卸载挂载
umount /tmp/ossfs # root user
fusermount -u /tmp/ossfs # non-root user
rpm -qa | grep ossfs
rpm -e ossfs-1.79.8-1.x86_64
yum remove ossfs-* 卸载
您可以使用'ossfs --version'查看当前版本,使用'ossfs -h'查看可用参数
如果要允许其他用户访问和装入文件夹,可以在运行OSSFS时指定'allow_other'参数:
'ossfs your_bucket your_mount_point -ourl = your_endpoint -o allow_other'
2.yum安装ossfs简易版 https://help.aliyun.com/document_detail/32196.html
阿里云ossfs官网文档下载rpm包到本地,然后yum安装下载,
wget http://gosspublic.alicdn.com/ossfs/ossfs_1.80.5_centos7.0_x86_64.rpm?spm=a2c4g.11186623.2.13.5a037358J9M6FI&file=ossfs_1.80.5_centos7.0_x86_64.rpm
mv ossfs_package ossfs_package.rpm
yum localinstall ossfs_package.rpm
echo "jialiu:AccessKeyID:AccessKeySecret" > /etc/passwd-ossfs
chmod 640 /etc/passwd-ossfs
mkdir -p /home/ossfs
ossfs jialiu /home/ossfs -ourl=http://oss-cn-hangzhou.aliyuncs.com #ourl为地域节点
umount /home/ossfs #卸载挂载
yum remove ossfs-* #卸载ossfs