How to Install cPanel / WHM on CentOS 7
cPanel and WHM are tools that abstract away many complexities of hosting web-based applications. With cPanel running, best practices for installing and upgrading many common web applications are placed at your fingertips, managed by a best-in-class web interface that is well-documented. No longer is it necessary to perform arcane steps to set up websites, create certificates and manage databases. With this control panel, all of these tasks are automated, and can be performed with very little knowledge of how the underlying system works. If you’re running CentOS 7 and wish to install it, this guide will help you do so.
When we’re done, it will be running cPanel, and can host a variety of separate domains and web apps.
Start by applying all CentOS 7 security updates and bugfixes. This step should be done regularly to keep your server running securely and efficiently.
yum -y update
shutdown -r now
SELinux is a solid security subsystem, but it also presents some management challenges. For this guide, we’ll disable SELinux to make things easier. In general, SELinux does not play well with services like cPanel that attempt to manage underlying aspects of your server.
sed -i 's/enforcing/disabled/' /etc/sysconfig/selinux
We must also disable the firewall, since cPanel will be securely managing any services it needs. cPanel also expects to run services on arbitrary ports, and leaving the firewall active will complicate initial setup.
systemctl stop firewalld.service
systemctl disable firewalld.service
A valid hostname must be set on the server for it to operate. We’ll set that up in this step.
hostnamectl set-hostname server.yourdomain.com
cPanel is packaged as its own installer. As such, you’ll need to download and run that to start the process.
curl -o latest -L https://securedownloads.cpanel.net/latest
When the installation completes, go to your WHM management area to continue. It can be accessed at https://your_ip:2087.
You now have a complete cPanel/WHM installation. With this task accomplished, it is now time to start creating and deploying other websites and services to your new server. If this guide was helpful to you, kindly share it with others who may also be interested.