cPanel is a leading web hosting control panel, widely used for its ability to simplify website and server management. While traditionally associated with CentOS, it's fully capable of running on Ubuntu 22.04. This guide provides a step-by-step approach to installing cPanel on your Ubuntu system, ensuring a seamless setup process.
Prerequisites
- A fresh installation of Ubuntu 22.04.
- Root access or a user with sudo privileges.
- Minimum 2GB RAM (4GB or more recommended).
- At least 20GB of free disk space.
Step 1: System Update and Upgrade
Begin by updating your system to ensure all existing packages are up-to-date. This step enhances the stability and security of your system.
sudo apt update && sudo apt upgrade -y
Step 2: Install Required Dependencies
Install necessary packages that are prerequisites for cPanel.
sudo apt install -y curl wget perl
Step 3: Set a Valid Hostname
Establish a fully qualified domain name for your server, as required by cPanel for proper operation.
sudo hostnamectl set-hostname your-hostname.example.com
Step 4: Install and Configure Firewalld
Firewalld is crucial for managing and protecting your server's network access.
sudo apt install firewalld -y
sudo systemctl start firewalld
sudo systemctl enable firewalld
Configure the firewall to allow necessary ports for cPanel to function correctly.
sudo firewall-cmd --permanent --add-port=80/tcp
sudo firewall-cmd --permanent --add-port=443/tcp
sudo firewall-cmd --permanent --add-port=2087/tcp
sudo firewall-cmd --permanent --add-port=2083/tcp
sudo firewall-cmd --permanent --add-port=3306/tcp
sudo systemctl reload firewalld
Step 5: Download and Install cPanel
Now you're ready to download and execute the cPanel installation script. This process may take some time, so please be patient.
curl -o latest -L https://securedownloads.cpanel.net/latest
sudo sh latest
After the installation completes, access the cPanel & WHM interface through your web browser by navigating to your server's IP address followed by the port 2087 (for WHM) or 2083 (for cPanel). The setup process may take some time, but once done, you will have a powerful tool to manage your hosting environment effectively.