Cpanel

How To Install cPanel on a Virtual Server Running CentOS 9

Welcome to the Greenhost.cloud blog! In this post, we’ll walk you through the process of installing cPanel on a Virtual Server running CentOS 9. cPanel is one of the most popular web hosting control panels, making it easier for you to manage your websites, applications, and server resources. Whether you’re a seasoned server administrator or just getting started, this guide will help you ensure a smooth installation process.

Prerequisites

Before diving into the installation, make sure you have the following:

  1. A Virtual Server: You should have a virtual server running CentOS 9. You can easily spin one up through your preferred cloud provider.
  2. Root Access: You need root or sudo access to install cPanel.
  3. A Valid cPanel License: cPanel is a commercial product, so make sure you have a valid license or are willing to use a trial version.
  4. Minimum Requirements:
  • At least 1 GB of RAM (2 GB or more recommended).
  • A clean installation of CentOS 9.
  • 20 GB of disk space free (more is recommended).

With everything in place, let’s get started!

Step 1: Update Your System

Before installing any software, it’s good practice to keep your system updated. Connect to your server via SSH and run:

sudo dnf update -y

This command updates all installed packages to their latest versions.

Step 2: Set the Hostname

cPanel recommends that you set a proper hostname before installation. A popular choice for a hostname is something like server.yourdomain.com. Set your hostname using the following command:

sudo hostnamectl set-hostname server.yourdomain.com

Make sure to replace server.yourdomain.com with your actual hostname.

Step 3: Disable Network Manager

In CentOS, the Network Manager can interfere with cPanel’s services, so it’s better to disable it:

sudo systemctl stop NetworkManager
sudo systemctl disable NetworkManager

Step 4: Configure the Firewall

If you have a firewall running, you’ll need to allow the necessary ports for cPanel. Here’s how to open some basic ports:

sudo firewall-cmd --zone=public --add-port=2083/tcp --permanent
sudo firewall-cmd --zone=public --add-port=2087/tcp --permanent
sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
sudo firewall-cmd --zone=public --add-port=443/tcp --permanent
sudo firewall-cmd --reload

Step 5: Install cPanel

cPanel provides an installation script that simplifies the process. First, change to the /home directory:

cd /home

Then, download the latest cPanel installation script:

curl -o latest -L https://secured-downloads.cpanel.net/latest

Make the script executable:

chmod +x latest

Finally, start the installation:

sudo ./latest

The installation process can take some time (anywhere from 30 minutes to a few hours), so be patient. The output will notify you when the installation is finished.

Step 6: Accessing WHM

Once the installation is complete, you can access WHM (Web Host Manager) through your web browser. Open a browser and go to:

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

Replace your-server-ip with the actual IP address of your server. You will see a security warning because the connection is not secure (the SSL certificate is self-signed). Proceed to the page anyway.

Log in using the ‘root’ credentials of your server.

Step 7: Initial Setup of WHM

After logging in, you will be guided through a setup wizard. Here, you will configure your server settings, including:

  • License Agreement
  • Basic Setup (e.g., contact email, server name, etc.)
  • Networking configuration
  • IPTables and Firewall configuration

Follow the prompts and make sure to carefully complete each configuration step.

Conclusion

Congratulations! You’ve successfully installed cPanel on your Virtual Server running CentOS 9. You can now create and manage multiple websites easily through its straightforward interface. Don’t forget to regularly update cPanel and monitor your server for any issues.

If you need further assistance or wish to explore more about hosting solutions, be sure to visit our website at Greenhost.cloud. Happy hosting and see you next time!