17 December 2011

I wanted to use s3fs on a CentOS 5.7 release but the latest s3fs release requires fuse > 2.8.4 whereas the CentOS 5.x repository contains only fuse 2.7.4 so I had to upgrade it my self.

I could successfully install fuse and s3fs using the following procedure but unfortunately, fuse 2.8.4 uses the –no-canonicalize option which requires util-linux >2.18 but CentOS 5.7 comes with util-linux 2.13.

I changed my mind and tried on CentOS 6 and will come back later to see how to make it work on CentOS 5.7…

Install latest fuse release

Start first by removing existing fuse packages installed on your system.

yum remove fuse fuse* fuse-devel

Install development tools and required packages if you don’t already have them.

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

Download, compile and install fuse. Use this link to get the latest fuse release.

mkdir -p /tmp/compile && cd /tmp/compile
wget http://downloads.sourceforge.net/project/fuse/fuse-2.X/2.8.6/fuse-2.8.6.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Ffuse%2Ffiles%2Ffuse-2.X%2F&ts=1324112754&use_mirror=freefr
tar -zxf fuse-2.8.6.tar.gz
cd fuse-2.8.6
./configure --prefix=/usr
make install

Update ldconfig

export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/lib64/pkgconfig/

Load fuse module and confirm we use our compiled version

modprobe fuse
pkg-config --modversion fuse (should return 2.8.6)

Cleanup a bit…

cd /tmp/compile
rm -rf fuse*

Install s3fs

Now that prerequisite are satisfied, it is time to download, compile and install s3fs. Browse to repository to get the link of the latest s3fs release.

cd /tmp/compile
wget http://s3fs.googlecode.com/files/s3fs-1.61.tar.gz
tar -zxf s3fs-1.61.tar.gz
cd s3fs-1.61
./configure --prefix=/usr
make install

Again some cleanup…

cd /tmp/compile
rm -rf s3fs*

Using s3fs

Time to test our installation. First, we need to create a credential file to connect to our s3 bucket. Replace bucketName, accessKeyId and secretAccessKey with your own.

cat << EOT > ~/.passwd-s3fs
chmod 600 ~/.passwd-s3fs

Finally, use this command to mount your bucket, replacing bucketName and mountpoint by your own parameters.

s3fs bucketName mountpoint -ouse_cache=/tmp

The option -ouse_cache=/tmp directive enable local caching to speedup access and avoid downloading content from s3 everytime which would lead to extra charge for the get requests. See s3fs website for more information.

blog comments powered by Disqus