linux服务器挂载阿里oss存储桶到本地


0, 安装依赖

1
2
3
4
5
Ubuntu 14.04+
sudo apt-get install automake autotools-dev g++ git libcurl4-gnutls-dev libfuse-dev libssl-dev libxml2-dev make pkg-config

CentOS 7.0+
sudo yum install automake gcc-c++ git libcurl-devel libxml2-devel fuse-devel make openssl-devel

1, 编译安装ossfs软件

1
2
3
4
5
6
git clone https://github.com/aliyun/ossfs.git
cd ossfs
./autogen.sh
./configure
make
sudo make install

2,挂载到本地命令

1
2
3
echo my-bucket-name:my-access-key-id:my-access-key-secret > /etc/passwd-ossfs
chmod 640 /etc/passwd-ossfs
ossfs my-bucket my-mount-point -ourl=my-oss-endpoint