How to Install CloudLinux on a DirectAdmin Server

Convert a DirectAdmin server on AlmaLinux 9 to CloudLinux with cldeploy, switch CustomBuild to lsphp, set up CageFS and PHP Selector, and verify with cldiag.

Published
Reading time
4 min

CloudLinux is not installed from an ISO. You take a working AlmaLinux server, with DirectAdmin already on it, and convert it in place with one script and one reboot. This guide does that on AlmaLinux 9, then makes the two CustomBuild changes DirectAdmin needs, enables CageFS and PHP Selector, and checks the result. Allow an hour including the reboot.

Before you start

You need a server on AlmaLinux 9 (Rocky 9 and RHEL 9 also work; 8 and 10 convert to the matching CloudLinux major) with DirectAdmin installed and its accounts working. CloudLinux is x86-64 only.

You need a licence. Buy one at cloudlinux.com or start the trial, and note the activation key. If you bought an IP-based licence instead, the install command differs by one flag, shown below.

Take a backup first. Run Admin Level → Server Manager → Admin Backup/Transfer to a remote FTP or SFTP destination, and if the server is a VPS, take a snapshot as well. The conversion replaces the kernel and several system packages; it is well tested, but the reboot is the moment you want a way back.

Check free space. CageFS builds a skeleton filesystem of around 7 GB under /usr/share/cagefs-skeleton, on top of the packages the converter installs, so have at least 15 GB free on the root filesystem.

Run cldeploy

As root:

bash
wget https://repo.cloudlinux.com/cloudlinux/sources/cln/cldeploy
sh cldeploy -k YOUR-ACTIVATION-KEY

For an IP-based licence, use sh cldeploy -i instead of -k. The script registers the server with CloudLinux, swaps the AlmaLinux repositories for CloudLinux ones, installs the LVE kernel, lve-utils, lve-stats and lvemanager, and replaces the handful of packages that differ. It detects DirectAdmin and installs the panel plugin. Expect ten to twenty minutes, then a message telling you to reboot:

bash
reboot

Verify the kernel

After the server comes back:

bash
uname -r
cat /etc/cloudlinux-release

The kernel name must contain lve, for example 5.14.0-…lve.el9. If it does not, the server booted the old AlmaLinux kernel. Check what GRUB thinks the default is with grubby --default-kernel, and if it points at the old kernel, set it to the CloudLinux one with grubby --set-default /boot/vmlinuz-<lve kernel> and reboot again. Nothing in CloudLinux works until the LVE kernel is running.

Switch CustomBuild to lsphp

DirectAdmin's default PHP mode is PHP-FPM, and PHP Selector does not work with PHP-FPM on DirectAdmin. The supported mode is lsphp, which is CloudLinux's mod_lsapi: faster than PHP-FPM under shared-hosting load, with opcache per user, and the mode PHP Selector and CageFS expect. Tell CustomBuild about CloudLinux and switch the mode:

bash
cd /usr/local/directadmin/custombuild
./build update
./build set cloudlinux yes
./build set php1_mode lsphp
./build php n
./build rewrite_confs

If you run more than one PHP slot, set php2_mode (and so on) to lsphp as well before ./build php n. The rebuild takes a while; sites keep serving from the old handler until rewrite_confs switches them over.

This works with the apache and nginx_apache web server options. Keep one of those; the other web servers are outside this guide.

Enable CageFS and PHP Selector

CageFS gives each user a private view of the filesystem and is required by PHP Selector. Install it, build the skeleton and enable it for everyone:

bash
yum install cagefs
cagefsctl --init
cagefsctl --enable-all

--init is the slow step. Then install the alt-php packages that PHP Selector offers to users and push them into the skeleton:

bash
yum groupinstall alt-php
cagefsctl --force-update

What CageFS changes for users, and the things it can break, are in CageFS: what it does and how to enable it.

What appears in DirectAdmin

Log in to DirectAdmin at https://server1.example.com:2222 as admin. Under Admin Level → Extra Features there is a new CloudLinux Manager (older skins call it LVE Manager). Its tabs are Current Usage, Users, Statistics, Packages, Options and Selector. Nothing is limited yet beyond the defaults (100% CPU, 1 GB memory, 20 entry processes), and every existing account already has an LVE. Setting proper values per package is the next job, covered in setting LVE limits.

Log in as a user (Login as from the user list) and look under Advanced Features. Select PHP Version lets the user pick a PHP version and extensions; Resource Usage shows their LVE usage and faults. Neither needs anything from you.

Check everything with cldiag

CloudLinux ships a diagnostics tool that checks the kernel, licence, CageFS, PHP Selector, the LVE setup and the symlink protection in one go:

bash
cldiag --all

Every line should be OK. The common failure right after an install is a PHP Selector check complaining about the handler, which means php1_mode is still php-fpm; rerun the CustomBuild steps. If the licence check fails, clnreg_ks --force re-registers the server.

Going back

If you need to undo the conversion, the same tool does it:

bash
/usr/sbin/cldeploy -c
reboot

That restores the AlmaLinux repositories and kernel and removes the CloudLinux packages. Then put CustomBuild back the way it was:

bash
cd /usr/local/directadmin/custombuild
./build set cloudlinux no
./build set php1_mode php-fpm
./build php n
./build rewrite_confs

Users lose their per-account PHP versions when PHP Selector goes, so check which versions people had chosen and set the equivalent per domain in DirectAdmin before you switch back. On a VPSPioneer managed VPS we do the conversion and the CustomBuild changes for you, as part of the service.

#cloudlinux#directadmin#installation#custombuild

Keep reading

More from CloudLinux

All guides

CloudLinux

LVE Explained: How CloudLinux Isolates Accounts on a Shared Server

What an LVE is, which processes run inside it, the seven limits CloudLinux enforces, what a user sees when each one is hit, and how to watch it live with lveps.

4 min read →

CloudLinux

CloudLinux 9 vs CloudLinux 10: Which One to Install in 2026

CloudLinux 9.8 and 10.2 compared: kernels, lifecycles, panel readiness, PHP and MariaDB availability, the upgrade path, and which to pick for a new server.

4 min read →

CloudLinux

What Is CloudLinux OS and Who Actually Needs It?

What CloudLinux OS does on a shared or reseller server, how the Shared, Shared Pro, Solo and Admin editions differ, and when plain AlmaLinux is enough.

4 min read →