ossfs allows you to mount Object Storage Service (OSS) buckets as local file systems on Linux. Then, you can manage OSS objects in the same manner as you manage local files.
Runtime environment
- Linux-based operating systems
- CentOS 7.0 or later
- Ubuntu 14.04 or later
- Anolis7 or later
- Fuse 2.8.4 or later
Download URLs
Linux distribution | Download URL |
---|---|
Ubuntu 20.04 (x64) | ossfs_1.80.7_ubuntu20.04_amd64.deb |
Ubuntu 18.04 (x64) | ossfs_1.80.7_ubuntu18.04_amd64.deb |
Ubuntu 16.04 (x64) | ossfs_1.80.7_ubuntu16.04_amd64.deb |
Ubuntu 14.04 (x64) | ossfs_1.80.7_ubuntu14.04_amd64.deb |
CentOS 8.0 (x64) | ossfs_1.80.7_centos8.0_x86_64.rpm |
CentOS 7.0 (x64) | ossfs_1.80.7_centos7.0_x86_64.rpm |
Anolis8/Alibaba Cloud Linux 3 | ossfs_1.80.7_anolisos8.0_x86_64.rpm |
Anolis7/Alibaba Cloud Linux 2 | ossfs_1.80.7_anolisos7.0_x86_64.rpm |
The preceding table provides the download URLs of ossfs installation packages for common operating systems. If your operating system is not included in the table, install ossfs by compiling the source code. For more information about the URL of the source code and how to compile the source code, see GitHub ossfs.
?spm=xxxx
from the URLs.
Installation
- Download the installation package.
For example, run the following command to download the ossfs installation package for CentOS 7.0 (x64):
wget http://gosspublic.alicdn.com/ossfs/ossfs_1.80.6_centos7.0_x86_64.rpm
- Install ossfs.
- Ubuntu
For example, you can run the following command to install ossfs in Ubuntu 16.04 (x64):
sudo apt-get update sudo apt-get install gdebi-core sudo gdebi ossfs_1.80.6_ubuntu16.04_amd64.deb
- CentOS/Anolis
For example, you can run the following command to install ossfs in CentOS 7.0 (x64):
sudo yum install ossfs_1.80.6_centos7.0_x86_64.rpm
If your client uses Yellowdog Updater, Modified (YUM) to install the Red-hat Package Manager (RPM) package, dependencies may fail to be downloaded by using YUM when the client node network environment is not suitable. To resolve this issue, you can use YUM to download the dependencies over the normal network to a node that runs the same operating system version, and then copy the dependencies to the required node. For example, ossfs runs based on fuse 2.8.4 or later. You can run the following command to download the latest version of fuse from the YUM source to your local device:
sudo yum install --downloadonly --downloaddir=./ fuse
Important To download other dependencies, replace fuse with the name of the required package.
- Ubuntu
- If you want the content type of the uploaded object to match the object name extension, you must add the mime.types file.
If you do not add the mime.types file, OSS sets Content-Type of the uploaded object to application/octet-stream by default.
The following examples show how to run the specified command to add the mime.types file.
- Ubuntu
You can run the following command to add the mime.types file:
sudo apt-get install mime-support
- CentOS/Anolis
You can run the following command to add the mime.types file:
sudo yum install mailcap
- Ubuntu
- Configure access information of the account.
Store the bucket name and the AccessKey pair that can be used to access the bucket in the /etc/passwd-ossfs file. We recommend that you set the object permission to 640.
echo BucketName:yourAccessKeyId:yourAccessKeySecret > /etc/passwd-ossfs chmod 640 /etc/passwd-ossfs
Replace BucketName, yourAccessKeyId, and yourAccessKeySecret with your actual bucket name, AccessKey ID, and AccessKey secret. Example:
echo bucket-test:LTAIbZcdVCmQ****:MOk8x0y9hxQ31coh7A5e2MZEUz**** > /etc/passwd-ossfs chmod 640 /etc/passwd-ossfs
- Mount the bucket to the specified directory.
ossfs BucketName mountfolder -o url=Endpoint
For example, you can run the following command to mount a bucket namedbucket-test
in the China (Hangzhou) region to the/tmp/ossfs
directory.mkdir /tmp/ossfs ossfs bucket-test /tmp/ossfs -o url=http://oss-cn-hangzhou.aliyuncs.com
Important If you use an Alibaba Cloud Elastic Compute Service (ECS) instance to provide ossfs services, you can use the internal endpoint of the bucket. In the preceding example, you can set the endpoint of the bucket tooss-cn-hangzhou-internal.aliyuncs.com
to minimize traffic fees. For more information about the internal endpoints of OSS, see Regions and endpoints. - If you no longer want to mount the bucket, you can run the following command to unmount it:
fusermount -u /tmp/ossfs
For more information, visit GitHub ossfs.
Version history
For more information about the version history of ossfs, visit GitHub ChangeLog.