Home » Centos/RHEL » How to install S3FS on RHEL/Centos

How to install S3FS on RHEL/Centos

S3FS is FUSE (File System in User Space) based solution to mount an Amazon S3 buckets, We can use system commands with this drive just like as another Hard Disk in system. On s3fs mounted files systems we can simply use cp, mv and ls the basic Unix commands similar to run on locally attached disks. To install S3FS on RHEL/Centos use the following steps
Step 1: Remove Existing Packages
First of all verify if you have any existing s3fs or fuse package installed on your server. If installed please remove it to avoid any file conflicts.
CentOS/RHEL server:

# yum remove fuse fuse-s3fs

Ubuntu server:

$ sudo apt-get remove fuse

Step 2: Install dependencies
After removing already installed packages. We need to install all dependencies for fuse and s3cmd. Install the required packages using following command.
CentOS/RHEL Users:

# yum install gcc libstdc++-devel gcc-c++ openssl-devel mailcap curl-devel libxml2-devel

Ubuntu Users:

$ sudo apt-get install build-essential libcurl4-openssl-dev libxml2-dev mime-support

Step 3: Download Latest Fuse and Compile
Then Download and compile latest version of fuse source code using following commands.

# cd /usr/src/
# wget http://downloads.sourceforge.net/project/fuse/fuse-2.X/2.9.3/fuse-2.9.3.tar.gz
# tar xzf fuse-2.9.3.tar.gz
# cd fuse-2.9.3
# ./configure –prefix=/usr/local
# make && make install
# export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
# ldconfig
# modprobe fuse
#pkg-config –modversion fuse #confirm that 2.9.3 is the version displayed

Step 4: Download Latest S3FS and Compile
After successfully installation of fuse, Please download the latest s3fs and compile it using below commands.

# cd /usr/src/
# wget https://s3fs.googlecode.com/files/s3fs-1.74.tar.gz
# tar xzf s3fs-1.74.tar.gz
# cd s3fs-1.74
# ./configure –prefix=/usr/local
# make
#make install

Step 5: Setup Access Key
Also In order to configure s3fs we would required Access Key and Secret Key of your S3 Amazon account. Get these security keys from Here.

# echo AWS_ACCESS_KEY_ID:AWS_SECRET_ACCESS_KEY > ~/.passwd-s3fs
# chmod 600 ~/.passwd-s3fs

Note: Change AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY with your actual key values.
Step 6: Mount S3 Bucket
in conclusion mount your s3 bucket via following commands. In this example, we are using s3 bucket name as mybucket and mount point as /storage.

# mkdir /tmp/cache
# mkdir /storage
# s3fs mybucket /storage -o use_cache=/tmp/cache

That’s it.

If this is behind firewall you will need to open port 80/443 [depending upon what you want to use.]
If not try

#fusermount -u /aws

Check if its mounted or not

#mount
#df -h

df: `/aws’: Transport endpoint is not connected

If this is behind firewall you will need to open port 80/443 [depending upon what you want to use.]
If not try

#fusermount -u /aws

and mount again

#fusermount -u /aws
#s3fs -o allow_other -o use_cache=/tmp mybucket /aws -odefault_acl=private

fstab (for boot time)
s3fs#bucketname /mountpath fuse use_cache=/tmp,allow_other,uid=user,gid=group 0 0

About

I am founder and webmaster of www.linuxpcfix.com and working as a Sr. Linux Administrator (Expertise on Linux/Unix & Cloud Server) and have been in the industry from last 7 years.

One thought on “How to install S3FS on RHEL/Centos

  1. Lesley says:

    I read a lot of interesting content here. Probably you spend a lot of time writing.
    Thanks Buddy, keep up

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*

Time limit is exhausted. Please reload the CAPTCHA.

Categorized Tag Cloud