The only drawback of cPanel is that it’s neither open-source nor free. The same is true for Plesk. However, both are widely used.

If you’re looking for a powerful solution to manage your web server or resell web hosting services, check out CloudPanel CE [Link] to see if it meets your requirements.

Back to cPanel: this tutorial covers installing cPanel and configuring essential server settings. It does not cover how to use cPanel itself.

Originally designed for CentOS, cPanel later provided an upgrade path to AlmaLinux for existing installations. It now supports Ubuntu 22.04 LTS.


SYSTEM REQUIREMENTS

Deploy a fresh default installation of Ubuntu 22.04 LTS (do not enable AppArmor). Then switch to root.

sudo su -

UFW (firewall) must be disabled.

iptables-save > ~/firewall.rules
systemctl stop ufw.service
systemctl disable ufw.service

Set an FQDN as the hostname.

hostnamectl set-hostname cpanelserver.mydomain.com

Add cpanelserver.mydomain.com and cpanelserver to /etc/hosts. Example with a placeholder public IP:

127.0.0.1 localhost cpanelserver
200.200.200.200 cpanelserver.mydomain.com

Upgrade all system packages to the latest versions.

apt update && apt upgrade -y

FULL CPANEL INSTALLATION

Download and run the installation script.

cd /home && curl -o latest -L https://securedownloads.cpanel.net/latest && sh latest

That’s it!

Open your browser and go to the following address, then log in with your root credentials.

https://1.2.3.4:2087

Log in with the system root account and its password to complete the installation.

Alternatively, a URL will be generated at the end of the installation. Use that instead and create an administrator account (other than root).


INSTALLING CPANEL DNS ONLY AND WP SQUARED

The “DNS Only” license is a free, limited-feature cPanel & WHM server type.

cd /home && curl -o latest -L https://securedownloads.cpanel.net/latest-dnsonly && sh latest

After installation, create a DNS cluster to sync configuration from the Master to the DNS Only Slave.

WP Squared is a build tailored specifically for WordPress.

cd /home && curl -o latest -L https://securedownloads.cpanel.net/latest-wp2 && sh latest

CLUSTERING AND DNS CLUSTERING

ON THE SLAVE

Manage API Tokens > Generate Token.

Select: Everything

ON THE MASTER

Configuration Cluster > Create. Enter the IP of the Slave and the generated token.

DNS Cluster > Enable DNS Clustering.

Manage API Tokens > Generate Token.

Select: Everything

ON THE SLAVE

Configuration Cluster > Create. Enter the IP of the Master and the generated token.

DNS Cluster > Enable DNS Clustering.

ON THE MASTER

Manage API Tokens > Generate Token.

Select: Everything

ON THE SLAVE

DNS Cluster > Add a new server to the cluster > Configure. Enter the IP of the Master and the generated token.

Manage API Tokens > Generate Token.

Select: Everything

ON THE MASTER

DNS Cluster > Add a new server to the cluster > Configure. Enter the IP of the Slave and the generated token.


BONUS

I strongly recommend trying CloudPanel for its lightweight design and simplicity. Performance is significantly better than cPanel and Plesk, at no cost.

sudo apt update && sudo apt -y upgrade && sudo apt -y install curl wget
curl -sS https://installer.cloudpanel.io/ce/v2/install.sh -o install.sh; \
echo "a3ba69a8102345127b4ae0e28cfe89daca675cbc63cd39225133cdd2fa02ad36 install.sh" | \
sha256sum -c && sudo bash install.sh

Navigate to: https://200.200.200.200:8443 (use your actual public or private IP).

Some CLI commands are available for automation or password recovery [Link].