{"id":946,"date":"2016-08-17T21:53:34","date_gmt":"2016-08-18T02:53:34","guid":{"rendered":"http:\/\/xfloyd.net\/blog\/?p=946"},"modified":"2016-08-19T20:51:02","modified_gmt":"2016-08-20T01:51:02","slug":"how-to-mount-amazons-s3","status":"publish","type":"post","link":"http:\/\/xfloyd.net\/blog\/?p=946","title":{"rendered":"How to mount Amazon&#8217;s S3"},"content":{"rendered":"<p>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.<\/p>\n<p>If you like to access S3 buckets without mounting on system, use s3cmd command line utility to manage s3 buckets. s3cmd is also provides faster speed for data upload and download rather than s3fs. To work with s3cmd use next articles to install s3cmd in <a href=\"http:\/\/tecadmin.net\/install-s3cmd-manage-amazon-s3-buckets\/\" target=\"_blank\">Linux systems<\/a> and <a href=\"http:\/\/tecadmin.net\/setup-s3cmd-in-windows\/\" target=\"_blank\">Windows systems<\/a>.<br \/>\n<!--more--><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4150\" src=\"http:\/\/tecadmin.net\/wp-content\/uploads\/2014\/02\/amazon-banner.png\" alt=\"amazon-banner\" width=\"596\" height=\"110\" \/><\/p>\n<p>This article will help you to install <strong>S3FS<\/strong> and <strong>Fuse<\/strong> by compiling from source, and also help you to mount <strong>S3 bucket<\/strong> on your CentOS\/RHEL and Ubuntu systems.<\/p>\n<h2 class=\"heading1\">Step 1: Remove Existing Packages<\/h2>\n<p>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.<\/p>\n<pre><strong>CentOS\/RHEL Users:<\/strong>\r\n # yum remove fuse fuse-s3fs\r\n\r\n<strong>Ubuntu Users:<\/strong>\r\n $ sudo apt-get remove fuse<\/pre>\n<h2 class=\"heading1\">Step 2: Install Required Packages<\/h2>\n<p>After removing above packages. First we will install all dependencies for fuse and s3cmd. Install the required packages to system use following command.<\/p>\n<pre><strong>CentOS\/RHEL Users:<\/strong>\r\n # yum install gcc libstdc++-devel gcc-c++ curl-devel libxml2-devel openssl-devel mailcap\r\n\r\n<strong>Ubuntu Users:<\/strong>\r\n $ sudo apt-get install build-essential libcurl4-openssl-dev libxml2-dev mime-support<\/pre>\n<h2 class=\"heading1\">Step 3: Download and Compile Latest Fuse<\/h2>\n<p>Download and compile <a href=\"http:\/\/sourceforge.net\/projects\/fuse\/files\/fuse-2.X\/\" target=\"_blank\">latest version<\/a> 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.<\/p>\n<pre># cd \/usr\/src\/\r\n# wget http:\/\/downloads.sourceforge.net\/project\/fuse\/fuse-2.X\/2.9.3\/fuse-2.9.3.tar.gz\r\n# tar xzf fuse-2.9.3.tar.gz\r\n# cd fuse-2.9.3\r\n# .\/configure --prefix=\/usr\/local\r\n# make &amp;&amp; make install\r\n# export PKG_CONFIG_PATH=\/usr\/local\/lib\/pkgconfig\r\n# ldconfig\r\n# modprobe fuse<\/pre>\n<h2 class=\"heading1\">Step 4: Download and Compile Latest S3FS<\/h2>\n<p>Download and compile <a href=\"https:\/\/code.google.com\/p\/s3fs\/downloads\/list\" target=\"_blank\">latest version<\/a> 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.<\/p>\n<pre># cd \/usr\/src\/\r\n# wget https:\/\/s3fs.googlecode.com\/files\/s3fs-1.74.tar.gz\r\n# tar xzf s3fs-1.74.tar.gz\r\n# cd s3fs-1.74\r\n# .\/configure --prefix=\/usr\/local\r\n# make &amp;&amp; make install<\/pre>\n<h2 class=\"heading1\">Step 5: Setup Access Key<\/h2>\n<p>Also In order to configure s3fs we would required Access Key and Secret Key of your S3 Amazon account. Get these security keys from <a href=\"https:\/\/aws-portal.amazon.com\/gp\/aws\/securityCredentials\" target=\"_blank\">Here<\/a>.<\/p>\n<pre># echo AWS_ACCESS_KEY_ID:AWS_SECRET_ACCESS_KEY &gt; ~\/.passwd-s3fs\r\n# chmod 600 ~\/.passwd-s3fs<\/pre>\n<p>Note: Change <strong>AWS_ACCESS_KEY_ID<\/strong> and <strong>AWS_SECRET_ACCESS_KEY<\/strong> with your actual key values.<\/p>\n<h2 class=\"heading1\">Step 6: Mount S3 Bucket<\/h2>\n<p>Finally mount your s3 bucket using following set of commands. For this example, we are using s3 bucket name as <strong>mydbbackup<\/strong> and mount point as <strong>\/s3mnt<\/strong>.<\/p>\n<pre># mkdir \/tmp\/cache\r\n# mkdir \/s3mnt\r\n# chmod 777 \/tmp\/cache \/s3mnt\r\n\r\n# s3fs -o use_cache=\/tmp\/cache mydbbackup \/s3mnt\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"_links":{"self":[{"href":"http:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/946"}],"collection":[{"href":"http:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/xfloyd.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=946"}],"version-history":[{"count":3,"href":"http:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/946\/revisions"}],"predecessor-version":[{"id":953,"href":"http:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/946\/revisions\/953"}],"wp:attachment":[{"href":"http:\/\/xfloyd.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=946"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/xfloyd.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=946"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/xfloyd.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=946"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}