Install cPanel on VPS: Step-by-Step with Screenshots

Setting up cPanel on your Virtual Private Server (VPS) transforms a bare operating system into a powerful, user-friendly web hosting control panel. cPanel, paired with WHM (Web Host Manager), simplifies website management, email accounts, databases, and much more, making it an essential tool for web hosts, agencies, and advanced users. While the process requires command-line interaction, this guide will provide a clear, step-by-step tutorial with a focus on ease of understanding, ensuring you can get cPanel up and running securely.

Before you begin, ensure your VPS meets these critical requirements:

  • Operating System: CentOS 7 or AlmaLinux OS 8/9 (cPanel does not support Ubuntu or Debian for official installations). AlmaLinux is the recommended choice.
  • Minimum RAM: 2 GB (4 GB or more is highly recommended for optimal performance).
  • Disk Space: Minimum 20 GB (40 GB or more recommended).
  • Fresh Installation: Your VPS should have a fresh OS installation with no pre-existing web servers (like Apache or Nginx), MySQL, or PHP.
  • Static IP Address: Your VPS must have a static, public IP address.
  • Valid Hostname: Set a fully qualified domain name (FQDN) as your hostname (e.g., server.yourdomain.com).
  • No Firewall: Initially, disable the OS firewall. cPanel will install and configure its own (cPanel & WHM firewall).

Important Note: cPanel is a commercial software and requires a license. You’ll need to purchase one to use it long-term. Many VPS providers offer cPanel licenses as an add-on.

Step 1: Initial Server Preparation and Basic Setup

Proper preparation ensures a smooth installation process.

1.1 Connect to Your VPS via SSH

Use an SSH client (like PuTTY on Windows or Terminal on Mac/Linux) to connect to your VPS as the root user. Replace your_vps_ip with your server’s actual IP address.

Bash

ssh root@your_vps_ip

You’ll be prompted to enter your root password.

1.2 Update Your System

Always start by updating your server’s packages to their latest versions. This ensures compatibility and security.

Bash

sudo yum update -y # For CentOS/AlmaLinux

1.3 Disable SELinux

SELinux (Security-Enhanced Linux) can interfere with cPanel’s installation and operation. It’s recommended to disable it.

Bash

sudo setenforce 0
sudo sed -i 's/^SELINUX=enforcing$/SELINUX=disabled/' /etc/selinux/config

The setenforce 0 command disables it for the current session, and sed modifies the configuration file to disable it permanently after a reboot.

1.4 Set Your Server’s Hostname

Your VPS needs a fully qualified domain name (FQDN) as its hostname. This should be a subdomain not directly used for your website (e.g., server.yourdomain.com).

Bash

sudo hostnamectl set-hostname server.yourdomain.com

Replace server.yourdomain.com with your actual desired hostname.

1.5 Reboot Your Server

A reboot is necessary for SELinux changes and the new hostname to take effect.

Bash

sudo reboot

After the reboot, reconnect via SSH using the root user.

Step 2: Download and Run the cPanel Installation Script

cPanel provides an automated script that handles the entire installation process.

2.1 Navigate to the Home Directory

Move to the root user’s home directory.

Bash

cd /root

2.2 Download the cPanel Installation Script

Use curl to download the latest cPanel installer.

Bash

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

This command downloads the script and saves it as a file named latest.

2.3 Run the Installation Script

Execute the downloaded script. This process is fully automated but will take a significant amount of time (30-60 minutes or more, depending on your VPS speed and internet connection).

Bash

sh latest

During this process, you will see a lot of text scrolling by as cPanel installs Apache, MySQL/MariaDB, PHP, Mail servers, DNS servers, and configures everything.

Do NOT close your SSH terminal or interrupt the process during this step. If your SSH connection drops, you might be able to resume by running the script again, but it’s best to avoid interruptions.

Step 3: Initial WHM Configuration

Once the installation script completes, you’ll see a message indicating success and a URL to access WHM.

3.1 Access WHM in Your Web Browser

Open your web browser and navigate to the WHM login URL provided in your SSH terminal. It will look like this:

https://your_vps_ip:2087

You’ll likely encounter a browser warning about the connection being “not private” or “untrusted.” This is normal because cPanel uses a self-signed SSL certificate initially. Proceed to the website.

3.2 Log into WHM

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

3.3 Accept the cPanel & WHM End User License Agreement

Read through the agreement and click “Agree to All”.

3.4 Complete the Basic WebHost Manager Setup Wizard

This wizard guides you through essential configurations.

  1. Contact Information: Enter your email address and any secondary contact email. This is crucial for receiving alerts and notifications.
  2. Hostname & Resolvers: Your hostname should be pre-filled. For resolvers (DNS servers), it’s usually safe to use public DNS like Google’s (8.8.8.8, 8.8.4.4) or your VPS provider’s recommended DNS servers.
  3. Main Network/Ethernet Device: This is usually detected automatically.
  4. MySQL/MariaDB Configuration: Choose “Default” unless you have specific needs.
  5. Nameservers: If you plan to host multiple domains and want to act as a web host, you’ll need to set up private nameservers (e.g., ns1.yourdomain.com, ns2.yourdomain.com). If you’re only hosting your own sites, you can use your domain registrar’s or CDN’s nameservers later.
    • Recommendation for single-site users: You can skip setting up nameservers here and point your domain’s DNS directly to your VPS IP address later.
  6. Review and Finish: Review your settings and click “Finish Setup Wizard.”

Step 4: Obtain and Install Your cPanel License

cPanel installations work in a 15-day trial mode. To ensure continuous operation, you need to acquire and activate a license.

4.1 Purchase a cPanel License

You can purchase a license directly from cPanel’s website or often from your VPS hosting provider as an add-on. The license is tied to your VPS’s public IP address.

4.2 Activate Your License

WHM usually detects the license automatically once purchased and associated with your IP. If it doesn’t, you can force a license update.

  • In WHM, navigate to Home > cPanel > Update License.
  • Click “Click to Fetch License”.

WHM will connect to cPanel’s license server and activate your installation.

Step 5: Create Your First cPanel Account (for a Website)

Now that WHM is configured, you can create individual cPanel accounts for your websites.

5.1 Navigate to Create a New Account

In WHM, go to Home > Account Functions > Create a New Account.

5.2 Fill in Account Details

  • Domain Information:
    • Domain: Enter your website’s domain name (e.g., yourwebsite.com).
    • Username: WHM will suggest one based on the domain.
    • Password: Generate a strong, secure password.
    • Email: Your contact email.
  • Package: Choose “default” or create a custom package later (for defining resource limits for hosting accounts).
  • DNS Settings: Leave default unless you have specific needs.
  • Mail Routing Settings: Leave default.
  • Click “Create.”

WHM will process the request and notify you once the account is created. This new account has its own cPanel login.

Step 6: Accessing cPanel and Starting Your Website

6.1 Log into cPanel

You can access your newly created cPanel account in two ways:

  1. From WHM: In WHM, go to Home > Account Information > List Accounts. Click the cPanel icon next to your domain.
  2. Directly via Browser: Navigate to https://your_domain.com:2083 or https://your_vps_ip:2083. Use the username and password you set in Step 5.2.

6.2 Start Building Your Website

Inside cPanel, you’ll find numerous tools:

  • File Manager: Upload and manage your website files.
  • Databases: Manage MySQL databases for applications like WordPress.
  • Softaculous Apps Installer (usually included): One-click installer for WordPress, Joomla, Drupal, and hundreds of other applications. This is the easiest way to get WordPress running.
  • Email Accounts: Create and manage professional email addresses for your domain.
  • Domain Management: Add subdomains, parked domains, etc.
  • SSL/TLS: Install an SSL certificate (e.g., free AutoSSL from cPanel/Let’s Encrypt).

Step 7: Essential Post-Installation Optimizations and Security

Now that cPanel is running, consider these steps for optimal performance and security.

7.1 Configure Firewall (CSF/LFD)

cPanel installs CSF/LFD (ConfigServer Security & Firewall / Login Failure Daemon) by default.

  • In WHM, search for “CSF” or navigate to Plugins > ConfigServer Security & Firewall.
  • It starts in “Testing” mode. Review the configuration, whitelist your IP if needed, and set TESTING = "0" in csf.conf to take it out of testing mode. Restart CSF.

7.2 Optimize Apache/Nginx and PHP (Advanced)

While cPanel handles defaults, you might want to fine-tune configurations.

  • Apache/PHP: In WHM, go to Home > Service Configuration > Apache Configuration or PHP Configuration Editor. Adjust settings like memory_limit, upload_max_filesize, etc.
  • Optimizers: Consider installing optimizers like LiteSpeed Web Server (a premium alternative to Apache with its own cPanel plugin) or caching solutions for your websites (e.g., LSCache, Redis).

7.3 Set Up Backups

Regular backups are crucial.

  • WHM Backups: In WHM, go to Home > Backup > Backup Configuration. Enable backups and configure remote destinations (e.g., FTP, SFTP, Amazon S3) for off-site storage.
  • Account Backups (for users): cPanel allows individual account backups via the cPanel interface.

7.4 Monitor Server Resources

Regularly monitor your VPS’s resource usage (CPU, RAM, Disk I/O) to ensure optimal performance and identify when you might need to upgrade your VPS plan. WHM offers various monitoring tools under Server Status.

7.5 Keep cPanel/WHM and OS Updated

Enable automatic updates for cPanel/WHM or perform them manually regularly. Keep your underlying AlmaLinux/CentOS operating system updated through WHM or SSH.

  • In WHM, go to Home > cPanel > Update Preferences.

Frequently Asked Questions (FAQ)

Q1: Can I install cPanel on an Ubuntu or Debian VPS?

No, officially cPanel & WHM only support specific enterprise Linux distributions like AlmaLinux OS, Rocky Linux, and CentOS (up to version 7, which is End-of-Life). They do not support Ubuntu or Debian for production installations. Attempting to install on unsupported systems will likely fail or lead to instability.

Q2: Is cPanel free to use?

No, cPanel & WHM is commercial software and requires a paid license to operate beyond a short trial period (usually 15 days). Many VPS providers offer cPanel licenses as an add-on to their hosting plans, often at a discounted rate.

Q3: What is the difference between cPanel and WHM?

WHM (Web Host Manager) is the reseller/administrator-level control panel. It allows you to manage multiple cPanel accounts, server settings, security, backups, and overall server resources. cPanel is the end-user control panel where individual website owners manage their specific websites, emails, databases, files, and applications. WHM controls cPanel accounts.

Q4: Why is it important to have a fresh OS installation before installing cPanel?

cPanel’s installer takes full control of the server’s web server, database, and PHP configurations. If you have pre-existing installations (e.g., Apache, Nginx, MySQL, PHP), they can conflict with cPanel’s setup, leading to broken services, installation failures, or system instability. A fresh OS ensures a clean environment for cPanel to set up everything correctly.

Q5: How do I point my domain to my cPanel VPS?

Once your cPanel account is created and your website files are uploaded, you need to update your domain’s DNS records. You have two main options:

  1. Use cPanel’s Nameservers: If you configured nameservers in WHM (e.g., ns1.yourdomain.com, ns2.yourdomain.com), you’ll set these as your domain’s nameservers at your domain registrar.
  2. Point A Record Directly: If you’re hosting a single site, you can create an A record at your domain registrar that points your domain (and www) directly to your VPS’s public IP address.

Both methods will direct traffic to your cPanel VPS.

Conclusion: Mastering Your VPS with cPanel

Installing cPanel on your VPS is a strategic move that significantly enhances your ability to manage web hosting environments. By following this comprehensive, step-by-step tutorial, you’ve transformed a raw server into a powerful, intuitive platform ready to host your websites. The combination of VPS control and cPanel’s user-friendly interface puts advanced web management at your fingertips.

Remember that continuous optimization, regular security checks, and consistent updates are key to maintaining a high-performance and secure cPanel VPS. Embrace the power of your new setup and watch your web projects flourish.

Ready to simplify your web hosting management? Get a powerful VPS and install cPanel today!

Previous Article

Best Caching Setups for WordPress VPS in 2025

Next Article

WordPress Multisite on VPS: Setup & Use Cases

Subscribe to our Newsletter

Subscribe to our email newsletter to get the latest posts delivered right to your email.
Pure inspiration, zero spam ✨