Skip to content

Instantly share code, notes, and snippets.

@AlejandroJL
Forked from tejasbubane/s3_bucket_mount.sh
Created June 24, 2018 05:25
Show Gist options
  • Save AlejandroJL/d8dc999860ef4fee8059d10ef04536ef to your computer and use it in GitHub Desktop.
Save AlejandroJL/d8dc999860ef4fee8059d10ef04536ef to your computer and use it in GitHub Desktop.
Steps to be done for mounting s3 bucket on an amazon ec2 instance
# download the proper versions of s3fs and fuse
wget http://s3fs.googlecode.com/files/s3fs-1.61.tar.gz
wget http://downloads.sourceforge.net/project/fuse/fuse-2.X/2.8.4/fuse-2.8.4.tar.gz
# unpack them
tar -xzf s3fs-1.61.tar.gz
tar -xzf fuse-2.8.4.tar.gz
# install dependencies
yum install gcc libstdc++-devel gcc-c++ curl-devel libxml2-devel openssl-devel mailcap
# s3fs require fuse so install it first
cd fuse-2.8.4
./configure --prefix=/usr/local
make
make install
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
ldconfig
modprobe fuse
# now install s3fs
cd ../s3fs-1.61
./configure --prefix=/usr/local
make
make install
# if you want to uninstall previous version go to the source folder (preferably in /home/jive or /mnt/tejas)
# and then run `make clean` and `make uninstall`
# make credentials file and give it proper permissions
vi /etc/passwd-s3fs
#enter the credentials in this file format is access_id:secret_key
chmod 600 /etc/passwd-s3fs
# All done ready to mount
mkdir /s3-bucketname
# mount the drive
s3fs -o default_acl=public-read <bucket> /<mountpoint>
# to unmount `umount -l /<mountpoint>`
# if you get error fuse: device not found, try 'modprobe fuse' first
# run `modprobe fuse`
# while this if you get modprobe command not found, modprobe is in sbin, add sbin to the $PATH
# export PATH="$PATH:/sbin" then `modprobe fuse` and run above mounting command again
# if you get error saying cannot load shared library libfuse.so.2:
export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/lib64/pkgconfig/
# and now run the previous command again. Yay! the bucket is mounted!
# verify bucket is mounted properly using `df -h`
# reference: http://www.goworkday.com/2013/08/01/s3fs-installation-on-centos-6-3-ec2/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment