How to Install cPanel on Your Server or VPS: Updated Guide by Distribution

How to Install cPanel on Your Server or VPS: Updated Guide by Distribution

cPanel & WHM is the most widely used control panel in the web hosting industry. If you have a dedicated server or VPS with Webzi (or any other provider), this guide shows you how to install cPanel from scratch on the currently supported operating systems.

⚠️ Important: cPanel must be installed on a clean (minimal) operating system, without Apache, Nginx, MySQL, or any other pre-installed control panel. cPanel installs and manages its own services during the process.

Supported operating systems

As of today, cPanel & WHM is compatible with the following Linux distributions for new installations:

Operating System cPanel Version Supported until Recommendation
AlmaLinux 8 v110+ March 2029 ✅ Stable and proven
AlmaLinux 9 v114+ May 2032 ⭐ Recommended
Rocky Linux 8 v110+ May 2029 ✅ Stable
Rocky Linux 9 v114+ May 2032 ✅ Stable
CloudLinux 8/9 v110+/v114+ Same as Alma/Rocky ⭐ Ideal for shared hosting
Ubuntu 22.04 LTS v114+ Verify with cPanel ⚠️ Verify compatibility

⚠️ CentOS 7 is no longer supported for new cPanel installations. If your server still uses CentOS 7, you will need to migrate to AlmaLinux or Rocky Linux. cPanel offers the ELevate tool to facilitate this process.

Prerequisites

  • Root SSH access to the server.
  • Clean operating system (minimal installation, no pre-installed web services).
  • Minimum: 1 GB RAM, 20 GB disk (recommended: 2+ GB RAM, SSD/NVMe).
  • Static IP (DHCP-assigned IPs are not supported).
  • Valid FQDN hostname (example: server.yourdomain.com), which resolves to the server's IP and does not match any domain you plan to host.
  • Valid cPanel license (you can use a free 15-day trial for the first installation).

Step 1: Connect via SSH

Connect to your server using Terminal (Linux/macOS) or PuTTY (Windows):

ssh root@your-server-ip

Step 2: Set the hostname

Set a valid FQDN hostname. This name should be a subdomain that resolves to your server's IP (for example: server.yourdomain.com):

hostnamectl set-hostname server.yourdomain.com

Step 3: Update the operating system

Before installing cPanel, make sure all packages are up to date:

AlmaLinux / Rocky Linux / CloudLinux:

dnf update -y

Ubuntu 22.04 LTS:

apt update && apt upgrade -y

Step 4: Disable SELinux (RHEL distributions only)

cPanel is not compatible with SELinux. You must disable it before installation. This step does not apply to Ubuntu.

Disable it temporarily:

setenforce 0

Disable it permanently:

sed -i 's/^SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

Step 5: Configure the Network Manager

Network Manager handling varies depending on the operating system version:

AlmaLinux 8 / Rocky Linux 8 / CloudLinux 8 — Disable:

On version 8, the cPanel installer automatically disables Network Manager and enables network.service. However, to avoid issues during installation, it is recommended to do it manually:

systemctl stop NetworkManager.service && systemctl disable NetworkManager.service

AlmaLinux 9 / Rocky Linux 9 / CloudLinux 9 — Do not disable:

On version 9, Network Manager remains enabled and is the default network manager. Do not disable it, as cPanel requires it on these versions.

Ubuntu 22.04 LTS:

Ubuntu uses netplan as its network manager. No changes are needed.

Step 6: Disable the firewall (temporary)

During installation, cPanel needs unrestricted network access. Temporarily disable the firewall:

AlmaLinux / Rocky Linux / CloudLinux:

systemctl stop firewalld && systemctl disable firewalld

Ubuntu 22.04 LTS:

ufw disable

ℹ️ Note: After installation, it is recommended to install a firewall such as CSF (ConfigServer Security & Firewall) instead of reactivating the native system firewall, as CSF is designed to work alongside cPanel.

By default, cPanel installs MySQL 8.0. If you want the installation to use MySQL 8.4 from the start, you must create a configuration profile before running the installer:

mkdir /root/cpanel_profile

echo "mysql-version=8.4" > /root/cpanel_profile/cpanel.config

You can also specify other versions according to your needs:

Engine Value in cpanel.config
MySQL 8.0 mysql-version=8.0
MySQL 8.4 (recommended) mysql-version=8.4
MariaDB 10.6 mysql-version=10.6
MariaDB 10.11 mysql-version=10.11

⚠️ Important: This step must be performed before running the cPanel installer. If you already installed cPanel with a different MySQL version, the change will need to be made afterwards from WHM. More information in the official cPanel documentation.

Step 8: Install required tools and start screen

Install the basic required tools and use screen or tmux so the installation continues even if the SSH connection is lost:

AlmaLinux / Rocky Linux / CloudLinux:

dnf install -y perl curl wget screen screen

Ubuntu 22.04 LTS:

apt install -y perl curl wget screen screen

ℹ️ Tip: If you lose your SSH connection during installation, reconnect and run screen -r to return to the session where the installer is running.

Step 9: Run the cPanel installer

This command is the same for all supported distributions:

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

The installation may take between 20 and 60 minutes depending on server resources and connection speed. Progress is logged to /var/log/cpanel-install.log.

ℹ️ Note about CloudLinux: If your IP has an active CloudLinux license, the cPanel installer will automatically convert the operating system to CloudLinux. If you want to prevent this conversion and keep AlmaLinux or Rocky Linux, use the --skip-cloudlinux flag when running the installer.

Step 10: Verify the license

If after installation you experience a license error, update it with the following command:

/usr/local/cpanel/cpkeyclt

Step 11: Access WHM

Once the installation is complete, access WHM from your browser:

https://your-server-ip:2087

Log in with the server's root credentials. WHM will guide you through the initial setup wizard where you can:

  • Accept the license terms (or activate a 15-day trial).
  • Set the server contact email address.
  • Configure the nameservers.
  • Enable AutoSSL with Let's Encrypt for automatic SSL certificates.
  • Create hosting packages and accounts.

Required ports for cPanel

If you use an external firewall or security rules at your cloud provider, make sure the following ports are open:

Service Port(s)
WHM (SSL) 2087
cPanel (SSL) 2083
HTTP / HTTPS 80, 443
SSH 22
FTP / Passive FTP 21, 49152-65534
Mail (SMTP, POP3, IMAP + SSL) 25, 465, 587, 110, 995, 143, 993
DNS 53 (TCP/UDP)
Webmail (SSL) 2096

Quick command summary (AlmaLinux 9 + MySQL 8.4)

For a complete installation on AlmaLinux 9 with MySQL 8.4, run the following commands in order:

# Set hostname hostnamectl set-hostname server.yourdomain.com # Update system dnf update -y # Disable SELinux setenforce 0 sed -i 's/^SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config # Pre-configure MySQL 8.4 mkdir /root/cpanel_profile echo "mysql-version=8.4" > /root/cpanel_profile/cpanel.config # Install tools and start screen dnf install -y perl curl wget screen screen # Install cPanel cd /home && curl -o latest -L https://securedownloads.cpanel.net/latest && sh latest

References


Need help?

If you have a VPS or dedicated server with Webzi and need assistance with cPanel installation or configuration, our support team can help:


    • Related Articles

    • How to install and configure Nginx as a reverse proxy in cPanel/WHM 🚀

      What is Nginx and why use it with cPanel? Nginx is a high-performance web server that can function as a reverse proxy in front of Apache on cPanel servers. This configuration allows Nginx to handle static files (images, CSS, JavaScript) while Apache ...
    • How to Manually Move a cPanel Account to Another Partition

      cPanel includes a native feature called rearrange that allows moving accounts between partitions from WHM. However, this process requires enough free space on the source partition to create a temporary copy, and when the partition is nearly full, the ...
    • How to Get Server Hardware Information on AlmaLinux

      Knowing the hardware specifications of your dedicated server or VPS is essential for making informed decisions about resource sizing, diagnosing performance issues, and planning future upgrades. In this article, you will learn how to obtain detailed ...
    • Emails don't appear in webmail searches

      When you search for an email in Roundcube (cPanel) and it doesn't appear in the results even though it exists in your mailbox, the problem almost always stems from the server not having properly indexed the messages. For example, if you try to locate ...
    • How to List All CronJobs for Every cPanel User

      Cron jobs are scheduled tasks that run automatically on the server at specific times. These tasks can include updates, backups, sending scheduled emails, among others. Knowing the active cron jobs for each user gives you a clear view of the automated ...