SPONSORED The best hosting optionReview
Plesk/CPanel

How to install cPanel on a Linux server?

3 Mins read

Introduction to cPanel

A cPanel is one of the most widely used web hosting control panels that simplifies server management tasks. It provides a graphical user interface (GUI) that allows users to manage domains, email accounts, databases, file management, security settings, and website backups without needing advanced command-line knowledge.

If you’re setting up a Linux Server and need an easy way to manage it, installing cPanel & WHM (Web Host Manager) is a great choice.

System Requirements for Installing cPanel

Before proceeding with the cPanel installation, ensure that your Linux Server meets the following requirements:

Operating System: AlmaLinux, Rocky Linux, CentOS, CloudLinux, or Ubuntu 20.04+
RAM: Minimum 2GB (4GB recommended)
Storage: Minimum 40GB disk space
Processor: 64-bit CPU
Static IP Address (cPanel does not work with dynamic IPs)
Fresh Installation (cPanel requires a clean OS without existing software like Apache, MySQL, or PHP)
Root Access to the Server

Step-by-Step Guide to Install cPanel on a Linux Server

Step 1: Update Your Server

Before installing cPanel & WHM, update your Linux Server to ensure all packages are up to date:

bash
yum update -y # For CentOS, CloudLinux, or AlmaLinux
apt update -y && apt upgrade -y # For Ubuntu

Step 2: Set the Hostname

A valid hostname is required before installing cPanel. Set your hostname using the following command:

bash
hostnamectl set-hostname server.example.com

Replace server.example.com with your actual domain name.

Step 3: Disable SELinux (Security-Enhanced Linux)

cPanel does not work properly with SELinux enabled. Disable it using:

bash
setenforce 0

To make this change permanent, edit the SELinux configuration file:

bash
nano /etc/selinux/config

Find the line:

bash
SELINUX=enforcing

Change it to:

bash
SELINUX=disabled

Save the file and restart your server.

Step 4: Install cPanel & WHM

To install cPanel & WHM, run the following command:

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

This command:

  • Downloads the latest version of cPanel & WHM
  • Installs cPanel automatically

The installation may take 30-60 minutes depending on server speed.

Step 5: Log in to WHM (Web Host Manager)

Once cPanel installation is complete, access WHM (Web Host Manager) using your web browser.

Open:

bash
https://your-server-ip:2087

Example:

bash
https://192.168.1.1:2087

Use root as the username and enter your server root password to log in.

Step 6: Activate cPanel License

cPanel & WHM require a valid cPanel license. If you don’t have one, you can activate a free trial by running:

bash
/usr/local/cpanel/cpkeyclt

To purchase a license, visit cPanel’s official website.

Step 7: Configure Basic WHM Settings

Once logged into WHM, complete the initial setup:

Set Up Nameservers (e.g., ns1.yourdomain.com & ns2.yourdomain.com)
Configure Server Networking (IP addresses & hostname)
Enable AutoSSL for free SSL certificates
Create cPanel Accounts for website hosting

Post-Installation Security & Optimization

After installing cPanel on a Linux Server, follow these best practices for security and performance optimization:

🔒 Enable CSF Firewall to block unauthorized access:

bash
yum install csf -y && csf -r

🔒 Configure ModSecurity to protect against web attacks
🔒 Enable cPanel Backups to prevent data loss
🔒 Use Let’s Encrypt SSL for secure HTTPS

Common cPanel Installation Issues & Fixes

cPanel Installation Stuck

Fix: Check logs using:

bash
tail -f /var/log/cpanel-install.log

Can’t Access WHM Panel

Fix: Ensure ports 2087 and 2083 are open in the firewall:

bash
firewall-cmd --permanent --add-port=2087/tcp
firewall-cmd --reload

Invalid License Error

Fix: Verify cPanel license status:

bash
/usr/local/cpanel/cpkeyclt

Why Use cPanel on a Linux Server?

Using cPanel Hosting on a Linux Server provides:

Easy Server Management – No need for complex CLI commands
Automated Website Backups – Prevents data loss
One-Click Software Installations – Softaculous for WordPress, Joomla, etc.
Integrated Security Features – DDoS protection, SSL, and ModSecurity
User-Friendly GUI – Makes web hosting simple for beginners

Whether you are managing a VPS, Dedicated Server, or Cloud Hosting, cPanel Hosting is a powerful solution for website and server administration.

Installing cPanel on a Linux Server is an essential step for website administrators who want an efficient, secure, and user-friendly hosting environment. With cPanel & WHM, you can manage your domains, emails, databases, and security settings effortlessly.

Looking for reliable cPanel Hosting? Choose a provider that offers pre-installed cPanel, DDoS protection, and 24/7 technical support to get the best hosting experience.