(root用户)
安装(版本发布页面:https://github.com/aliyun/ossfs/releases)
yum localinstall https://github.com/aliyun/ossfs/releases/download/v1.80.0/ossfs_1.80.0_centos7.0_x86_64.rpm
配置
echo my-bucket:my-access-key-id:my-access-key-secret > /etc/passwd-ossfs
修改文件权限为640
chmod 640 /etc/passwd-ossfs
挂载(各区域Endpoint对照表https://help.aliyun.com/document_detail/31837.html)
ossfs my-bucket my-mount-point -ourl=my-oss-endpoint
卸载(my-mount-point为你挂载到本地的目录)
umount my-mount-point
设置开机自启
1.在/etc/init.d/目录下建立文件ossfs,文件内容(需改为自己的信息):
ossfs your_bucket your_mountpoint -ourl=your_url -oallow_other
2.赋予可执行权限
chmod a+x /etc/init.d/ossfs
3.设置开机自启
chkconfig ossfs on
例:
bucket名为 test
Access Key ID为 aaaaa
Access Key Secret为 123456
挂载到/home/oss(需要先建立该文件夹)
oss和ecs都在华东2,则使用内网Endpoint(http://oss-cn-shanghai-internal.aliyuncs.com)
yum localinstall https://github.com/aliyun/ossfs/releases/download/v1.80.0/ossfs_1.80.0_centos7.0_x86_64.rpm
echo test:aaaaa:123456 > /etc/passwd-ossfs
ossfs test /home/oss -ourl=http://oss-cn-shanghai-internal.aliyuncs.com
echo ossfs test /home/oss -ourl=http://oss-cn-shanghai-internal.aliyuncs.com > /etc/init.d/ossfs
chmod a+x /etc/init.d/ossfs
chkconfig ossfs on
ossfs -omax_stat_cache_size=20000