Guide to Installing cPanel on VPS

Learn how to install cPanel on your VPS server for easy website management. This step-by-step guide covers all essential steps

Guide to Installing cPanel on VPS

Introduction

cPanel is a popular control panel that simplifies the management of web hosting tasks, making it easier for users to manage their websites, databases, email accounts, and more. If you've just set up a Virtual Private Server (VPS) and want to install cPanel, this guide will walk you through the process step-by-step.

Prerequisites

Before you begin, ensure you have the following:

  1. A VPS with root access: You'll need a VPS with a fresh installation of CentOS, CloudLinux, or AlmaLinux. cPanel recommends at least 2GB of RAM and a minimum of 20GB of disk space.
  2. A valid cPanel license: You can purchase a license from cPanel or use a trial version for 15 days.
  3. Basic knowledge of SSH: You'll be working with the command line, so familiarity with SSH is necessary.

Step 1: Update Your Server

Before installing cPanel, update your server's packages to the latest versions. Connect to your VPS via SSH and run the following commands:

sudo yum update -y
sudo yum upgrade -y

Step 2: Set the Hostname

cPanel requires a fully qualified domain name (FQDN) as the server's hostname. Set the hostname using the following command:

hostnamectl set-hostname server.yourdomain.com

Replace server.yourdomain.com with your actual domain name, Make sure that domain or subdomain porint to actual VPS ip.

Step 3: Disable SELinux

SELinux can interfere with cPanel’s installation. Disable it temporarily by editing the SELinux configuration file:

sudo nano /etc/selinux/config

Find the line SELINUX=enforcing and change it to SELINUX=disabled. Save and close the file, then reboot your server:

Please note, the "SELINUX=disabled" line must not begin with a "#" or the changes will not take effect.

Step 4: Install Perl

This is an optioanal step

cPanel requires Perl to be installed on your server. If Perl isn't already installed, you can install it with the following command:

sudo yum install perl -y

Step 5: Download and Install cPanel

Now you're ready to download and install cPanel. First, navigate to the /home directory:

cd /home

Then, download and run the latest cPanel installation script:

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

The installation process can take anywhere from 30 minutes to a few hours, depending on your server’s resources and network speed. During this time, cPanel will automatically install all the necessary components.

Step 6: Complete the cPanel Setup

After the installation is complete, you'll need to complete the setup through cPanel's WebHost Manager (WHM). Access WHM by navigating to the following URL in your web browser:

https://your-server-ip:2087
https://server.yourdomain.com:2087

Login with username : root and password : root password.

Once installed, cPanel provides a powerful and user-friendly interface to manage your web hosting needs.