technology:vps:挂载阿里云oss到本地磁盘

ossfs能让您在Linux系统中,将对象存储OSS的存储空间(Bucket)挂载到本地文件系统中,您能够像操作本地文件一样操作OSS的对象(Object),实现数据的共享。1)

Linux发行版 下载
Ubuntu 18.04 (x64) ossfs_1.80.6_ubuntu18.04_amd64.deb
Ubuntu 16.04 (x64) ossfs_1.80.6_ubuntu16.04_amd64.deb
Ubuntu 14.04 (x64) ossfs_1.80.6_ubuntu14.04_amd64.deb
CentOS 7.0 (x64) ossfs_1.80.6_centos7.0_x86_64.rpm
CentOS 6.5 (x64) ossfs_1.80.6_centos6.5_x86_64.rpm
# Ubuntu18.04
$ wget http://gosspublic.alicdn.com/ossfs/ossfs_1.80.6_ubuntu18.04_amd64.deb?spm=a2c4g.11186623.2.13.33d573587WNn5h&file=ossfs_1.80.6_ubuntu18.04_amd64.deb
$ mv ossfs_1.80.6_ubuntu18.04_amd64.deb?spm=a2c4g.11186623.2.13.33d573587WNn5h  ossfs_1.80.6_ubuntu18.04_amd64.deb
 
# Centos7.0 x64
$ wget http://gosspublic.alicdn.com/ossfs/ossfs_1.80.6_centos7.0_x86_64.rpm
# CentOS >= 6.5 (x64)
$ sudo yum localinstall your_ossfs_package
 
# CentOS 5
$ sudo yum localinstall your_ossfs_package --nogpgcheck
 
# Ubuntu
$ sudo apt-get update
$ sudo apt-get install gdebi-core
$ sudo gdebi your_ossfs_package
 
 
# Example(Ubuntu18.04)
$ sudo gdebi ossfs_1.80.6_ubuntu18.04_amd64.deb
$ echo my-bucket:my-access-key-id:my-access-key-secret > /etc/passwd-ossfs
$ chmod 640 /etc/passwd-ossfs
 
# Example 
 
$ echo frytea-clouddrive-cn2:LTAILUL4ts0X****:NAkb7jjPyxloBNF2UDdiLXXIY5**** > /etc/passwd-ossfs
$ chmod 640 /etc/passwd-ossfs
$ ossfs my-bucket my-mount-point -ourl=my-oss-endpoint
 
# Example
$ ossfs frytea-clouddrive-cn2 /www/wwwroot/drive.frytea.com/data/oss_cn2 -ourl=http://oss-cn-beijing-internal.aliyuncs.com
$ fusermount -u /tmp/ossfs
 
# Example
$ fusermount -u /www/wwwroot/drive.frytea.com/data/oss_cn2

在 /etc/init.d/ 路径下新建一个文本2)

$ cd /etc/init.d/
$ vim automountoss
#! /bin/bash                                                                         
echo "Mount Aliyun Oss frytea-clouddrive-cn2"
 
ossfs frytea-clouddrive-cn2 /www/wwwroot/drive.frytea.com/data/oss_cn2 -ourl=http://oss-cn-beijing-internal.aliyuncs.com -o allow_other
exit 0
# 授权
$ chmod u+x automountoss
 
# 测试
$ bash automountoss
 
# 自启
$ update-rc.d automountoss defaults
 
# 重启测试
$ reboot

  • technology/vps/挂载阿里云oss到本地磁盘.txt
  • 最后更改: 2019/11/16 11:23
  • (外部编辑)