Install and Configure cPanel on Ubuntu 22.04

Install and Configure cPanel on Ubuntu 22.04

Learn how to install and configure cPanel on Ubuntu 22.04 with this step-by-step guide. Includes CLI commands, firewall setup, and security enhancements for optimal performance.

Table of Contents

Introduction

cPanel is a powerful web hosting control panel that streamlines server management with an intuitive graphical interface. Although it is not natively supported on Ubuntu, you can install and configure it with a few modifications. This guide provides a comprehensive step-by-step approach to setting up cPanel on Ubuntu 22.04, ensuring optimal performance, security, and usability.

Prerequisites for Installing cPanel on Ubuntu 22.04

Before proceeding with the installation, ensure that you have the following:

RequirementDescription
OSUbuntu 22.04 (64-bit)
RAMMinimum 2GB (4GB recommended)
CPU2 Core Minimum
StorageAt least 40GB of free space
Root AccessRequired for installation
Static IP AddressEssential for cPanel functionality

For this demonstration, we’ve configured our Ubuntu 22.04 LTS server as follows:

HostnameIP AddressRAM (GB)CoresStorage (GB)OS
cpanel.dev.naijalabs.net192.168.1.23884650Ubuntu 22.04 LTS (Jammy Jellyfish)

Install and Configure cPanel on Ubuntu 22.04 Server: Step-by-Step Instructions

Step 1: Prepare Your Ubuntu 22.04 System

To get started, you’ll need to update your server’s packages and make sure that all dependencies are installed.

Update System Packages

Run the following command to update your system’s package list (then, reboot your machine):

				
					sudo apt update && sudo apt upgrade -y
				
			
Install and Configure cPanel on Ubuntu 22.04

Photo by admingeek from Infotechys

Step 2: Set the Server Hostname

For cPanel to function correctly, set a fully qualified domain name (FQDN) for your server. Run:

				
					sudo hostnamectl set-hostname cpanel.dev.naijalabs.net
				
			

Replace cpanel.dev.naijalabs.net with your desired hostname.

Step 3: Disable Network Manager

By default, Ubuntu 22.04 LTS does not include NetworkManager. However, if it is installed on your system, you must disable it, as cPanel is not compatible with it:

				
					sudo systemctl stop NetworkManager && sudo systemctl disable NetworkManager
				
			
				
					Unit /etc/systemd/system/NetworkManager.service is masked, ignoring.
				
			

Step 4: Install Perl and Curl

cPanel installation requires Perl and Curl. Install them using:

				
					sudo apt install perl curl -y
				
			

Step 5: Download and Run the cPanel Installation Script

Navigate to the home directory and execute the installation script:

				
					cd /home
				
			
				
					sudo curl -o latest -L https://securedownloads.cpanel.net/latest
				
			
				
					  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 72421    0 72421    0     0   211k      0 --:--:-- --:--:-- --:--:--  212k
				
			
				
					sudo sh latest
				
			

This process does take some time to finish. Once completed, cPanel will be installed.

Completed CPanel and WHM installation terminal display

Photo by admingeek from Infotechys

Step 6: Configure Firewall

Ensure the required cPanel ports are open:

				
					sudo ufw allow 2083/tcp
sudo ufw allow 2087/tcp
sudo ufw allow 2089/tcp
sudo ufw allow 2096/tcp
sudo ufw enable
				
			

Step 7: Access cPanel

Once installed, you can access cPanel via [https://your-server-ip:2087]: Log in using your root credentials.

Install and Configure cPanel on Ubuntu 22.04: Cpanel Web UI

Photo by admingeek from Infotechys

Step 8: Configure cPanel

Here are the essential post-installation tasks you’ll need to complete to ensure a fully functional setup:

Configuration StepDescription
LicensingEnsure your cPanel license is active.
NetworkingConfirm the hostname and IP configuration.
ServicesEnable Apache, PHP, MySQL, and email services as required.
SecuritySet up CSF firewall and configure backups.

Step 9: Secure cPanel Installation

Enhance your security posture by completing the following: Set complex passwords for the root user account.

				
					sudo passwd root
				
			

Enable the firewall:

				
					sudo ufw enable
				
			

Ensure the cPanel service starts automatically upon reboot:

				
					sudo systemctl enable --now cpanel
				
			
				
					● cpanel.service - cPanel services
     Loaded: loaded (/etc/systemd/system/cpanel.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2025-02-26 21:59:58 UTC; 22min ago
   Main PID: 38922 (cpsrvd (SSL) - )
     Status: "Ready"
      Tasks: 1 (limit: 9392)
     Memory: 22.3M
        CPU: 1.712s
     CGroup: /system.slice/cpanel.service
             └─38922 "cpsrvd (SSL) - waiting for connections                    "
...omitted for brevity...
				
			

Conclusion

Installing and configuring cPanel on Ubuntu 22.04 requires a few workarounds but is entirely possible with the right approach. By following the steps outlined above, you can successfully set up a fully functional web hosting environment. Always keep your system updated and implement security best practices to maintain a robust server setup.

We hope you found this guide helpful! Your feedback is highly valuable to us. Feel free to share this post along with, your thoughts, questions, or suggestions in the comments section below.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *