Loading

How to Add S3 Storage to Your Linux Server

How to Add S3 Storage to Your Linux Server

Introduction

Expanding the storage capacity of your Linux server can be crucial when dealing with large amounts of data or running resource-intensive applications. Amazon S3 (Simple Storage Service) is a popular cloud storage solution, but it might not be the most cost-effective option for everyone. In this article, we’ll guide you through the process of adding S3 storage from Wasabi.com to your Linux server. Wasabi.com is known for its competitive pricing and compatibility with the S3 API, making it an excellent alternative for cloud storage.

Prerequisites

  1. A Linux server with root or sudo access.
  2. A Wasabi.com account with an S3 bucket created.
In this article, we'll guide you through the process of adding S3 storage from Wasabi.com to your Linux server.

Step 1: Install S3FS-FUSE

To mount Wasabi S3 storage on your Linux server, we’ll use S3FS-FUSE, a tool that allows us to mount S3 buckets as a local file system. We’ll first install S3FS-FUSE:

Update your system's package list:
sudo apt update

Install the required dependencies:

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

Clone the S3FS repository from GitHub:

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

Change into the cloned directory:

cd s3fs-fuse

Build and install S3FS-FUSE:

./autogen.sh./configure make sudo make install

Step 2: Configure Wasabi S3 Access

Before mounting the Wasabi S3 bucket, you need to retrieve your Wasabi Access Key ID and Secret Access Key:

  1. Log in to your Wasabi.com account.
  2. In the Wasabi Management Console, navigate to the “Users” section and select your user account.
  3. Go to the “Keys” tab, and click on “Create New Access Key” to generate a new access key pair.
  4. Save the Access Key ID and Secret Access Key in a secure location.

Step 3: Create a Mount Point

Now that you have S3FS-FUSE installed and your Wasabi S3 credentials ready, you need to create a directory that will serve as the mount point for the S3 bucket.

Choose a directory for the mount point, for example:

sudo mkdir /mnt/wasabi-s3

Adjust the directory permissions:

sudo chown <your_username>:<your_group> /mnt/wasabi-s3

Replace <your_username> and <your_group> with your actual Linux username and primary group.

Step 4: Mount the Wasabi S3 Bucket

With S3FS-FUSE installed, Wasabi S3 credentials ready, and a mount point available, you can now mount the S3 bucket to your Linux server:

s3fs <bucket_name> /mnt/wasabi-s3 -o passwd_file=/path/to/credentials_s3fs -o url=https://s3.wasabysys.com -o umask=022

Replace <bucket_name> with the name of your Wasabi S3 bucket. For example, if your bucket’s name is “my-linux-backups,” the command would be:

s3fs my-linux-backups /mnt/wasabi-s3 -o passwd_file=/path/to/credentials_s3fs -o url=https://s3.wasabisys.com -o umask=022

Step 5: Test the Mount

To ensure the Wasabi S3 bucket is successfully mounted, list the contents of the mount point:

ls /mnt/wasabi-s3

If everything is set up correctly, you should see the contents of your Wasabi S3 bucket.

Step 6: Mount at Boot (Optional)

To automatically mount the Wasabi S3 bucket each time your Linux server boots, add an entry to the /etc/fstab file:

Open the /etc/fstab file in a text editor:

sudo nano /etc/fstab

Add the following line to the end of the file:j

s3fs#<bucket_name> /mnt/wasabi-s3 fuse _netdev,passwd_file=/path/to/credentials_s3fs,url=https://s3.wasabisys.com,umask=022 0 0 

Replace <bucket_name> and /path/to/credentials_s3fs with the appropriate values.

Save the file and exit the text editor.

Conclusion

By following these steps, you have successfully added Wasabi S3 storage to your Linux server. This allows you to expand your server’s storage capacity and take advantage of the cost-effective Wasabi.com S3 storage solution. Remember to ensure that your S3 bucket is appropriately secured, especially if it contains sensitive data. With your Wasabi S3 bucket mounted, you can now easily manage and access your data on the cloud storage directly from your Linux server.

Leave a Reply