CloudLinux OS is the most powerful operating system based on CentOS.
It is specifically designed for shared hosting providers.
It improves server stability, density and security by isolating each tenant and providing them with limited dedicated server resources.
It creates a virtual environment for each user with the help of the Lightweight Virtualized Environment (LVE) feature, which allows you to control server resources such as memory, CPU, IO, IOPS, number of processes and other limits for each tenant.
This ensures that tenants can use only allocated resources, which prevent resource spikes and make your servers rock-solid stable, even in the most stressful situations.
Cloudlinux OS Features:
- Lightweight Virtualized Environment (LVE) Manager
- MySQL Governor
- PHP Selector
- Ruby Selector
- Python Selector
- Node.js Selector
- LVE-stats 2
Advantages of Cloudlinux OS:
- Isolates users from each other to avoid the bad neighbor effect
- Prevents users from seeing configuration files and other private information
- Allows end user to select different PHP, Ruby, Python and Node.js versions
- Gives the power to monitor and controls many things, such as CPU, IO, Memory, and others
- Allows to restrict MySQL database abusers
- Compatible with all major control panels
- Interchangeable with CentOS and RHEL
I) Lightweight Virtualized Environment (LVE)
The lightweight virtualized environment (LVE) is a kernel-level technology, that isolates each tenant in its own environment.
There are limits to the amount of resources (CPU, IO, memory, processes, etc.) that each tenant can use. If the lessee hits the limit, other users will not notice anything because the offender will be triggered immediately.
CloudLinux allows you to control the following resources on the server;
- Number of processes
- Number of concurrent Apache connections
- MySQL CPU usage
- MySQL read/write usage
CageFS is a virtualized file system per user that connects each client individually, preventing users from viewing each other and their sensitive information.
In addition, CageFS prevents a number of attacks, including most privilege escalation and information disclosure attacks.
III) MySQL Governor
MySQL Governor monitors the CPU and disk IO usage of each user in real time using the dbtop application and triggers MySQL queries based on LVE limits.
This will automatically detect and kill long-running queries. This includes MySQL 5.1 – 5.7 and MariaDB 5.x and 10.x.
IV) PHP Selector
PHP Selector allows end users to select the specific version of PHP they want. It offers all the popular versions of PHP, including over 120 PHP extensions.
V) Ruby Selector
Ruby Selector allows end users to select the Ruby version for applications and install additional modules (gems) for the application environment.
VI) Python Selector
Python Selector allows end users to select the Python version as an application and install additional modules.
VII) LVE-stats 2
LVE-stats 2 collects LVE usage statistics (CPU, memory, disk space usage) and allows to query the data.
1) How to Install Cloudlinux on Existing CentOS or RHEL Servers
If you are building a new server, use CloudLinux ISO directly to set up a system.
If you want to convert existing CentOS or RHEL servers, follow these steps to install cloudlinux on your system.
To do so, download the “cldeploy” script, which will automatically install the CloudLinux kernel and all other required packages, including LVE, CageFS, MySQL Governor and command line tools.
# wget https://repo.cloudlinux.com/cloudlinux/sources/cln/cldeploy
If you have an activation key, run the following command.
# sh cldeploy -k [activation_key]
If you have an IP-based license, run the following command.
# sh cldeploy -i
Restart the system once you have activated the license to use the CloudLinux kernel with LVE.
You must have the CloudLinux kernel installed to use LVE, and the LVE module should be loaded. Use the uname command to verify that you are using the CloudLinux kernel.
# uname -r 2.6.32-531.29.2.lve18.104.22.168.el6.x86_64
Use the lsmod command to check if the LVE kernel module is loaded.
# lsmod|grep lve lve 66418 1
For iolimits module
# lsmod|grep iolimits iolimits 4999 4
You can easily toggle LVE on/off by making the changes in the following file.
# vi /etc/sysconfig/lve LVE_ENABLE=yes
For IO limits
# vi /etc/sysconfig/iolimits IOLIMITS_ENABLED=yes
1a) How to Uninstall Cloudlinux
If you are not happy, use the same script with the “-c” option to uninstall CloudLinux OS from your system.
When you run the script, it converts the system back to CentOS. Although the original system was RHEL.
# wget -O cldeploy https://repo.cloudlinux.com/cloudlinux/sources/cln/cldeploy # sh cldeploy -c #reboot
The below packages will be removed as part of the uninstall processes.
- LVE related packages will be removed.
- CloudLinux repositories & yum plugin will be removed.
- CentOS repositories will be setup.
Also perform the following steps.
Delete CloudLinux kernel by running the below command.
# rpm -e --nodeps kernel-2.6.32-673.26.1.lve1.4.27.el6.x86_64
Run the below command to install new CentOS kernel once you deleted CloudLinux kernel.
# yum install kernel
To remove unused kmods and lve libs run:
# yum remove lve kmod*lve*
Make a note, there are still some packages from the CloudLinux repo. They are similar to CentOS packages and do not require removal. When new versions are released they will be updated from CentOS repositories in the future.
2) How to Install LVE Manager
LVE Manager is installed by default on most servers when you run the “cldeploy” script, but if it does not, you can always install it by running the command below.
# yum install lvemanager
You can find the LVE defult limit configuration file in the following location.
You can easily manage resource using the lvectl command
3) How to Install CageFS
CageFS is installed by default on most of the servers. If it is missing you can always install it by running.
# yum install cagefs
You can manage cagefs using the cagefsctl command.
To uninstall CageFS, first you need to disable and remove all directories from cagefs.
# /usr/sbin/cagefsctl --remove-all
Finally uninstall cagefs.
# yum remove cagefs
4) How to Install MySQL Governor
Run the command below to install MySQL Governor on your server. Once you have installed the MySQL Governor package, run the following commands based on your setup to configure MySQL Governor properly.
# yum install governor-mysql
If you are installing CloudLinux on a server running MySQL already, set your current MySQL version instead of XX before calling installation script.
- 55 — MySQL v5.5
- 56 — MySQL v5.6
- 80 — MySQL v8.0
# /usr/share/lve/dbgovernor/mysqlgovernor.py --mysql-version=mysqlXX # /usr/share/lve/dbgovernor/mysqlgovernor.py --install
$ /usr/share/lve/dbgovernor/mysqlgovernor.py --mysql-version=mariadbXX $ /usr/share/lve/dbgovernor/mysqlgovernor.py --install
If you have never installed MySQL or MariaDB on your system, use the above commands as needed.
You will need to restart the MySQL Governor service whenever you make changes to the configuration file to take the changes effect.
For RHEL/CentOS 6:
# service db_governor restart
For RHEL/CentOS 7/8:
# systemctl restart db_governor
The MySQL governor configuration is located at “/etc/container/mysql-governor.xml”, and you can make manual changes as needed, but it is advisable to make changes to the configuration file using the “dbctl” tool.
5) How to install PHP Selector
The PHP Selector allows end users to select the specific version of PHP they need. It supports more than 120 PHP extensions.
Make a note, you should already have installed CageFS & LVE Manager.
# yum groupinstall alt-php # yum update cagefs lvemanager
For instance, alternative “phpX.X” versions should load “/opt/alt/phpXX/etc/php.ini” file and scan “/opt/alt/phpXX/etc/php.d” directory for modules:
To remove it.
# yum groupremove alt-php