How to Set Up cPanel on a Fresh VPS in 2026

Before you install cPanel
This guide shows you how to set up cPanel on a fresh VPS without locking yourself out or guessing at the basics. You’ll start with SSH access, confirm the operating system, prepare a non-root admin account, and then finish the install, firewall checks, and first-login verification.
If you’re choosing a new server for a cPanel build, a Hostperl VPS is a practical fit for smaller agencies and site owners who want clear launch steps and direct support: Hostperl VPS. If your account will also handle email, read our note on mail authentication before you send a single campaign or invoice. The setup here pairs well with DMARC, SPF, and DKIM for Better Email Deliverability.
Assumptions and placeholders: SERVER_IP is your VPS address, for example 203.0.113.10. DOMAIN_NAME is the domain you will attach to cPanel, for example example.com. ADMIN_USER is the sudo user you will create, for example hostadmin. Commands are labeled by where they run.
1) Connect to the VPS and identify the OS
On your local computer, open SSH to the server. If your provider gives you a default non-root user, use that instead of root.
ssh root@SERVER_IPAfter you log in, confirm the distribution before you touch packages or services.
cat /etc/os-releaseYou should see either Ubuntu/Debian or AlmaLinux/Rocky Linux. cPanel only supports specific RPM-based systems, so do not continue on Ubuntu or Debian for the actual cPanel install. If your current VPS is Ubuntu or Debian, use it for planning and move to a supported AlmaLinux or Rocky Linux server before installation.
2) Create a non-root admin and keep root open
Do not disable root yet. Keep this SSH session open until the new admin user works from a second terminal.
On the VPS as root, create the admin account, set its password, and grant sudo or wheel access depending on the OS family.
Ubuntu/Debian:
adduser ADMIN_USER
usermod -aG sudo ADMIN_USERAlmaLinux/Rocky Linux:
useradd -m ADMIN_USER
passwd ADMIN_USER
usermod -aG wheel ADMIN_USERNext, install your SSH key for the new user. Replace the example key path with your own public key file.
mkdir -p /home/ADMIN_USER/.ssh
chmod 700 /home/ADMIN_USER/.ssh
cat /home/ADMIN_USER/.ssh/authorized_keysIf you are copying a key from your local machine, use:
scp ~/.ssh/id_ed25519.pub root@SERVER_IP:/tmp/admin_key.pub
cat /tmp/admin_key.pub >> /home/ADMIN_USER/.ssh/authorized_keys
chown -R ADMIN_USER:ADMIN_USER /home/ADMIN_USER/.ssh
chmod 600 /home/ADMIN_USER/.ssh/authorized_keysOn your local computer, open a second terminal and test the new login.
ssh ADMIN_USER@SERVER_IPThen test privilege escalation.
sudo -v
sudo whoamiYou should see root from sudo whoami. If that fails, stop here and fix the account before continuing.
3) Update packages and set the server baseline
cPanel expects a clean, supported server. On a new build, update packages, set the hostname, and make sure time sync is active.
On the VPS as root or the non-root sudo user, first set a proper hostname.
hostnamectl set-hostname server1.DOMAIN_NAMEThen apply updates.
Ubuntu/Debian:
apt update
apt -y upgrade
apt -y install curl wget perl chronyAlmaLinux/Rocky Linux:
dnf -y update
dnf -y install curl wget perl chronyEnable time synchronization so logs, certificates, and mail headers line up correctly.
systemctl enable --now chronyd
chronyc trackingA successful output shows time sources and no fatal sync errors.
4) Check disk space and swap before cPanel
cPanel installs a large stack. Check free space now, not after the installer has already unpacked dozens of packages.
df -h
free -hFor a small VPS, 40 GB disk space is a practical floor, and more is better if you host multiple sites, mailboxes, or backups. If you need swap on a small server, follow Hostperl’s swap guide before you install panel software: Add Swap on Ubuntu and AlmaLinux VPS in 2026.
5) Install cPanel on supported systems only
cPanel supports supported AlmaLinux or Rocky Linux releases. If your VPS is not already on a supported RPM-based release, migrate first.
On the VPS as root, prepare the install directory and start the installer.
cd /home
curl -o latest -L https://securedownloads.cpanel.net/latest
sh latestThe installer runs for a long time and writes to /var/log/cpanel-install.log. Do not close the session. A clean finish ends with services installed and the web interface listening on port 2087.
If you want a decision check before licensing and migration work, compare panel choices here first: How to Choose cPanel, Plesk, or DirectAdmin in 2026. For account moves, this DirectAdmin migration note is also useful because many host owners compare both paths before committing: Migrating to DirectAdmin in 2026: What Site Owners Should Know.
6) Open the right firewall ports
cPanel needs more than just HTTP and HTTPS. Add the ports before you harden anything else, then test access.
AlmaLinux/Rocky Linux with firewalld:
systemctl enable --now firewalld
firewall-cmd --permanent --add-service=ssh
firewall-cmd --permanent --add-port=2087/tcp
firewall-cmd --permanent --add-port=2083/tcp
firewall-cmd --permanent --add-port=2082/tcp
firewall-cmd --permanent --add-port=2086/tcp
firewall-cmd --reload
firewall-cmd --list-allUbuntu/Debian with UFW is not the normal cPanel path, but if you are still using the server for pre-migration work, the equivalent is:
ufw allow OpenSSH
ufw allow 2087/tcp
ufw allow 2083/tcp
ufw allow 2082/tcp
ufw allow 2086/tcp
ufw enable
ufw status verboseAfter the panel is live, only keep the ports you actually need. For a typical public site, 2087 for WHM and 2083 for cPanel are the main ones.
7) Log in to WHM and finish first-account setup
Open the WHM login in a browser:
https://SERVER_IP:2087Sign in as root or your WHM-reseller admin, then complete the initial setup wizard. Set the support contact email, nameservers, hostname, and resolver settings carefully. If you are hosting mail on the same server, align your DNS records with your mail policy and review DMARC, SPF, and DKIM for Better Email Deliverability again before launch.
For the first account, use the cPanel interface or WHM account creation screen. Keep the account name short and match it to the domain you will use. Long, messy usernames often turn into support problems later during migrations.
8) Point DNS and issue TLS certificates
Set your nameserver records at the domain registrar or DNS provider, then add the host records that match your server IP. If you run DNS on a separate service, update the A and AAAA records there instead.
When the domain resolves correctly, enable AutoSSL or Let’s Encrypt from WHM, depending on the plugins available in your build. The site should move to HTTPS without manual certificate uploads for routine shared-hosting use.
To check resolution from your local computer, run:
dig +short DOMAIN_NAME
curl -I https://DOMAIN_NAMEYou want an IP answer from dig and an HTTP response with a valid certificate from curl.
9) Verify services, logs, and persistence
Before you call the server finished, confirm the core services are running and restart safely after a reboot.
On the VPS as root, check cPanel services and web access.
systemctl status cpanel
ss -tulpn | egrep '2087|2083|80|443'
tail -n 50 /var/log/cpanel-install.logReboot once, then verify that cPanel returns after startup.
rebootOn your local computer, reconnect after the reboot and check the panel again:
ssh ADMIN_USER@SERVER_IP
curl -kI https://SERVER_IP:2087If the header response comes back, the panel survived reboot and the service is listening.
Common problems and quick fixes
- Installer stops on unsupported OS: run
cat /etc/os-release. If it is Ubuntu or Debian, move the workload to AlmaLinux or Rocky Linux before retrying. - WHM does not load: run
ss -tulpn | grep 2087andfirewall-cmd --list-portsorufw status. Open the port, then test again. - SSH lockout after hardening: keep your original root session open, then test a second terminal before changing SSH rules or password login.
- DNS still points to the old host: run
dig +short DOMAIN_NAMEfrom a public resolver and update the A record at the registrar. - Certificate error on first login: confirm the hostname matches DNS and rerun AutoSSL after propagation finishes.
If you are building a client site, migrating a small agency portfolio, or centralizing reseller accounts, Hostperl can help you plan the server around the panel instead of forcing the panel onto the wrong VPS. A Hostperl VPS gives you room for WHM, mail, and backups, while our support team can help you time migrations and avoid downtime during launch.
For teams comparing account structures and licensing paths, start with our panel selection guide and keep the move aligned with your support workflow: How to Choose cPanel, Plesk, or DirectAdmin in 2026.
FAQ
Can I install cPanel on Ubuntu?
No. For a real production setup, move to a supported AlmaLinux or Rocky Linux server first.
Do I need root for the installer?
Yes. Use root for the install, but keep a separate sudo admin for day-to-day work.
Which ports must stay open?
At minimum, SSH and WHM access. For most setups that means 22, 2087, and usually 2083 for cPanel users.
How do I know the panel survived reboot?
Run systemctl status cpanel after restart and confirm curl -kI https://SERVER_IP:2087 works from your local machine.
What should I set up after login?
DNS, TLS, mail authentication, backups, and your first account template. Those details matter more than the splash screen.
For shared hosting or a small business site that does not need full WHM, Hostperl’s shared hosting is often the simpler fit. If you do need cPanel on a VPS, choosing the right server first saves time, support tickets, and migration headaches.
