Blog / Linux/ Single-Node LeoFS Installation on CentOS 7.5

Single-Node LeoFS Installation on CentOS 7.5

单机安装部署LeoFS/系统CentOS Linux release 7.5.1804 (Core)  64bit

Environment Preparation and Software Installation

This guide details the single-node installation of LeoFS object storage on CentOS Linux release 7.5.1804 (Core) 64-bit. For the official documentation, refer to the LeoFS Installation Guide.

First, install required tools and download the LeoFS package:

yum install screen wget -y
screen -S leofs
cd / && mkdir codefiles && cd codefiles
wget -c https://github.com/leo-project/leofs/releases/download/1.4.2/leofs-1.4.2-1.el7.x86_64.rpm
yum install -y nc redhat-lsb-core
rpm -ivh leofs-1.4.2-1.el7.x86_64.rpm
ls -l /usr/local/leofs/

Configuring Bucket Domain

LeoFS uses virtual host (vhost) mode, requiring modification of the local hosts file for bucket domain resolution.

vi /etc/hosts

Replace the existing content with the following format, substituting {BUCKET_NAME} with your custom bucket name:

127.0.0.1 localhost {BUCKET_NAME}.localhost

Example:

127.0.0.1 localhost myfirstbucket.localhost

Bucket Naming Conventions

Bucket names must adhere to Amazon S3 specifications:

  • Globally unique.
  • DNS-compliant.
  • 3 to 63 characters long.
  • No uppercase letters or underscores.
  • Start and end with lowercase letters or numbers.
  • Labels separated by periods.
  • May contain lowercase letters, numbers, and hyphens.
  • Cannot be formatted as an IP address.
  • Avoid periods in names when using virtual hosting to prevent SSL certificate issues.

Starting LeoFS Services

Start the core LeoFS components using systemctl:

systemctl start leofs-manager-master leofs-manager-slave leofs-gateway leofs-storage

Check the service status:

leofs-adm status

All components should show as running (Ring-hash may be empty initially). Then start the management service:

leofs-adm start

User and Permission Management

Create a new user (replace xxx with your username):

leofs-adm create-user xxx

This command generates an Access Key ID and Secret Access Key. Store them securely.

For domain access, configure a wildcard DNS record (e.g., *.yourdomain.com) with your DNS provider.

Set bucket access permissions:

leofs-adm update-acl <bucket> <access-key-id> <canned-ACL>

Example to set a bucket to public-read:

leofs-adm update-acl mybucket AKIAIOSFODNN7EXAMPLE public-read

Note: For enhanced security, set buckets to private and use pre-signed URLs for object access.

The default gateway port is 8080. To use port 80, modify the gateway configuration file.

Installing LeoCenter Management Interface

LeoCenter is the web management interface for LeoFS. It requires a Ruby environment. Official guide: LeoCenter Documentation.

First, upgrade the system Ruby version. Remove the old version:

sudo yum remove ruby ruby-devel -y

Install development tools and dependencies:

sudo yum groupinstall "Development Tools" -y
sudo yum install openssl-devel -y

Download, compile, and install Ruby 2.5.0:

cd /codefiles
wget http://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.0.tar.gz
tar xvfz ruby-2.5.0.tar.gz
cd ruby-2.5.0
./configure
make
make install

Install gem and switch to a faster mirror:

yum install gem -y
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
yum install ruby-devel -y
sudo gem update --system
sudo gem install bundler eventmachine -v '1.2.7'
sudo gem install rack-test -v '1.6.10'

Note: The original Taobao mirror is deprecated; use https://gems.ruby-china.com/.

Clone the LeoCenter repository:

git clone https://github.com/leo-project/leo_center.git
cd leo_center

Edit the Gemfile to use the mirror:

vi /codefiles/leo_center/Gemfile

Change source "https://rubygems.org" to:

source "https://gems.ruby-china.com/"

Switch to a suitable user (e.g., www) and install dependencies:

su www
bundle install

After dependencies are installed, start the LeoCenter web interface as per the official documentation.

Post a Comment

Your email will not be published. Required fields are marked with *.