You can use ossfs to mount OSS buckets to local file systems in Linux and perform operations on OSS objects in the same manner as you operate local files, to serve data sharing purposes.

Runtime environment

We recommend that you run ossfs in the following environments:

  • Linux-based operating systems
    • CentOS later than 7.0 and earlier than 8.0
    • Ubuntu 14.04 or later
  • Fuse 2.8.4 or later

ossfs is subject to errors such as disconnections when run on earlier Linux kernel versions. OSS provides installation packages for Linux-based operating systems of earlier versions. However, we recommend that you upgrade your operating system to the preceding versions to ensure the stable operation of ossfs.

Download URLs

Released Linux URL
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

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 the source code, visit GitHub ossfs.

Notice When you copy the URLs to the wget command to download ossutil, delete the ? spm=xxxx section from the URLs.

Installation

  1. 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
  2. Install ossfs.
    • Run the following commands to install ossfs on Ubuntu:
      sudo apt-get update
      sudo apt-get install gdebi-core
      sudo gdebi your_ossfs_package
    • Run the following command to install ossfs on CentOS 6.5 or later:
      sudo yum localinstall your_ossfs_package
      Note If your client uses yum to install the RPM package, dependent packages may fail to be downloaded when the client node network environment is not suitable. To resolve this issue, you can use yum to download the dependent packages over the normal network to a node running the same operating system version, and then copy the dependent packages to the required node where the network environment is not suitable. For example, if ossfs depends 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
      To download other dependent packages, replace fuse with the name of the required package.
    • Run the following command to install ossfs on CentOS 5:
      sudo yum localinstall your_ossfs_package --nogpgcheck
  3. 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 object. Ensure that the permission on this object is set correctly. We recommend that you set the permission to 640.
    echo my-bucket:my-access-key-id:my-access-key-secret > /etc/passwd-ossfs
    chmod 640 /etc/passwd-ossfs
  4. Mount the bucket to the specified directory.
    ossfs my-bucket my-mount-point -ourl=my-oss-endpoint
    Example: Attach the bucket-test bucket to the /tmp/ossfs directory.
    echo bucket-test:LTAIbZcdVCmQ****:MOk8x0y9hxQ31coh7A5e2MZEUz**** > /etc/passwd-ossfs
    chmod 640 /etc/passwd-ossfs
    mkdir /tmp/ossfs
    ossfs bucket-test /tmp/ossfs -ourl=http://oss-cn-hangzhou.aliyuncs.com
    Notice If you use an ECS instance that is purchased from Alibaba Cloud to provide ossfs services, you can use an internal endpoint. In the preceding example, you can set the OSS endpoint to oss-cn-hangzhou-internal.aliyuncs.com to minimize costs. For more information about OSS internal endpoints, see Regions and endpoints.
  5. If you no longer need the bucket, you can run the following command to detach it.
    fusermount -u /tmp/ossfs
Note For more information, visit GitHub ossfs.

Version logs

For more information about version logs, visit GitHub ChangeLog.