How To Mount S3 Bucket In Linux Using S3FS

Fri 03 July 2015 by Godson

Step 1: Remove Existing Packages

# yum remove fuse fuse-s3fs

Step 2: Install Required Packages

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

Step 3: Download and Compile Latest Fuse

# 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
# vim /etc/ld.so.conf
/usr/local/lib - if you dont add this you will get "s3fs: error while loading shared libraries: libfuse.so.2: cannot open shared object file: No such file or directory" error
include ld.so.conf.d/*.conf

# ldconfig
# modprobe fuse

Step 4: Download and Compile Latest S3FS

# 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

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

Step 6: Mount S3 Bucket

# mkdir /tmp/cache
# mkdir /s3mnt
# chmod 777 /tmp/cache /s3mnt

# s3fs -o use_cache=/tmp/cache mydbbackup /s3mnt

To unmount

# fusermount -u /s3mnt