How to Install cPanel WHM on CentOs 7
Enjoying this content? Subscribe to the Channel!
Mastering Web Hosting: How to Install cPanel & WHM on CentOS 7
Welcome back to Darren’s Tech Tutorials! If you’re looking to professionalize your web hosting environment, there’s no better tool than cPanel and its backend, WHM (Web Host Manager). cPanel is the industry-standard, Linux-based control panel that offers a clean graphical interface and powerful automation tools to simplify every aspect of site management.
In this comprehensive guide, we’re going step-by-step to show you exactly how to install cPanel/WHM on a CentOS 7 machine. This process requires a few crucial prerequisites, but don’t worry—I’ll provide all the exact commands you need!
Part 1: Critical Pre-Installation Checks
Before we download the cPanel installation script, there are three essential actions we must take to ensure the installation runs smoothly.
1. Disable and Stop NetworkManager
cPanel relies on specific network configurations that can conflict with the default CentOS NetworkManager service. We must stop the service and disable it from starting upon future boots.
# Stop the Network Manager service immediately
sudo service network manager stop
# Disable the Network Manager service permanently
sudo chkconfig network manager off
2. Set Your Server Hostname
cPanel requires that your server hostname is fully qualified—meaning it must contain at least two dots (e.g., server.mydomain.com). Replace mysite.com with your desired, functional hostname.
# Set the desired hostname (replace with your domain)
sudo hostnamectl set-hostname mysite.com
# Verify that the hostname has been set correctly
hostname
3. Install Perl
The cPanel installation script requires Perl to run. Let’s ensure it is installed using the yum package manager. The -y flag tells yum to automatically answer yes to any prompts.
sudo yum install -y perl
Part 2: Downloading and Running the cPanel Script
With our prerequisites complete, we are ready to download the installation script and begin the automated installation process.
1. Change Directory
It’s good practice to run the installation script from a common directory. We will change into the /home directory.
cd /home
2. Download the Installation Script
We use the wget utility to download the official cPanel installation script directly from their server.
wget https://cpanel.net/latest
3. Execute the Installation Script
Now for the main event! Run the script using the sh command.
A note on timing: This script is extremely thorough and handles all required dependencies, configuration files, and initial setups. Depending on your server’s hardware and network speed, this process will take approximately 30 to 40 minutes. The server may also reboot itself once the script is complete.
sudo sh latest
Part 3: Initial WHM Configuration
Once the script finishes and your server has potentially rebooted, you need to complete the setup process via the Web Host Manager (WHM) interface.
1. Access the WHM Login Page
cPanel/WHM operates over a specific secure port: 2087. You will access the WHM interface by navigating to your server’s IP address followed by this port in your web browser.
First, identify your server’s IP address (you can use ifconfig if needed).
ifconfig
Next, open your browser and navigate to the following URL structure (substituting your IP address):
https://[Your Server IP Address]:2087
You will likely receive a security warning because the server uses a self-signed SSL certificate during the initial setup. You can safely accept the security exception to proceed.
2. Log in to WHM
Use the standard administrator credentials for your CentOS machine to log in:
- Username:
root - Password: The password for your root account
3. Step-by-Step WHM Setup Wizard
Once logged in, you will be guided through a short setup wizard.
- Accept the License Agreement: Read and agree to the cPanel End-User License Agreement.
- Server Contact Information: Enter your required contact email address. This is critical for receiving server alerts and notifications.
- Nameservers & Networking: For secondary DNS, I recommend using a reliable public DNS service like Google’s:
8.8.8.8. You can generally leave the network adapter settings as default. - Finalize Configuration: Click through the remaining steps. You can typically stick with the default settings (or “Skip to Step and use my Server’s Default Settings”) until you reach the final screen.
4. Go to WHM
After the initial steps, you will be prompted to view the main WHM dashboard.
If prompted for a Feature Showcase, review the features you wish to enable and click Save Settings.
Congratulations! You have successfully installed and configured cPanel/WHM on your CentOS 7 machine!
Conclusion
We’ve successfully navigated the critical pre-installation steps, executed the lengthy installation script, and completed the required initial setup via the Web Host Manager. You now have a robust, fully graphical control panel ready to handle all your web hosting, email, and server management needs.
If you encountered any issues while following these commands, please drop a comment below—I’m always happy to help!
If this tutorial helped you get your cPanel environment up and running, please be sure to like this post and subscribe to Darren’s Tech Tutorials for more clear, actionable guides just like this one. Thanks for watching!