Introduction: cPanel and WHM (WebHost Manager) are one of the most popular web hosting control panels available. cPanel provides a user-friendly interface for managing websites, while WHM provides administrative control over the entire server. This guide provides a step-by-step process for installing cPanel and WHM on CentOS 7 using SSH commands.
Requirements:
- A fresh CentOS 7 server with at least 1GB RAM (2GB recommended), but ideally, 4GB.
- A minimum of 20GB of free space (40GB recommended).
- Root access to the server.
Step 1: Initial Server Preparation Update your server to the latest version:
yum update -y
Set a hostname for your server. It should be a fully qualified domain name (FQDN):
hostnamectl set-hostname yourserver.example.com
Step 2: Setting Up Network Ensure that your server has a static IP address. Verify your network settings and make necessary adjustments.
Step 3: Disable Network Manager cPanel does not work well with Network Manager, so it's best to disable it:
systemctl stop NetworkManager
systemctl disable NetworkManager
systemctl enable network
Step 4: Disable SELinux cPanel does not support SELinux. Disable it by editing the '/etc/selinux/config' file:
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
Reboot your server to apply changes.
Step 5: Install Perl Perl is required for cPanel installation:
yum install perl -y
Step 6: Installing cPanel and WHM Download the installation script:
cd /home && curl -o latest -L https://securedownloads.cpanel.net/latest
Run the installation script:
sh latest
The installation process might take a while (usually around 60 minutes depending on your server resources).
Step 7: Accessing WHM Once the installation is complete, access WHM from your browser:
http://your.server.ip.address:2087
- Username: root
- Password: Your root password
Step 8: Initial Setup The first time you access WHM, you'll be prompted to accept the license agreement and complete the initial setup, which includes setting up networking, nameservers, and more.
Step 9: Create a New Account in WHM Once the initial setup is complete, create a new cPanel account to host websites.
Step 10: Security and Optimization
- Run 'EasyApache 4' to configure Apache and PHP.
- Configure 'ModSecurity' and 'Firewall' for security.
- Optimize your server to suit your needs.
Conclusion: Installing cPanel and WHM on a CentOS 7 server provides a powerful and intuitive platform for hosting websites and managing server resources. By following the steps outlined in this guide, you should have a fully functional cPanel and WHM setup. Remember to regularly update and monitor your server to maintain a secure and efficient hosting environment.