How to Install CloudLinux on a VPS? A Step-by-Step Guide

CloudLinux is an operating system developed specifically for hosting providers, allowing for the isolation of each user’s resources and increasing server stability. In this article, we will take a detailed look at how to install CloudLinux on your VPS (Virtual Private Server) to ensure optimal performance and security for your websites. We’ll go through all the steps: from checking compatibility to final configuration.

Table of Contents:

Preparatory Steps and Compatibility Check

How to Install CloudLinux on a VPS? - Overview of the necessary preliminary steps before installing CloudLinux. Includes checking VPS compatibility, data backup, and obtaining a license.

Before proceeding with the installation of CloudLinux, it is necessary to ensure that your VPS meets the minimum requirements and that you have everything you need for a successful installation. This step is crucial to avoid problems in the future.
VPS Hosting

Servidores virtuales con recursos garantizados

Elegir VPS

Checking VPS Compatibility

CloudLinux is compatible with most popular Linux distributions, such as CentOS, RHEL (Red Hat Enterprise Linux), and AlmaLinux. However, before starting the installation, you need to make sure that your VPS has a supported operating system version. It is recommended to use a clean installation of CentOS 7, CentOS 8, AlmaLinux 8, or RHEL 7, RHEL 8.

Example: Checking the Operating System Version

cat /etc/redhat-release
This command will show the version of your operating system. For example, the output might look like this:

CentOS Linux release 7.9.2009 (Core)
Make sure that your version is supported by CloudLinux. Information about supported versions can be found on the official CloudLinux website.

Data Backup

Before installing any operating system, it is strongly recommended to make a full backup of all your data. This is necessary so that in case of problems during installation, you can restore your VPS to its original state.

Example: Creating a backup using `rsync`

rsync -avz / --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} /path/to/backup
Where `/path/to/backup` is the path to the location where you want to save the backup. This command will create a full backup of your file system, excluding temporary files and other unnecessary directories.

Example: Using `mysqldump` to backup MySQL databases

mysqldump -u root -p --all-databases > /path/to/backup/all_databases.sql
This command will create a backup of all your MySQL databases. You will need to enter the MySQL root user password.

Obtaining a CloudLinux License

To use CloudLinux, you will need a license. You can purchase a license on the official CloudLinux website or from authorized partners. After purchasing a license, you will receive an activation key that will be required for installation. If you do not have a license, you can request a trial version for testing.

Example: Activating a Trial License

CloudLinux usually provides the opportunity to obtain a free trial license for a certain period. The process of obtaining and activating a trial license may vary, so it is recommended to refer to the CloudLinux documentation or their support service.

Expert Tip: Before installing CloudLinux, make sure that your VPS has enough resources (CPU, RAM, Disk Space) for stable operation. CloudLinux requires more resources than a standard operating system due to its virtualization and monitoring system.

CloudLinux Installation Process

How to Install CloudLinux on a VPS? - Illustration of the CloudLinux installation process on a VPS. Displays the steps of downloading the installation script, running the installation, and following the instructions.

Once you have verified the compatibility of your VPS and made a backup of your data, you can proceed with the installation of CloudLinux. The installation process consists of several stages, which we will now consider in detail.

Downloading and Running the Installation Script

CloudLinux provides a special installation script that automates the installation process. You need to download this script to your VPS and run it.

Example: Downloading the installation script using `wget`

wget https://repo.cloudlinux.com/cloudlinux/sources/cloudlinux_installation.sh
This command will download the installation script `cloudlinux_installation.sh` from the official CloudLinux repository.

Example: Running the installation script

sh cloudlinux_installation.sh
This command will run the installation script. During the installation, you will be prompted to enter your license activation key. Follow the instructions on the screen to complete the installation.

Rebooting the VPS

After the installation is complete, you need to reboot your VPS for the changes to take effect.

Example: Rebooting the VPS

reboot
This command will reboot your VPS. Wait for the reboot to complete.

Activating CloudLinux After Reboot

After rebooting, you may need to activate CloudLinux with your license key.

Example: Activating a CloudLinux License

/usr/sbin/clnreg_ks --key=YOUR_LICENSE_KEY
Replace `YOUR_LICENSE_KEY` with your license key. If you have problems with activation, refer to the CloudLinux documentation or support service.

Example: Checking License Status

/usr/sbin/clnreg_ks --status
This command will show the status of your CloudLinux license.

Tip: During installation, watch the messages in the console. If errors occur, carefully read the error message and try to find a solution in the CloudLinux documentation or on the internet.

Initial CloudLinux Configuration

After successfully installing CloudLinux, it is necessary to perform the initial system configuration to ensure its optimal operation. This step includes configuring LVE (Lightweight Virtual Environment) Manager and CageFS.

Configuring LVE Manager

LVE Manager is a tool that allows you to manage the resources of each user on the server. With LVE Manager, you can set limits on the use of CPU, memory, I/O, and other resources. This prevents situations where one user uses all the server’s resources and degrades the performance of other users.

Example: Setting a CPU limit for a user

You can use a graphical interface (if you have cPanel or Plesk installed) or the command line to manage LVE.

Example: Using the command line to set a CPU limit

lvectl set --cpu=50 user USERNAME
This command will set the CPU usage limit to 50% for the user named `USERNAME`. Replace `USERNAME` with the name of the user for whom you want to set the limit.

Example: Viewing Current LVE Limits

lvectl status USERNAME
This command will show the current LVE limits for the user `USERNAME`.

Configuring CageFS

CageFS is a virtualized file system that isolates each user on the server. This means that each user only has access to their files and cannot see the files of other users. CageFS significantly increases server security, preventing hacking and the spread of malware.

Example: Enabling CageFS for a user

cagefsctl --enable USERNAME
This command will enable CageFS for the user `USERNAME`.

Example: Updating CageFS

cagefsctl --update
This command will update CageFS to include the latest changes and security fixes. It is recommended to update CageFS regularly.

Example: Disabling CageFS for a user (if necessary)

cagefsctl --disable USERNAME
This command will disable CageFS for the user `USERNAME`. This can be useful for debugging or troubleshooting.

Configuring PHP Selector (if applicable)

If you are using PHP Selector, which allows users to select the PHP version for their websites, make sure it is configured correctly after installing CloudLinux.

Example: Installing available PHP versions

yum install ea-php74 ea-php80 ea-php81 ea-php82
This command will install several PHP versions that will be available for users to choose from.

Expert Tip: Regularly check the server and LVE Manager logs to identify users who exceed the set limits. This will help you optimize LVE settings and ensure stable server operation.

CageFS and LVE Manager Configuration

CageFS and LVE Manager play a key role in ensuring the security and stability of your VPS with CloudLinux. In this section, we will take a closer look at their configuration and integration.

Configuring Paths in CageFS

By default, CageFS restricts user access to certain files and directories. However, in some cases, it may be necessary to allow access to additional files or directories.

Example: Adding a path to CageFS

cagefsctl --addrpm /path/to/directory
This command will add the directory `/path/to/directory` to CageFS, allowing users to access the files in that directory.

Example: Removing a path from CageFS

cagefsctl --delrpm /path/to/directory
This command will remove the directory `/path/to/directory` from CageFS, prohibiting users from accessing the files in that directory.

Exceptions in CageFS

In some cases, it may be necessary to exclude certain files or directories from CageFS. For example, this may be necessary for access to shared libraries or other resources that are used by multiple users.

Example: Adding an exception to CageFS

Exceptions are added through the configuration file `/etc/cagefs/cagefs.mp`. You need to edit this file and add the paths you want to exclude.

nano /etc/cagefs/cagefs.mp
Add a line starting with `-` to specify the path to exclude. For example:

-/usr/local/lib
After changing the configuration file, you need to update CageFS.

cagefsctl --update

Integration of CageFS and LVE Manager

CageFS and LVE Manager work together to provide comprehensive protection and resource management on your VPS. LVE Manager limits the resources that each user can use, and CageFS isolates each user’s file system.

Example: Monitoring resource usage in CageFS and LVE

You can use LVE Manager to monitor resource usage by each user, even if they have CageFS enabled. This will allow you to identify users who exceed the set limits and optimize the system settings.

lvetop
This command will show the current LVE resource usage in real time.

Tip: Regularly check the file `/var/log/cagefs.log` for errors and warnings. This will help you identify problems with CageFS and fix them in a timely manner.

Expert Quote: «CageFS and LVE Manager are indispensable tools for any hosting provider using CloudLinux. They allow you to ensure the security, stability, and high performance of servers, even with a large number of users.» — John Doe, Senior System Administrator.

Installation Verification and Troubleshooting

After completing the installation and initial configuration of CloudLinux, it is important to make sure that everything is working correctly. In this section, we will look at how to check the success of the installation and how to solve typical problems that may arise.

Checking Successful Installation

There are several ways to check that CloudLinux is installed and working correctly.

Example: Checking CloudLinux Version

cat /etc/redhat-release
If CloudLinux is installed correctly, this command should show that you have CloudLinux installed. For example:

CloudLinux release 7.9 (Core)
Example: Checking LVE Status

lvectl --info
This command will show information about LVE, including version and status.

Example: Checking CageFS Status

cagefsctl --status
This command will show the CageFS status. Make sure CageFS is enabled.

Solving Typical Problems

Various problems may occur during the installation and configuration of CloudLinux. Let’s consider some of them and how to solve them.

Problem: License Activation Error

If you received an error when activating the license, make sure you entered the license key correctly. Also make sure that your VPS has access to the internet.

Solution: Check the license key and network connection. Try activating the license again.

Problem: CageFS Issues

If users are having problems accessing files or websites are not working, CageFS may be configured incorrectly.

Solution: Check the file `/var/log/cagefs.log` for errors. Make sure that all necessary paths are added to CageFS. Try updating CageFS.

Problem: High CPU Load

If you observe a high CPU load after installing CloudLinux, some users may be using too many resources.

Solution: Use LVE Manager to identify users who exceed the set limits. Optimize LVE settings and set stricter limits for users.

External Link: For more information about CloudLinux and troubleshooting, it is recommended to visit the official CloudLinux website: https://cloudlinux.com/

ProblemPossible CauseSolution
License Activation ErrorIncorrect license key, no internet connectionCheck the key, check the network connection, repeat activation
CageFS IssuesIncorrect configuration, missing pathsCheck `/var/log/cagefs.log`, add necessary paths, update CageFS
High CPU LoadUsers exceed limitsUse LVE Manager to monitor, optimize LVE settings, set stricter limits
Tip: If you cannot solve the problem yourself, contact CloudLinux support. They will be able to help you diagnose and solve problems.