Among the wide variety of server control panels for Linux, cPanel holds a special place. Despite its relatively high cost compared to free alternatives, cPanel remains the number one choice for many system administrators and web project owners due to its user-friendly interface, extensive set of built-in tools, and flexible settings.
In this article, we will take a detailed look at how to install cPanel and WHM on a server running Ubuntu 22.04 (LTS), as well as explain the purpose of the main actions necessary for the successful launch and configuration of the server.
Main Features of cPanel and WHM
cPanel is a user interface designed for managing websites and services:
Management of domains, addon domains, and subdomains.
Creation and administration of email accounts.
Monitoring statistics and analyzing log files.
Working with databases.
File management through the built-in file manager.
Setting up SSL certificates and managing security.
WHM (Web Host Manager) is an administrative panel for managing the server and user accounts:
Configuration and monitoring of server services (Apache/Nginx, MySQL, PHP).
Creating backups and migrating data.
Installing and configuring third-party plugins.
Managing panel branding and reseller access.
Installing cPanel/WHM on Ubuntu 22.04
Preparing the Server and Disabling the Built-in Firewall
Before starting the installation, it is necessary to disable the built-in firewall, as it may block the ports required for cPanel to function.
First, save the current rules:
iptables-save > ~/firewall.rules
Then disable the service if it is running:
systemctl stop firewalld.service
systemctl disable firewalld.service
After the installation is complete, you can re-enable and configure the firewall considering the open ports for cPanel.
Update the Ubuntu packages:
apt update
apt upgrade
Setting the Fully Qualified Domain Name (FQDN)
cPanel requires a fully qualified domain name (FQDN). This domain name must point to the IP address of your server in advance.
Set the desired hostname with the command:
hostnamectl set-hostname cpanel.yourdomain.com
Then edit the /etc/hosts
file and add a line, replacing the IP with your actual one:
192.168.0.50 cpanel.yourdomain.com cpanel
Starting the cPanel Installation
To start the installation, you need to download the official script and execute it:
cd /home && curl -o latest -L https://securedownloads.cpanel.net/latest && sh latest
The installation process usually takes from 20 to 60 minutes, depending on the server's power.
Possible Difficulties During Installation
During the installation of cPanel, typical errors may occur:
Error starting background process EA4 Install (error 127)
Restart the installation with the command:
/usr/local/cpanel/scripts/cpanel_initial_install script
Error accessing the MariaDB repository (403 Forbidden, IPv6)
Uncomment the line in the /etc/gai.conf:
precedence ::ffff:0:0/96 100
Then restart the EasyApache 4 installation:
/scripts/ea4_fresh_install
Request to build localization JS files after installation
/usr/local/cpanel/bin/_build_translated_js_files $locale en
Accessing the WHM/cPanel Panel
After a successful installation, you will be able to access WHM through a browser at any of the following addresses:
https://[IP]:2087
https://[IP]/whm
https://fqdn-hostname/whm
https://fqdn-hostname:2087
Additional Step — Activating the cPanel License
The cPanel license is tied to the server's IP address. If after installation you see a message about needing to purchase a license or use a trial version, execute the command:
/usr/local/cpanel/cpkeyclt
Recommendations for Optimizing and Improving Server Performance
Regularly check for updates to the control panel and install them in a timely manner.
Use a reliable backup and regularly check its functionality through WHM.
Set up a monitoring system for server resources and services, using the built-in capabilities of WHM or third-party solutions like Munin.
Optimize the performance of Apache/Nginx and MySQL through the built-in WHM utilities, selecting suitable profiles for your tasks.
Use the automatic SSL certificate renewal feature (AutoSSL) to enhance security and convenience.
Restrict access to WHM and cPanel only from trusted IP addresses.
Consider installing additional security modules, such as Imunify360, for extra protection of your server against malicious attacks.
By following this guide, even novice users will be able to install and properly configure the cPanel/WHM control panel, as well as ensure stable and secure operation of their websites and services.