You are currently viewing How to Install cPanel on CentOS 7

How to Install cPanel on CentOS 7

Installing cPanel on CentOS 7 can make the process of hosting and managing websites on your server simple. cPanel is a popular web hosting control panel that provides an easy interface and automation tools designed to simplify the process of hosting a web site. In this blog, we’ll learn the steps to install cPanel on CentOS 7, along with important considerations and troubleshooting tips.

This blog is a part of our cPanel server management services where we make sure your cPanel server works efficiently with any issues.

Prerequisites

Before installing cPanel on CentOS 7, there are several prerequisites that need to be met:

  • A Clean CentOS 7 Server: cPanel should be installed on a freshly installed, minimal version of CentOS 7 to avoid conflicts with software that may already be on the server.
  • Root Access: You will need root access to the server to perform the installation.
  • At Least 20GB of Disk Space: cPanel requires at least 20GB of disk space but 40GB or more is recommended.
  • At Least 2GB of RAM: The minimum RAM requirement is 2GB, with 4GB or more being recommended.
  • A Valid cPanel License: cPanel is not free software; you will need to purchase a license from the cPanel website.
  • A Fully Qualified Domain Name (FQDN): It’s recommended to have an FQDN for the hostname of your server.

Steps to install cPanel on CentOS 7 

Step 1: Initial Server Setup

Before installing cPanel, ensure your server is fully updated. You can update your CentOS server by running:

yum update -y

Next, set your server’s hostname to the FQDN you plan to use:

hostnamectl set-hostname yourhostname.example.com

Step 2: Install Perl

cPanel is written in Perl, so you will need to ensure that Perl is installed on your server:

yum install perl -y

Step 3: Disable SELinux

cPanel does not work with SELinux enabled, so you will need to disable it. Open the SELinux configuration file:

nano /etc/selinux/config

Change SELINUX=enforcing to SELINUX=disabled. Save the file and reboot your server:

reboot

Step 4: Install cPanel

Once your server restarts, you can begin the installation of cPanel. First, you’ll need to download the installation script:

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

Now, run the installation script:

sh latest

This script will take anywhere from 20 minutes to over an hour, depending on your server’s hardware specifications.

Step 5: Configure cPanel

After installation, you can access the cPanel login by navigating to:

https://your_server_ip:2087

The default username is root, and the password is your root password. Upon logging in for the first time, you will be prompted to complete the initial setup wizard, which includes setting up networking, choosing your service packages, and more.

Step 6: Setup Nameservers

cPanel uses nameservers for domain management. You can set up BIND during the initial setup wizard or use an external nameserver service. If you choose to set up BIND, you’ll be prompted to enter the nameserver details.

Step 7: Secure cPanel

After setup, it’s important to secure your cPanel server:

  • Update your firewall settings.
  • Install a SSL certificate for accessing cPanel securely.
  • Use the Security Advisor in cPanel to tweak settings.

Troubleshooting Common Issues

  • Installation Errors: Check /var/log/cpanel-install.log for any installation errors.
  • License Errors: Ensure your server’s IP address is updated on your cPanel license. You can update it from the cPanel customer portal.
  • Email Delivery Issues: Check your MX records and ensure that they are correctly configured.

Conclusion

Installing cPanel on CentOS 7 can streamline the management of your web hosting environment. Although the process is straightforward, it’s crucial to prepare your system and follow the steps carefully to ensure a successful installation. Regular maintenance and updates are key to keeping your cPanel server secure and efficient.

FAQs

Q1. Can I install cPanel on CentOS 7?

Yes, you can install cPanel on CentOS 7. Ensure that you have a clean, minimal installation of CentOS 7, root access, and at least 20GB of available disk space and 2GB of RAM.

Q2. How to set up cPanel?

To set up cPanel after installation, navigate to https://your_server_ip:2087 in your browser to access the WHM login screen. Log in with the root credentials, and follow the on-screen instructions to complete the initial setup wizard, which includes network setup, choosing service packages, and configuring other settings.

Q3. How to install cPanel on CentOS 8?

cPanel does not support CentOS 8 or later versions as it only supports CentOS 7 in the CentOS series. For newer versions, cPanel recommends using AlmaLinux or Rocky Linux as replacements for CentOS 8.

Q4. How to install cPanel via SSH?

To install cPanel via SSH, log in to your server as the root user. Download the cPanel installation script with curl -o latest -L https://securedownloads.cpanel.net/latest, then execute it by running sh latest. The installation will proceed automatically and can take up to an hour depending on your server’s resources.