# How to Mount a S3 Bucket on Linux Instance?

#### **Step 1:** Update the system. <a href="#step-1-update-the-system" id="step-1-update-the-system"></a>

If you are using a new Centos or Ubuntu instance, then update the system using the below commands:

a. For CentOS or Red Hat.

```
yum update all
```

b. For Ubuntu.

```
apt-get update
```

#### **Step 2:** Install the dependencies. <a href="#step-2-install-the-dependencies" id="step-2-install-the-dependencies"></a>

a. In CentOS or Red Hat.

```
sudo yum install automake fuse fuse-devel gcc-c++ git libcurl-devel libxml2-devel make openssl-devel
```

b. In Ubuntu or Debian.

```
sudo apt-get install automake autotools-dev fuse g++ git libcurl4-gnutls-dev libfuse-dev libssl-dev libxml2-dev make pkg-config
```

#### **Step 3:** Clone s3fs source code from git. <a href="#step-3-clone-s3fs-source-code-from-git" id="step-3-clone-s3fs-source-code-from-git"></a>

```
git clone https://github.com/s3fs-fuse/s3fs-fuse.git
```

#### **Step 4:** Install the code. <a href="#step-4-install-the-code" id="step-4-install-the-code"></a>

Now change to source code directory, compile and install the code with the following commands:

```
cd s3fs-fuse 
./autogen.sh
./configure --prefix=/usr --with-openssl
make
sudo make install
```

#### **Step 5:** Check the s3fs command and installation. <a href="#step-5-check-the-s3fs-command-and-installation" id="step-5-check-the-s3fs-command-and-installation"></a>

Use the below command to check where the s3fs command is placed in OS. It will also tell you the installation is ok.

```
which s3fs
```

#### **Step 6:** Paste the access key and secret key. <a href="#step-6-paste-the-access-key-and-secret-key" id="step-6-paste-the-access-key-and-secret-key"></a>

Create a new file in **/etc** with the name **passwd-s3fs** and paste the access key and secret key in the below format.

<pre><code><strong>touch /etc/passwd-s3fs 
</strong>vim /etc/passwd-s3fs
</code></pre>

```
Your_accesskey:Your_secretkey
```

#### **Step 7:** Change the permission of the file. <a href="#step-7-change-the-permission-of-the-file" id="step-7-change-the-permission-of-the-file"></a>

```
sudo chmod 640 /etc/passwd-s3fs
```

#### **Step 8:** Mount S3 bucket. <a href="#step-8-mount-s3-bucket" id="step-8-mount-s3-bucket"></a>

Now create a directory or provide the path of an existing directory and mount S3 bucket in it.

```
mkdir /mys3buckets3fs your_bucketname -o use_cache=/tmp -o allow_other -o uid=1001 -o mp_umask=002 -o multireq_max=5 /mys3bucket url=https://api-ap-south-mum-1.openstack.acecloudhosting.com:8080
```

You can make an entry in **/etc/rc.local** to automatically remount after reboot.  Find the s3fs binary file by the **which** command and make the entry before the **exit 0** line as below:

```
which s3fs 
/usr/local/bin/s3fs
```

```
nano /etc/rc.local 
/usr/local/bin/s3fs your_bucketname -o use_cache=/tmp -o allow_other -o uid=1001 -o mp_umask=002 -o multireq_max=5 /mys3bucket
```

#### **Step 9:** Check mounted s3 bucket. <a href="#step-9-check-mounted-s3-bucket" id="step-9-check-mounted-s3-bucket"></a>

```
df -Th
```

or

```
df -Th /mys3bucket
```

&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.acecloud.ai/knowledge-base/tutorials/how-to-mount-a-s3-bucket-on-linux-instance.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
