How to Install cPanel on Ubuntu Server: Complete 2026 Guide
Look, I get it. You’re probably sitting there with a fresh Ubuntu server staring back at you, and you just want this thing done. So here’s the deal: installing cPanel on Ubuntu takes about 15-30 minutes of actual work, plus another 30-60 minutes of waiting while the installer does its thing.
You’ll need at least 4GB RAM, 20GB disk space, and a clean Ubuntu installation. The actual install command is stupid simple it’s literally one line. But stick around, because there’s a lot that can go wrong if you don’t prep properly.
I’m Likhon Hussain, by the way. I work as a Senior Operations Executive at HostGet Cloud Computing Company, and I’ve been neck-deep in cloud infrastructure, AI/ML deployments, and CMS setups for years. Installing cPanel? I’ve probably done it more times than I’ve had hot dinners this month. Let me walk you through everything I’ve learned the hard way so you don’t have to.
Why I Wrote This Guide (And Who Should Read It)
So here’s the thing I keep seeing people mess this up. They Google “how to install cPanel on ubuntu server,” follow some outdated tutorial from 2019, and then wonder why everything’s broken. cPanel on Ubuntu is relatively new compared to the old CentOS days, and there are some quirks you need to know about.
This guide is for you if:
- You’re a web developer wanting to manage your own hosting
- You’re running a small hosting business and need a control panel
- You’re a sysadmin who’s tired of command-line everything
- You just bought a VPS and have no idea what to do next
- You’re migrating from CentOS (RIP) and need a new home
I’m writing this like I’m explaining it to a buddy over coffee. No corporate speak, no fluff just real talk from someone who’s been in the trenches.
Quick Facts: What You Need Before Starting
Before you even think about running that install command, let’s make sure you’ve got everything lined up. Trust me, I learned this the hard way when I had to wipe and reinstall a server because I skipped the prep work. That was a fun 3 AM.
Hardware Requirements
Your server needs to meet these minimums:
- RAM: 4GB minimum (honestly, go for 8GB if you can cPanel is hungry)
- Storage: 20GB free space minimum (I recommend 40GB for breathing room)
- CPU: 64-bit processor with at least 2 cores
- Network: Static IP address (this is non-negotiable)
Software Requirements
- Operating System: Ubuntu 20.04 LTS, 22.04 LTS, or 24.04 LTS (fresh install, please!)
- FQDN: A fully qualified domain name pointing to your server
- License: cPanel license (15-day free trial available, or paid license from cPanel Store)
What Ubuntu Versions Work?
Here’s where it gets interesting. cPanel didn’t always play nice with Ubuntu they were a CentOS shop forever. But since CentOS basically died (thanks, Red Hat), Ubuntu became a first-class citizen.
Ubuntu VersioncPanel SupportUbuntu 20.04 LTSFully SupportedUbuntu 22.04 LTSFully SupportedUbuntu 24.04 LTSFully SupportedUbuntu 18.04 LTSEnd of Life
My personal recommendation? Ubuntu 22.04 LTS. It’s stable, well-tested, and you won’t have to think about major upgrades for a while.
Step 1: Prepare Your Ubuntu Server
Alright, let’s get our hands dirty. Fire up your terminal and SSH into your server. First things first we’re going to update everything.
Update Your System
bash
sudo apt update
sudo apt upgrade -y
This might take a few minutes depending on how fresh your installation is. Grab a coffee. Actually, grab two you might be here for a bit.
Set Your Hostname (This Is Important!)
cPanel is picky about hostnames. It needs a fully qualified domain name, not just “myserver” or “localhost.” Here’s how to set it properly:
bash
sudo hostnamectl set-hostname server.yourdomain.com
Replace server.yourdomain.com with your actual domain. Make sure this hostname resolves to your server’s IP address. I can’t tell you how many support tickets I’ve seen at HostGet where someone skipped this step and then wondered why their emails weren’t working.
To verify your hostname is set correctly:
bash
hostname -f
It should return your full domain name.
Disable Network Manager
Here’s something that trips up a lot of people. cPanel doesn’t like Network Manager. It wants to manage network stuff its own way. So we need to disable it:
bash
sudo systemctl stop NetworkManager
sudo systemctl disable NetworkManager
If you’re on Ubuntu 22.04 or later, you might need to configure your network manually afterward. Don’t panic most VPS providers handle this at the infrastructure level anyway.
Disable AppArmor and UFW (Temporarily)
cPanel wants to set up its own firewall rules during installation. If UFW or AppArmor are running, they can interfere with the process.
bash
sudo systemctl stop ufw
sudo systemctl disable ufw
sudo systemctl stop apparmor
sudo systemctl disable apparmor
Important: We’ll re-enable firewall protections later. Don’t leave your server unprotected long-term!
Install Required Dependencies
cPanel needs some packages to be present before installation:
bash
sudo apt install -y perl make curl bash bc rpm2cpio cpio perl-modules build-essential wget software-properties-common git unzip openssl
This installs all the foundational stuff cPanel needs to do its thing.
Step 2: Install cPanel on Ubuntu Server (The Main Event)
Here’s where the magic happens. And honestly? It’s almost anticlimactic how simple this part is.
Download and Run the Installer
Navigate to your home directory and download the cPanel installer:
bash
cd /home
curl -o latest -L https://securedownloads.cpanel.net/latest
Now run the installation script:
bash
sh latest
And… that’s it. Seriously. One command.
What Happens During Installation
The installer is going to do a bunch of stuff automatically:
- Check your system meets requirements
- Download all necessary packages
- Install and configure Apache, MySQL/MariaDB, Exim (mail), and other services
- Set up WHM (Web Host Manager)
- Configure initial security settings
This process takes anywhere from 20 minutes to over an hour depending on your server specs and internet connection. I’ve seen it complete in 15 minutes on a beefy dedicated server, and I’ve seen it take 90 minutes on a basic VPS.
Pro tip from my experience: Don’t close your SSH session during installation. If your connection drops, the installation keeps running, but you won’t see the completion message. Use screen or tmux if you’re worried about connection stability:
bash
screen -S cpanel-install
sh latest
If you get disconnected, just reconnect and run screen -r cpanel-install to resume your session.
Step 3: First Login and WHM Setup
When the installation finishes, you’ll see a message with a temporary login URL. It looks something like this:
https://your-server-ip:2087/cpsess########/login/session=root:XXXXXXXX
Accessing WHM for the First Time
Open your browser and navigate to:
https://your-server-ip:2087
You’ll probably get an SSL warning that’s normal for now. We’ll fix that later. Accept the warning and continue.
Log in with:
- Username: root
- Password: Your server’s root password
Walking Through the Setup Wizard
The first time you log into WHM, you’ll hit the setup wizard. Here’s what to expect:
Step 1: License Agreement Read it, accept it. Standard stuff.
Step 2: Contact Information Enter your email address. This is where cPanel sends important alerts about your server. Use a real email you actually check.
Step 3: Nameserver Configuration This is where you set up your nameservers (like ns1.yourdomain.com and ns2.yourdomain.com). If you’re not sure what to put here, you can skip it for now and configure it later.
Step 4: Networking Verify your IP addresses are detected correctly.
Step 5: Quotas Enable filesystem quotas if you want to limit how much disk space each account can use. I recommend enabling this it saves headaches later.
Setting Up Your cPanel License
Remember that 15-day trial I mentioned? During setup, you’ll have the option to activate a license. If you’re just testing things out, the trial works fine. For production use, you’ll need to purchase a license from the cPanel Store.
As of 2026, cPanel pricing is based on the number of accounts:
License TierAccounts IncludedMonthly Cost (approx)Solo1 account$16-18AdminUp to 5 accounts$20-21ProUp to 30 accounts$27-32PlusUp to 50 accounts$39-42PremierUp to 100 accounts$47-50
Fair warning: cPanel increases their prices almost every year. I remember when you could get unlimited accounts for a flat fee. Those days are long gone, my friend.
Step 4: Post-Install Configuration and Best Practices
Okay, so cPanel is installed. But we’re not done yet. There’s some housekeeping to do to make sure everything runs smoothly.
Update cPanel to the Latest Version
Even though you just installed cPanel, there might be updates available:
bash
/usr/local/cpanel/scripts/upcp --force
I run this after every fresh installation. It ensures you’re on the absolute latest version with all security patches.
Enable Automatic Updates
In WHM, navigate to:
Server Configuration → Update Preferences
Set cPanel to update automatically during low-traffic hours. This keeps your server secure without you having to think about it.
Configure Email Settings
cPanel uses Exim for email. Basic configuration is done during installation, but you’ll want to:
- Set up SPF records for your domains
- Configure DKIM signing
- Set up DMARC policies
This stuff is crucial if you want your emails to actually reach people’s inboxes instead of their spam folders.
Set Up Backups
This is something I see people skip all the time, and then they come crying when disaster strikes. Go to:
WHM → Backup → Backup Configuration
Configure daily backups at minimum. If you can afford the storage, do incremental backups multiple times per day. At HostGet, we run backups every 6 hours for our managed clients, and it’s saved our bacon more than once.
Install Additional PHP Versions
Your clients might need different PHP versions. cPanel makes this easy with MultiPHP Manager:
WHM → MultiPHP Manager
Install PHP 7.4, 8.0, 8.1, 8.2, and 8.3 to cover most use cases. I typically install all currently supported versions because you never know what legacy application someone’s going to throw at you.
Step 5: Security Hardening (Don’t Skip This!)
Here’s where my experience really comes into play. I’ve seen servers get compromised because someone didn’t take security seriously after installation. Let me share what I do on every single cPanel server I set up.
Enable cPHulk Brute Force Protection
This is cPanel’s built-in protection against brute force attacks. Enable it at:
WHM → Security Center → cPHulk Brute Force Protection
Click Enable, then configure:
- Set login failure threshold (I use 5 failed attempts)
- Enable IP-based and username-based tracking
- Whitelist your own IP addresses so you don’t lock yourself out
Install CSF Firewall
ConfigServer Security & Firewall (CSF) is the gold standard for cPanel servers. Here’s how to install it:
bash
cd /usr/src
wget https://download.configserver.com/csf.tgz
tar -xzf csf.tgz
cd csf
sh install.sh
After installation, configure it in WHM at:
WHM → Plugins → ConfigServer Security & Firewall
Run the security check and address any issues it finds. I spend about an hour tweaking CSF settings on every new server.
Configure SSH Properly
Default SSH settings are not great for security. Edit your SSH config:
bash
nano /etc/ssh/sshd_config
Make these changes:
- Change the default port from 22 to something random (like 2222 or 7744)
- Disable root password authentication
- Enable key-based authentication only
- Set
UseDNS no
Then restart SSH:
bash
systemctl restart sshd
Warning: Make sure you have your SSH keys set up before disabling password authentication, or you’ll lock yourself out. Ask me how I know…
Enable Two-Factor Authentication
This is huge. Enable 2FA in:
WHM → Security Center → Two-Factor Authentication
Require it for all reseller and admin accounts at minimum.
Configure Password Strength Requirements
WHM → Security Center → Password Strength Configuration
Set the minimum strength to at least 65. I usually set it to 75. Weak passwords are still the number one way servers get compromised.
Install ClamAV Antivirus
Even on Linux, malware exists. Install ClamAV:
WHM → cPanel → Manage Plugins
Enable ClamAV and configure it to scan user directories regularly.
Troubleshooting Common Problems
After installing cPanel on hundreds of servers, I’ve seen pretty much every error there is. Here are the most common issues and how to fix them.
Problem: Can’t Access WHM After Installation
Symptoms: Browser times out or connection refused on port 2087.
Solutions:
- Check if cPanel services are running:
bash
/usr/local/cpanel/scripts/restartsrv_cpsrvd
- Verify the firewall isn’t blocking port 2087:
bash
iptables -L -n | grep 2087
- If you’re using a cloud provider, check their firewall/security group settings. AWS, Google Cloud, and Azure all have network-level firewalls that need ports opened.
Problem: License Errors
Symptoms: “cPanel license is invalid” or similar messages.
Solutions:
- Make sure your server’s IP matches the licensed IP
- Verify your server can reach cPanel’s license servers:
bash
curl -I https://verify.cpanel.net
- Check that your license hasn’t expired
Problem: Installation Fails Midway
Symptoms: Installer crashes or exits with errors before completion.
Solutions:
- Check the installation log:
bash
cat /var/log/cpanel-install.log
- Common causes:
- Insufficient disk space
- Network connectivity issues
- Existing conflicting software
- Not using a clean OS installation
The fix is usually to wipe the server and start fresh with a clean OS install. I know that sounds drastic, but cPanel really needs a clean slate.
Problem: Email Not Working
Symptoms: Can send but not receive email, or vice versa.
Solutions:
- Check Exim logs:
bash
tail -f /var/log/exim_mainlog
- Verify MX records point to your server
- Make sure port 25 isn’t blocked by your hosting provider (many cloud providers block it by default)
- Check that SPF records are properly configured
Problem: SSL Certificate Issues
Symptoms: Browser security warnings, AutoSSL failures.
Solutions:
- Run AutoSSL check manually:
WHM → SSL/TLS → Manage AutoSSL
- Verify your domain’s DNS points to the server
- Check that port 80 is accessible (Let’s Encrypt needs this)
- Review the AutoSSL log for specific errors
Migrating Existing Accounts to Your New Server
So you’ve got cPanel running on your shiny new Ubuntu server. Now what? If you’re coming from another cPanel server, migration is pretty straightforward.
Using WHM’s Transfer Tool
WHM → Transfers → Transfer Tool
This wizard walks you through:
- Connecting to your source server
- Selecting which accounts to transfer
- Choosing what data to include (email, databases, home directories)
- Actually running the transfer
I’ve migrated hundreds of accounts this way. It works well for straightforward setups.
Manual Migration with cpmove Files
For more control, you can create cpmove files on the source server:
bash
/scripts/pkgacct username
This creates a compressed file in /home/ that you can SCP to your new server and restore:
bash
/scripts/restorepkg /home/cpmove-username.tar.gz
Post-Migration Checklist
After migration, always verify:
- Website loads correctly
- Database connections work
- Email is sending and receiving
- SSL certificates are installed
- DNS propagation is complete
I usually give migrated accounts 48-72 hours before calling the migration “complete” just to make sure there are no DNS-related issues.
When NOT to Use cPanel on Ubuntu
Look, I love cPanel. It’s been my bread and butter for years. But it’s not always the right choice. Here are situations where you might want to consider alternatives.
You’re on a Tight Budget
cPanel’s licensing costs add up. If you’re running a personal project or small site, paying $16-50/month just for a control panel might not make sense. Consider free alternatives like:
- CloudPanel: Lightweight, modern, free. Doesn’t do email though.
- HestiaCP: Open source fork of VestaCP with active development.
- CyberPanel: Free with OpenLiteSpeed, great performance.
- Webmin/Virtualmin: Old school but powerful and free.
You Only Need to Host One or Two Sites
If you’re not reselling hosting and just need to manage a couple of sites, cPanel is overkill. Something like CloudPanel or even just managing things via command line might be more appropriate.
You Want Maximum Performance
cPanel adds overhead. If you’re chasing every millisecond of performance, a bare-bones server without a control panel will always be faster. This matters for high-traffic sites or specific applications.
Your Team is Command-Line Comfortable
If everyone on your team knows their way around Linux, the GUI convenience of cPanel might not be worth the cost. Save the money and put it toward better hardware.
My Personal Take (After Years of Experience)
I’ve been working with cPanel since before Ubuntu was even officially supported. Back in the CentOS days, things were honestly more straightforward in some ways. But Ubuntu support has matured significantly, and these days I actually prefer deploying cPanel on Ubuntu.
Why? Ubuntu’s ecosystem is just better. Better documentation, more recent packages, longer support cycles with LTS releases, and a more active community. When something breaks at 2 AM (and it will), finding help for Ubuntu issues is easier than for some obscure CentOS problem.
At HostGet, we’ve standardized on Ubuntu 22.04 LTS for new cPanel deployments. It’s stable, well-supported, and our team knows it inside and out.
That said, cPanel isn’t cheap, and those annual price increases are frustrating. I’ve started recommending alternatives to clients who don’t need the full cPanel feature set. But for shared hosting providers, resellers, and anyone who needs that comprehensive, battle-tested control panel experience cPanel on Ubuntu is still the way to go.
Useful Commands Reference
Here’s a cheat sheet of commands I use regularly when managing cPanel on Ubuntu:
System Commands
bash
# Check cPanel version
/usr/local/cpanel/cpanel -V
# Force cPanel update
/usr/local/cpanel/scripts/upcp --force
# Restart all cPanel services
/usr/local/cpanel/scripts/restartsrv_cpsrvd
# Check cPanel license
/usr/local/cpanel/cpkeyclt
# Rebuild Apache configuration
/usr/local/cpanel/scripts/rebuildhttpdconf
# Restart Apache
/usr/local/cpanel/scripts/restartsrv_httpd
Account Management
bash
# Create new account
/scripts/createacct username domain.com
# Suspend account
/scripts/suspendacct username
# Unsuspend account
/scripts/unsuspendacct username
# Terminate account
/scripts/killacct username
# Package account for migration
/scripts/pkgacct username
# Restore account from package
/scripts/restorepkg /path/to/cpmove-username.tar.gz
Troubleshooting
bash
# Check Apache error log
tail -f /var/log/apache2/error.log
# Check Exim mail log
tail -f /var/log/exim_mainlog
# Check cPanel error log
tail -f /usr/local/cpanel/logs/error_log
# Check failed login attempts
cat /var/log/auth.log | grep Failed
# Test email delivery
/usr/sbin/exim -bt user@domain.com
Security
bash
# Check for rootkits
rkhunter --check
# Update ClamAV definitions
freshclam
# View CSF firewall status
csf -s
# Temporarily allow an IP
csf -a 192.168.1.1
# Block an IP
csf -d 192.168.1.1
Important Logs and Locations
WhatLocationcPanel Installation Log/var/log/cpanel-install.logcPanel Error Log/usr/local/cpanel/logs/error_logApache Error Log/var/log/apache2/error.logApache Access Log/var/log/apache2/access.logExim Main Log/var/log/exim_mainlogMySQL Error Log/var/lib/mysql/hostname.errMain Config File/etc/wwwacct.conf
Schema Markup (For the SEO Nerds)
json
{
"@context": "https://schema.org",
"@type": "HowTo",
"name": "How to Install cPanel on Ubuntu Server",
"description": "Complete step-by-step guide to installing cPanel on Ubuntu Server 20.04, 22.04, and 24.04 LTS",
"totalTime": "PT1H",
"supply": [
{
"@type": "HowToSupply",
"name": "Ubuntu Server (20.04, 22.04, or 24.04 LTS)"
},
{
"@type": "HowToSupply",
"name": "cPanel License"
}
],
"tool": [
{
"@type": "HowToTool",
"name": "SSH Client"
},
{
"@type": "HowToTool",
"name": "Web Browser"
}
],
"step": [
{
"@type": "HowToStep",
"name": "Update Ubuntu and set hostname",
"text": "Run apt update && apt upgrade, then set FQDN hostname"
},
{
"@type": "HowToStep",
"name": "Disable Network Manager and firewalls",
"text": "Disable Network Manager, UFW, and AppArmor temporarily"
},
{
"@type": "HowToStep",
"name": "Download and run cPanel installer",
"text": "Download installer with curl and execute with sh latest"
},
{
"@type": "HowToStep",
"name": "Complete WHM setup wizard",
"text": "Access WHM on port 2087 and complete initial configuration"
},
{
"@type": "HowToStep",
"name": "Harden security settings",
"text": "Enable cPHulk, install CSF firewall, configure 2FA"
}
],
"author": {
"@type": "Person",
"name": "Mr. Likhon Hussain",
"jobTitle": "Senior Operations Executive",
"worksFor": {
"@type": "Organization",
"name": "HostGet Cloud Computing Company"
}
}
}
Wrapping It Up
So there you have it everything I know about installing cPanel on Ubuntu Server, condensed into one guide. We covered the prep work, the actual installation, the crucial post-install configuration, security hardening, troubleshooting, and even when you might want to skip cPanel entirely.
Installing cPanel isn’t rocket science, but the details matter. Skip the hostname configuration, and your email breaks. Forget to disable Network Manager, and the install might fail. Skip security hardening, and you’re asking for trouble.
If you follow this guide step by step, you’ll end up with a solid, secure cPanel server running on Ubuntu. And if something goes wrong? Well, that’s what the troubleshooting section is for. Got questions? Running into issues I didn’t cover? Feel free to drop me a line. I love talking about this stuff probably more than is healthy, honestly. Happy hosting!
