CloudLinux Operating System Overview and Installation Steps
CloudLinux OS is an extremely powerful operating system which is based on the CentOS.
It is designed for shared hosting providers.
It improves server stability, density, and security by isolating each tenant and giving them allocated server resources.
It creates a virtual environment for each user with help of Lightweight Virtualized Environment (LVE) feature, which allows you to limits server resources, like memory, CPU, IO, IOPS, number of processes and other limits for each tenant.
This ensures that tenants can use only allocated resources, which preventing all sites to slow down or even come to a halt.
Cloudlinux OS Features:
- Lightweight Virtualized Environment (LVE) Manager
- MySQL Governor
- PHP Selector
- Ruby Selector
- Python Selector
- Node.js Selector
- LVE-stats 2
Advantage of Cloudlinux OS:
- Isolates users from each other to avoid the bad neighbour 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)
Lightweight Virtualized Environment is a kernel-level technology, which isolates each tenant into his own environment.
Each tenant has limits on the amount of resources (CPU, IO, Memory, Processes, etc.) that can be used. If the tenant hits the limit, other users would not notice anything because the offender would be immediately throttled.
CloudLinux allows you to control the following things on the server
- Number of processes
- Number of concurrent Apache connections
- MySQL CPU usage
- MySQL read/write usage
CageFS is a virtualized per-user file system that uniquely encapsulates each customer, preventing users from seeing each other and viewing sensitive information. Additionally, CageFS prevents a large number of attacks, including most of the privilege escalation and information disclosure attacks.
III) MySQL Governor
MMySQL Governor tracks CPU and disk IO usage for every user in real time by using the dbtop utility and throttles MySQL queries by using same-per-user LVE limits.
IV) PHP Selector
The PHP Selector allows end users to select the specific version of PHP they need. It’s offering all popular versions of PHP, with more than 120 PHP extensions to choose from.
V) Ruby Selector
The Ruby Selector allows end users to choose the Ruby version for applications and install additional modules (gems) to the application environment.
VI) Ruby Selector
The Python Selector allows end users to choose 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 server from scratch then directly use the CloudLinux ISO to setup a system.
If you want to convert existing CentOS or RHEL servers then follow the below steps to install cloudlinux on your system.
To do so, download the “cldeploy” script, which automatically install CloudLinux kernel and all other required packages such as 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 CloudLinux kernel with LVE.
To use LVE you have to have CloudLinux kernel installed, and LVE module loaded. You can check the running kernel by using the uname command
# uname -r 2.6.32-531.29.2.lve18.104.22.168.el6.x86_64
Use the lsmod command to check if 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
How to Uninstall Cloudlinux
Use the same script with the “-c” option to uninstall CloudLinux OS from your system if you are not happy.
When you run the script, this will ‘convert’ the system back to CentOS. Even if 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, some of the packages from CloudLinux repo will still be present. They are same as CentOS packages, and no need to be removed. They will be updated in the future from CentOS repositories, as new versions release.
2) How to Install LVE Manager
LVE Manager is installed by default on most servers when you run the “cldeploy” script but if it is missing you can always install it by running the below command.
# 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 below command to install MySQL Governor on your server.
# yum install governor-mysql # /usr/share/lve/dbgovernor/mysqlgovernor.py --install
# Installing MySQL Governor on MariaDB Server # [email protected] [~]# yum install governor-mysql [email protected] [~]# /usr/share/lve/dbgovernor/db-select-mysql --mysql-version=mariadb55 [email protected] [~]# /usr/share/lve/dbgovernor/mysqlgovernor.py --install # start MySQL Governor # [email protected] [~]# service db_governor start # stop MySQL Governor # [email protected] [~]# service db_governor stop # restart MySQL Governor # [email protected] [~]# service db_governor restart # MySQL Governor configuration file # [email protected] [~]# /etc/container/mysql-governor.xml # To remove MySQL governor # [email protected] [~]# /usr/share/lve/dbgovernor/mysqlgovernor.py --delete
5) How to install PHP Selector
The installation of PHP Selector presumes that you already have CageFS & LVE Manager installed.
# Installation of different versions of PHP & modules # [email protected] [~]# yum groupinstall alt-php # Update CageFS & LVE Manager with support for PHP Alternatives # [email protected] [~]# yum update cagefs lvemanager # remove PHP Selector # [email protected] [~]# yum groupremove alt-php
That’s all now, Will come with CloudLinux Administrative commands. Please stay tune with 2daygeek.