wget http://docs-aliyun.cn-hangzhou.oss.aliyun-inc.com/assets/attach/32196/cn_zh/1463121229943/ossfs_1.79.8_centos7.0_x86_64.rpm
sudo yum localinstall ossfs_1.79.8_centos7.0_x86_64.rpm
将image这个bucket挂载到/mnt/ossfs目录下,AccessKeyId是faint, AccessKeySecret是123,oss endpoint是http://oss-cn-hangzhou.aliyuncs.com。html
注意centos
若是你是阿里云的ecs,endpoint能够使用内网地址,例如http://oss-cn-hangzhou-internal.aliyuncs.com,减小流量费用。 更多的内网地址可参考:https://help.aliyun.com/document_detail/31837.html?spm=5176.2020520105.0.0.1QhBJ1
实例:优化
# echo image:faint:123 > /etc/passwd-ossfs # chmod 640 /etc/passwd-ossfs # mkdir /mnt/ossfs # ossfs image /mnt/ossfs -ourl=http://oss-cn-hangzhou.aliyuncs.com -o allow_other
卸载阿里云
# umount /mnt/ossfs
vi /etc/rc.d/rc.local # 开机挂载oss,采用此种方式挂载避免修改/etc/fstab ,致使挂载失败而系统没法启动。加 -o allow_other 容许非root用户操做避免因权限问题致使没法操做oss目录 ossfs image /mnt/ossfs -ourl=http://oss-cn-hangzhou.aliyuncs.com -o allow_other
为避免后台程序扫描oss文件致使产生费用,若是是updatedb,能够经过修改/etc/updatedb.conf让它跳过。具体作法是:url
- 在
PRUNEFS =
后面加上fuse.ossfs
- 在
PRUNEPATHS =
后面加上挂载的目录