How to install cPanel on Ubuntu 20.04

Administration 10 min read

When it comes to web hosting management, cPanel is perhaps the world's most popular tool for simplifying the administration of servers and websites. Although cPanel was typically installed on CentOS, installing on Ubuntu 20.04 is also a viable option, offering users the familiar and user-friendly cPanel interface combined with the stability and versatility of the Ubuntu OS. In this short guide, we will go through all the steps step by step from preparing the server for installing the control panel to analyzing options for solving the most common problems associated with the installation and subsequent operation of cPanel.

 

First, let's remind you what cPanel is.

cPanel is a web-based control panel that makes it easy to manage your website and server through a user-friendly interface. This interface provides a wide range of different
tools for solving a variety of tasks: from domain management to email administration, file processing, database management, security settings and much more.

Previously, the most popular OS for installing cPanel was CentOS, as it was rightfully considered one of the most stable distributions, but several years ago, control panel developers began to focus on developing their product towards compatibility with other, newer distributions, which is designed to ensure maximum security and system reliability.

One of these distributions was Ubuntu 20.04, which is well known to a large number of users and is, apparently, one of the most popular OS at the moment, after Windows and iOS.

 

 

1. Prerequisites

 

 

1.1 Hardware and software requirements

Make sure your server meets the minimum hardware specifications recommended by cPanel. Additionally, you must have a clean installation of Ubuntu 20.04 with root access and a stable internet connection.


1.2 System updates

 

Before proceeding, update your system to the latest packages and kernel to avoid compatibility issues during the installation process. To do this, log into the server via SSH and run the commands:

sudo apt update 
sudo apt upgrade -y

 

 

2. Installation process

 

2.1 Preparing for installation

 

Before you begin installation, run the following preparatory commands:


2.1.1 Set the Fully Qualified Domain Name (FQDN)

 

Replace yourdomain.com with your actual domain name.

sudo hostnamectl set-hostname yourdomain.com


2.1.2 Disable network manager

 

sudo systemctl stop NetworkManager
sudo systemctl disable NetworkManager


2.1.3 Hostname setting

 

Make sure the hostname is set correctly.

sudo nano /etc/hosts

 

Edit the file to include the IP address and FQDN of your server:

127.0.0.1 localhost yourdomain.com
Your_server IP address yourdomain.com

Save the file and exit.


2.1.4 Set the correct time zone

 

sudo timedatectl set-timezone Your_Timezone

Replace Your_Timezone with your time zone, for example America/New_York.

 

 

2.2 Installing cPanel directly

 

Proceed with the installation by downloading and executing the cPanel installation script:

2.2.1 Download the installation script

 

curl -o last -L https://securedownloads.cpanel.net/latest

 


2.2.2 Running the installation script

 

sh latest

 

 

 

2.3 Installation check

 

Once the installation is complete, access the cPanel interface through a web browser using the server's IP address or domain name, for example:

http://yourdomain.com:2087

 

 


3. Troubleshooting and common problems

 

3.1 Firewall Configuration

 

If you encounter firewall-related issues, change the firewall rules using the iptables or ufw commands:

 

3.1.1 In case of using UFW

sudo ufw allow 2082/tcp
sudo ufw allow 2083/tcp
sudo ufw allow 2086/tcp
sudo ufw allow 2087/tcp
sudo ufw reboot

 

3.1.2 If using IPTABLES:

iptables -A INPUT -p tcp --dport 2082 -j ACCEPT
iptables -A INPUT -p tcp --dport 2083 -j ACCEPT
iptables -A INPUT -p tcp --dport 2086 -j ACCEPT
iptables -A INPUT -p tcp --dport 2087 -j ACCEPT

 


3.2 Managing dependencies and packages

 

Resolve dependency issues using package management commands:

 

3.2.1 Updating packages

sudo apt update
sudo apt update

 

3.2.2 Installing required packages

 

Make sure the required packages are installed:

sudo apt install -y curl nano

 

 

3.3 Issues with permissions and file ownership

 

Troubleshoot permissions issues using the chmod and chown commands:


3.3.1 Setting permissions

 

sudo chmod -R 755 /usr/local/cpanel
sudo chmod 4755 /usr/local/cpanel/bin/checkperlmodules

 


3.3.2 Proper file ownership

 

sudo chown -R root: wheel /usr/local/cpanel

 

 

 

Conclusion

We hope that this short guide has simplified the process of installing cPanel on Ubuntu 20.04 for you and now you can easily manage your websites or hosting using a convenient and powerful control panel with an intuitive web interface.

2023-12-18 10:50