<div dir="ltr" style="text-align: left;">
<h3 itemprop="name" style="background-color: white; color: #666666; font-family: ";Trebuchet MS";, Trebuchet, Verdana, sans-serif; font-size: 22px; font-stretch: normal; font-weight: normal; line-height: normal; margin: 0.75em 0px 0px; position: relative;">Mount S3 Bucket on CentOS/RHEL and Ubuntu using S3FS</h3>
<div style="background-color: white; color: #666666; font-family: ";Trebuchet MS";, Trebuchet, Verdana, sans-serif; font-size: 10.8px; line-height: 1.6; margin: 0px 0px 1.5em;">
<div></div>
</div>
<div itemprop="articleBody" style="background-color: white; color: #666666; font-family: ";Trebuchet MS";, Trebuchet, Verdana, sans-serif; font-size: 13.2px; line-height: 1.4; position: relative; width: 776px;">
<div dir="ltr">
<div style="border: 0px; color: #444444; font-family: Ubuntu, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.71429; margin: 0px; padding: 0px; vertical-align: baseline;">
<div style="border: 0px; line-height: 1.71429; margin-bottom: 20px; padding: 0px; vertical-align: baseline;">S3FS is FUSE (File System in User Space) based solution to mount an Amazon S3 buckets, We can use system commands with this drive just like as another Hard Disk in system. On s3fs mounted files systems we can simply use cp, mv and ls the basic Unix commands similar to run on locally attached disks.</div>
<div style="border: 0px; line-height: 1.71429; margin-bottom: 20px; padding: 0px; vertical-align: baseline;">This article will help you to install S3FS and Fuse by compiling from source, and also help you to mount S3 bucket on your CentOS/RHEL and Ubuntu systems.</div>
<div style="border: 0px; line-height: 1.71429; margin-bottom: 20px; padding: 0px; vertical-align: baseline;"><strong style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">Step 1: Remove Existing Packages</strong></div>
<div style="border: 0px; line-height: 1.71429; margin-bottom: 20px; padding: 0px; vertical-align: baseline;">First check if you have any existing s3fs or fuse package installed on your system. If installed it already remove it to avoid any file conflicts.</div>
<blockquote style="background: rgb(250, 250, 250); border-bottom-width: 0px; border-left: 4px solid rgb(214, 214, 214); border-radius: 14px; border-right: 4px solid rgb(214, 214, 214); border-top-width: 0px; font-style: italic; margin: 0px 0px 24px; padding: 24px; quotes: none; vertical-align: baseline;">
<div style="border: 0px; line-height: 1.71429; margin-bottom: 20px; padding: 0px; vertical-align: baseline;">CentOS/RHEL Users:<br /># yum remove fuse fuse-s3fs</div>
<div style="border: 0px; line-height: 1.71429; padding: 0px; vertical-align: baseline;">Ubuntu Users:<br />$ sudo apt-get remove fuse</div>
</blockquote>
<div style="border: 0px; line-height: 1.71429; margin-bottom: 20px; padding: 0px; vertical-align: baseline;"><strong style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">Step 2: Install Required Packages</strong></div>
<div style="border: 0px; line-height: 1.71429; margin-bottom: 20px; padding: 0px; vertical-align: baseline;">After removing above packages. First we will install all dependencies for fuse and s3cmd. Install the required packages to system use following command.</div>
<div style="border: 0px; line-height: 1.71429; margin-bottom: 20px; padding: 0px; vertical-align: baseline;">CentOS/RHEL Users:<br /># yum install gcc libstdc++-devel gcc-c++ curl-devel libxml2-devel openssl-devel mailcap</div>
<div style="border: 0px; line-height: 1.71429; margin-bottom: 20px; padding: 0px; vertical-align: baseline;">Ubuntu Users:<br />$ sudo apt-get install build-essential libcurl4-openssl-dev libxml2-dev mime-support<br />Step 3: Download and Compile Latest Fuse</div>
<div style="border: 0px; line-height: 1.71429; margin-bottom: 20px; padding: 0px; vertical-align: baseline;">Download and compile latest version of fuse source code. For this article we are using fuse version 2.9.3. Following set of command will compile fuse and add fuse module in kernel.</div>
<blockquote style="background: rgb(250, 250, 250); border-bottom-width: 0px; border-left: 4px solid rgb(214, 214, 214); border-radius: 14px; border-right: 4px solid rgb(214, 214, 214); border-top-width: 0px; font-style: italic; margin: 0px 0px 24px; padding: 24px; quotes: none; vertical-align: baseline;">
<div style="border: 0px; line-height: 1.71429; padding: 0px; vertical-align: baseline;"># cd /usr/src/<br /># wget http://downloads.sourceforge.net/project/fuse/fuse-2.X/2.9.3/fuse-2.9.3.tar.gz<br /># tar xzf fuse-2.9.3.tar.gz<br /># cd fuse-2.9.3<br /># ./configure –prefix=/usr/local<br /># make &;&; make install<br /># export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig<br /># ldconfig<br /># modprobe fuse</div>
</blockquote>
<div style="border: 0px; line-height: 1.71429; margin-bottom: 20px; padding: 0px; vertical-align: baseline;"><strong style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">Step 4: Download and Compile Latest S3FS</strong></div>
<div style="border: 0px; line-height: 1.71429; margin-bottom: 20px; padding: 0px; vertical-align: baseline;">Download and compile latest version of s3fs source code. For this article we are using s3fs version 1.74. After downloading extract the archive and compile source code in system.</div>
<blockquote style="background: rgb(250, 250, 250); border-bottom-width: 0px; border-left: 4px solid rgb(214, 214, 214); border-radius: 14px; border-right: 4px solid rgb(214, 214, 214); border-top-width: 0px; font-style: italic; margin: 0px 0px 24px; padding: 24px; quotes: none; vertical-align: baseline;">
<div style="border: 0px; line-height: 1.71429; margin-bottom: 20px; padding: 0px; vertical-align: baseline;"># cd /usr/src/<br /># wget https://s3fs.googlecode.com/files/s3fs-1.74.tar.gz<br /># tar xzf s3fs-1.74.tar.gz<br /># cd s3fs-1.74<br /># ./configure –prefix=/usr/local<br /># make &;&; make install</div>
<div style="border: 0px; line-height: 1.71429; padding: 0px; vertical-align: baseline;"></div>
</blockquote>
<div style="border: 0px; line-height: 1.71429; margin-bottom: 20px; padding: 0px; vertical-align: baseline;"><strong style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">Step 5: Setup Access Key</strong></div>
<div style="border: 0px; line-height: 1.71429; margin-bottom: 20px; padding: 0px; vertical-align: baseline;">Also In order to configure s3fs we would required Access Key and Secret Key of your S3 Amazon account. Get these security keys from Here.</div>
<blockquote style="background: rgb(250, 250, 250); border-bottom-width: 0px; border-left: 4px solid rgb(214, 214, 214); border-radius: 14px; border-right: 4px solid rgb(214, 214, 214); border-top-width: 0px; font-style: italic; margin: 0px 0px 24px; padding: 24px; quotes: none; vertical-align: baseline;">
<div style="border: 0px; line-height: 1.71429; padding: 0px; vertical-align: baseline;"># echo AWS_ACCESS_KEY_ID:AWS_SECRET_ACCESS_KEY >; ~/.passwd-s3fs<br /># chmod 600 ~/.passwd-s3fs<br />Note: Change AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY with your actual key values.</div>
</blockquote>
<div style="border: 0px; line-height: 1.71429; margin-bottom: 20px; padding: 0px; vertical-align: baseline;"><strong style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">Step 6: Mount S3 Bucket</strong></div>
<div style="border: 0px; line-height: 1.71429; margin-bottom: 20px; padding: 0px; vertical-align: baseline;">Finally mount your s3 bucket using following set of commands. For this example, we are using s3 bucket name as mydbbackup and mount point as /s3mnt.</div>
<blockquote style="background: rgb(250, 250, 250); border-bottom-width: 0px; border-left: 4px solid rgb(214, 214, 214); border-radius: 14px; border-right: 4px solid rgb(214, 214, 214); border-top-width: 0px; font-style: italic; margin: 0px 0px 24px; padding: 24px; quotes: none; vertical-align: baseline;">
<div style="border: 0px; line-height: 1.71429; margin-bottom: 20px; padding: 0px; vertical-align: baseline;"># mkdir /tmp/cache<br /># mkdir /s3mnt<br /># chmod 777 /tmp/cache /s3mnt</div>
<div style="border: 0px; line-height: 1.71429; padding: 0px; vertical-align: baseline;"># s3fs -o use_cache=/tmp/cache mydbbackup /s3mnt</div>
</blockquote>
</div>
</div>
</div>
</div>

