How to use Object Storage on Linux Cloud Servers

2022-12-07 By Nathan 3194 Views object storage linux layerpanel
33 reviews

LayerStack’s object storage is given a unique identifier and is stored in a flat memory model, it can enable users to store and retrieve any amount of data at any time or place, giving access to highly scalable, fast, reliable, and inexpensive data storage. It can also be easily optimizable, organizable and configurable to support a wide range of organizational, Business and compliance-specific data management requirements.


To deploy Object storage service and create Bucket


  1. Log in to LayerPanel2 (https://cp.layerpanel.com/) account and select the Services>> Object storage as in the below screenshot.

    objectstoragelspanel1

  2. Deploy an Object Storage in a region, you would be able to create bucket storage in either Hong Kong or Singapore.

    objectstoragelspanel2

  3. Go ahead and pay up the order generated and then come back to the Object storage page.

    objectstoragelspanel3

  4. Once done, you would be able to click on Create Bucket Button.

    objectstoragelspanel4

  5. Enter the bucket name and region of preference.

    objectstoragelspanel5


Once done you would be able to view the created bucket listed.


To configure and mount the service to the Cloud Servers


In order to make use of the Object Storage service, involves both configuring the service and mounting the service to the server. Configuration is done using the s3cmd command and mounting is performed using the s3fs command.


s3cmd is a tool to manage buckets and files and you may refer to the following steps in order to install s3cmd on Linux servers.


Ubuntu/Debian:

# apt-get install s3cmd

objectstorage7


CentOS/RHEL and Fedora:

# yum install epel-release

objectstorage8

# yum install s3cmd

objectstorage9


The below steps can be followed to configure the Object Storage service in the server using s3cmd:


  1. Log in to the Linux server by using SSH.

  2. Input the following command.

    # s3cmd --configure
    
  3. Input your Access Key and Secret Key, both keys can be found from your LayerPanel service's page.

    objectstorage1

  4. Input your location for Default Region.

  5. Specify hks3.layerstackobjects.com for the HK region or sgs3.layerstackobjects.com for the SG region for S3 Endpoint.

    objectstorage2

  6. Specify no for DNS-style bucket+hostname:port template for accessing a bucket.

    objectstorage3

  7. Specify a password of your choice for Encryption password if necessary.

  8. Press return for Path to GPG program if necessary.

  9. Press return for Use HTTPS protocol if necessary.

  10. Press return for HTTP Proxy server name if necessary.

    objectstorage4

  11. Confirm by specifying y.

    objectstorage5

  12. Confirm again by specifying y.

    objectstorage6


FUSE is also useful for users who want to access the data stored in the same way they would access a local file system. It provides a way to mount an S3 bucket so that it can be used as part of a local file system.

s3fs allows Linux, macOS, and FreeBSD to mount an S3 bucket via FUSE to the Cloud server.

S3fs mounts an S3 bucket as a local file system. The API implementation supports directory operations like create, delete, move, etc. along with basic file operations like read, write, delete, etc. This tutorial will help you to mount the S3 object storage to the Cloud Servers.

Installation of s3fs-fuse is the prerequisite for this tutorial. As the utility can be installed on all Linux OS as well as Mac OS. You may refer to the following steps to install s3fs-fuse in Linux servers.


Ubuntu/Debian:

# apt-get install s3fs

s3fsfuse1


CentOS/RHEL and Fedora:

# yum install epel-release

s3fsfuse2

# yum install s3fs-fuse

s3fsfuse3


Once S3fs FUSE is installed, the below steps can be followed for mounting the object storage.


  1. A setting file needs to be created using the Access key and secret key with the format.

    Access_key : Secret_key
    
    echo access_key:secret_key > ${HOME}/.passwd-s3fs
    

    s3fsfuse4

  2. Set the permissions accordingly to secure the file.

    # chmod 600 ${HOME}/.passwd-s3fs
    

    s3fsfuse5

  3. Create a new folder which is the mount point for the Object storage.

    # mkdir ${HOME}/<bucket-name>
    

    s3fsfuse6

  4. Now, the bucket is mounted on the mounting point.

    # s3fs <bucket-name> ${HOME}/<bucket-name> -o passwd_file=${HOME}/.passwd-s3fs -o url=https:// [hks3.layerstackobjects.com](http://hks3.layerstackobjects.com/) -o use_path_request_style
    

    s3fsfuse7

    NOTE: Please use sgs3.layerstackobjects.com for the SG region.

  5. Finally, you would be able to view the mount point.

    s3fsfuse8


Related Tutorials

What do you think about this article?

Rate this article
LayerStack Promotion
Need assistance?

Try this guide to receive free bundled services at signup on a new free account.

Sign Up

Your Feedback Is Important

We hope you’ll give the new products and updates a try. If you have an idea for improving our products or want to vote on other user ideas so they get prioritized, please submit your feedback on our Community platform. And if you have any questions, please feel free to ask in the Community or contact our Technical Support team.