Install s3fs Ubuntu 14.04 LTS


ubuntu-logo112s3_amazon

Many years ago I install s3fs on Centos servers and wrote about it, today I needed to install in an Ubuntu server.

I went straight to the instructions and of course as in everything Open Source they were out of date. So here for the next few months are the new install instructions. ūüôā

cd ~
mkdir software
cd software
 wget https://github.com/s3fs-fuse/s3fs-fuse/archive/master.zip

Some prerequisites 

apt-get -y install automake build-essential libfuse-dev fuse libcurl3
libcurl3-dev libxml2 libxml2-dev
unzip master.zip
cd s3fs-fuse-master
 ./autogen.sh 

ERROR

— Make commit hash file ——-
— Finished commit hash file —
— Start autotools ————-
./autogen.sh: 38: ./autogen.sh: aclocal: not found
— Finished autotools ———-

Ensure that you have installed automake

./configure --prefix=/usr

ERROR

checking whether the C++ compiler works… no
configure: error: in `/root/software/s3fs-fuse-master’:
configure: error: C++ compiler cannot create executables
See `config.log’ for more details

Ensure that you have installed  build-essential

No package ‘fuse’ found
No package ‘libcurl’ found
No package ‘libxml-2.0’ found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables common_lib_checking_CFLAGS
and common_lib_checking_LIBS to avoid the need to call pkg-config.

Ensure that you installed libfuse-dev  libcurl3-dev libxml2-dev

A quick hint, if you are looking for a package e.g. libcurl you could use the following command :-

apt-cache search libcurl

make
make install

 

OK to test if you have this installed

s3f3 should then prompt you for a bucket name and credentials

s3fs: missing BUCKET argument.
Usage: s3fs BUCKET:[PATH] MOUNTPOINT [OPTION]…

You need to create a .passwd-s3fs file. This is best done as root as it should be stored in the home directory and should of course be secured done.

cd ~
echo accessKeyId:secretAccessKey > .passwd-s3fs
chmod 600 ~/.passwd-s3fs

Now create a mount point for the bucket

cd /mnt
mkdir bucketname - this is only a suggestion but it keeps it 
consistent and therefore easy to debug

then issue the s3fs commands (to text if the mount works)

s3fs mybucket /path/to/mountpoint -o passwd_file=~/.passwd-s3fs
 

NOTE the -o allow ‚Äď makes the mounted directory¬†accessible by other users of the server.

If you encounter any errors, enable debug output:

s3fs mybucket /path/to/mountpoint -o passwd_file=~/.passwd-s3fs -d -d -f -o 
f2 -o curldbg

 

Now to permanently mount the drive when the server boots up etc… the command for the fstab is as follows :

s3fs#bucketname /mnt/mount_folder fuse allow_other 0 0

e.g.

vi /ect/fstab

s3fs#domainname-website-export /mnt/website-export fuse _netdev,allow_other 0 0

Allowing access to a mounted drive from a non root user is a bit of a headache.

change the /etc/fuse.conf file and un-comment the user_allow_other

# Allow non-root users to specify the allow_other or allow_root mount options.
user_allow_other

Then add the mount line to /etc/fstab

s3fs#bucketname mount_point  fuse _netdev,allow_other,umask=700,use_rrs  0 0

The highlighted areas are the imported entries

To mount the bucket

mount -a 

 

 

 

 

Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s