Environment Preparation and Installation
This guide is based on CentOS Linux release 7.5.1804 (Core) 64-bit. It is recommended to update the system and install necessary tools before proceeding.
yum update -y
yum install screen wget git -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
sudo yum install redhat-lsb-core
sudo rpm -ivh leofs-1.4.2-1.el7.x86_64.rpm
ls -l /usr/local/leofs/
Note: The LeoFS project is actively updated. Please refer to the official installation documentation for the latest version and instructions.
Configuring Buckets and Local DNS Resolution
In LeoFS, bucket names must follow DNS naming conventions for virtual-hosted style access. First, modify the local hosts file.
vi /etc/hosts
Replace the existing content:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
With the following format, replacing {BUCKET_NAME} with your custom bucket name:
127.0.0.1 localhost {BUCKET_NAME}.localhost
For example, to create a bucket named myfirstbucket:
127.0.0.1 localhost myfirstbucket.localhost
Save and exit the file.
Bucket Naming Rules
For compatibility, bucket names must adhere to these rules:
- Globally unique.
- Between 3 and 63 characters long.
- Contain only lowercase letters, numbers, and hyphens (-).
- Cannot contain uppercase letters or underscores.
- Must start and end with a lowercase letter or number.
- Adjacent parts can be separated by a period (.), but avoid periods to prevent issues with SSL wildcard certificates.
- Cannot be formatted as an IP address (e.g., 192.168.5.4).
Starting Services and Basic Management
Starting Core Services
Use systemctl to start the core LeoFS components:
systemctl start leofs-manager-master leofs-manager-slave leofs-gateway leofs-storage
Checking Service Status
Use the administrative command to check the service status:
leofs-adm status
Normally, all components except the Ring-hash (for consistency checks) should show as running. Then, start the management service:
leofs-adm start
Creating a User and Access Keys
Create a new user; the system will generate corresponding Access Key and Secret Key:
leofs-adm create-user
Setting Bucket Access Permissions
Use the following command to set an Access Control List (ACL) for a specified bucket:
leofs-adm update-acl <bucket> <access-key-id> <canned-ACL>
For example, to set bucket backet01 to public-read:
leofs-adm update-acl backet01 fb35f205b0359e06720d public-read
Note: The default gateway service port is 8080. To serve directly on port 80, modify the gateway configuration.
Security Recommendation: For sensitive data, set bucket permissions to private and use pre-signed URLs for access.
Installing the LeoCenter Management Interface
LeoCenter is the web management interface for LeoFS. Ensure your system meets the requirements before installation.
Upgrading the Ruby Environment
If the system's Ruby version is too low (e.g., 2.0), upgrade to version 2.2 or higher. First, remove the old version:
sudo yum remove ruby ruby-devel -y
Install compilation 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 xvfvz ruby-2.5.0.tar.gz
cd ruby-2.5.0
./configure
make
make install
Installing RubyGems and Project Dependencies
Install the gem package manager and configure a domestic mirror for faster downloads:
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
sudo gem install eventmachine -v '1.2.7'
sudo gem install rack-test -v '1.6.10' --source 'https://gems.ruby-china.com/'
Clone the LeoCenter repository and enter its directory:
git clone https://github.com/leo-project/leo_center.git
cd leo_center
Edit the project's Gemfile to change the source to the domestic mirror:
vi /codefiles/leo_center/Gemfile
Change the top source line to:
source "https://gems.ruby-china.com/"
Finally, install the project dependencies (recommended under a non-root user, e.g., www):
su www
bundle install
After completing these steps, refer to the official LeoCenter documentation to start and configure the web management interface.