In one hosting environment, physical servers were installed fully automatically: the machine booted from the network (PXE), CloudLinux was installed on it, followed by cPanel and the provider’s own settings. The scripts, however, had been written for CloudLinux 6. Our task was to make them work on CloudLinux 8 as well.
Starting point
CloudLinux 6 reached end of life on 30 November 2020, so there was no point installing new servers with it. The existing installation solution worked well, though, and contained many steps tailored to the provider, so we wanted to adapt it rather than rewrite it.
Solution
What changed between the two versions?
CloudLinux belongs to the RHEL family, so the differences between versions 6 and 8 are the same as between RHEL 6 and RHEL 8. For an installation script, these are the most important:
| Area | CloudLinux 6 | CloudLinux 8 |
|---|---|---|
| Service management | SysV init scripts, service, chkconfig |
systemd, systemctl |
| Package manager | yum |
dnf (the yum command remains) |
| Networking | network-scripts |
NetworkManager |
| Python | Python 2 | Python 3 |
| Firewall | iptables | firewalld, nftables |
In this project, most of the work was tracking package names and rewriting the parts that relied on SysV init scripts. The old init scripts were replaced by systemd units, for example for a step that only needs to run once, on first boot:
# /etc/systemd/system/firstboot-setup.service (example)
[Unit]
Description=First-boot setup
After=network-online.target
Wants=network-online.target
ConditionPathExists=!/var/lib/firstboot-setup.done
[Service]
Type=oneshot
ExecStart=/usr/local/sbin/firstboot-setup
ExecStartPost=/usr/bin/touch /var/lib/firstboot-setup.done
[Install]
WantedBy=multi-user.target
An API instead of configuration files
In many places, the old scripts edited the cPanel and CloudLinux configuration files directly. This works, but it’s fragile: if a new version changes the file’s format or location, the script silently writes the wrong setting.
Where possible, we replaced these steps with the vendor’s own tools: the script now makes cPanel settings through the WHM API (with the whmapi1 command on the server), and CloudLinux settings with CloudLinux’s own command-line tools. A cPanel setting looks like this:
whmapi1 set_tweaksetting key=allowremotedomains value=0
The API call validates the input, and cPanel itself makes sure the change ends up in every place it affects.
Result
The installation scripts install the servers and cPanel on CloudLinux 8, just as automatically as before. Because a good part of the configuration goes through the API, the scripts depend less on the internal file layout of a particular version.
Looking back from 2026
Extended (ELS) support for CloudLinux 6 also ended on 30 June 2024, while CloudLinux 8 receives updates until 31 May 2029. The API-based approach pays off at the next upgrade too: moving to CloudLinux 9 should mean changing far fewer steps than the move from 6 to 8 did.
Today, part of the configuration is no longer maintained by the installation scripts but by version-controlled Ansible roles – we wrote about this in the article cPanel server configuration as code. You can read about how we build and run hosting platforms on the For hosting providers page.