Installing s3fs on Centos


centos-logos3_amazon

Many years ago I install s3fs on Centos servers and wrote about it, today I needed to install it on a new 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 -O master.zip https://github.com/s3fs-fuse/s3fs-fuse/archive/master.zip 

Some prerequisites 

yum -y install automake libcurl gcc-c++ \
libcurl-devel libxml2 libxml2-devel libtool gettext gettext-devel \
openssl openssl-devel
 
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  gcc-c++

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 fuse-devel  libcurl-devel libxml2-devel

ERROR

configure: error: Package requirements (fuse >= 2.8.4 libcurl >= 7.0 libxml-2.0 >= 2.6) were not met:

Requested ‘fuse >= 2.8.4’ but version of fuse is 2.8.3

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.
See the pkg-config man page for more details.

You need to uninstall fuse

You may get the following error

Error in PREUN scriptlet in rpm package realplay
XXXXXXX was supposed to be removed but is not!

rpm -e --noscripts --nodeps fuse
rpm --rebuilddb
yum erase fuse*

cd ~/software
wget -O fuse-2_9_bugfix.zip https://github.com/libfuse/\
libfuse/archive/fuse-2_9_bugfix.zip

unzip fuse-2_9_bugfix.zip
cd libfuse-fuse-2_9_bugfix

I tried the install with version 3, this was a disaster

wget -O libfuse.zip https://github.com/libfuse/libfuse/archive/master.zip
unzip libfuse.zip
cd libfuse-master/

./makeconf.sh

Running libtoolize...
./makeconf.sh: line 4: libtoolize: command not found
config.rpath not found! - is gettext installed?

Ensure that libtool gettext gettext-devel

./configure --prefix=/usr/local
make
make install

OK now to fix some path issue and a final dependency

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

To check if it is installed and the path statement is correct

pkg-config –modversion fuse

This is from version 3

pkg-config --modversion fuse3
ln -s /usr/local/lib/pkgconfig/fuse3.pc /usr/local/lib/pkgconfig/fuse.pc

cd ~/software/s3fs-fuse-master/
./configure --prefix=/usr

ERROR

checking for common_lib_checking… configure: error: Package requirements (fuse >= 2.8.4 libcurl >= 7.0 libxml-2.0 >= 2.6) were not met:

No package ‘fuse’ 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.
See the pkg-config man page for more details.

ERROR

checking for DEPS… configure: error: Package requirements (fuse >= 2.8.4 libcurl >= 7.0 libxml-2.0 >= 2.6 libcrypto >= 0.9) were not met:

No package ‘libcrypto’ 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 DEPS_CFLAGS
and DEPS_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

Ensure that  openssl openssl-devel

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]…

ERROR

s3fs: error while loading shared libraries: libfuse.so.2: cannot open shared object file: No such file or directory

yum install fuse-libs

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

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