cPanel is one of the most well-know, most reliable, and easy to use control panels for web hosting. It includes a comprehensive range of features in a powerful graphical user interface which is used to manager all shared, reseller, and business hosting services and resources.
Web Host Manager (WHM) is the administrator version of cPanel, providing full root or reseller access and a range of administrative features not present in the user level cPanel installation.
cPanel is the user level version of the software allowing access to web hosting account features and controls.
We have designed this guide to help you install cPanel. Please be aware we have provided two methods, one is the standard guide based on cPanels own setup and the second is how the staff here at UKHost4u setup our own cPanel installs.
We will be covering the following topics:
Guide 1: cPanel Method
Before you install cPanel and WHM you will require the following prerequisites:
- A clean fresh minimal installation of Centos 7 server.
- Minimum of 1 GB RAM (but 2 GB recommended).
- At least 20GB of free disk space (but 40 GB recommended).
- A valid cPanel license.
- Standard hostname (FQDN or Fully Qualified Domain Name)
Installing cPanel and WHM on Centos 7
1. The first step to install cPanel is to ensure that you have a fully qualified domain name (FQDN) set to your dedicated server or VPS. If you need to set it, you can use the following command (where cpaneltest.ukhost4u.com is the FQDN):
hostnamectl set-hostname cpaneltest.ukhost4u.com
2. cPanel is written in the Perl programming language therefore we must ensure that we have Perl installed on the server by running the following command:
yum install perl
3. To make our lives easier we will be using an auto installer script which requires the cURL command to download it. Installing the cURL command can be done with the following:
yum install curl
4. We can now download the latest version of the cPanel installer to our server, from the official repository.
curl -o latest -L https://securedownloads.cpanel.net/latest
You should see something like this:
5. Now we want to run the auto installer script. This can usually take around 40-60 minutes in total, depending on your server resources and network speed. Use the following command to run the installer script (in the directory that the script was downloaded to):
If it’s been successful, you should see something like this:
6. Now that the installation script has completed, we can access the WHM login screen by navigating to the server IP followed by :2087 in your browser. In the form:
You should then be presented with the WHM login screen where you should enter your root login details for the server.
After you’ve logged in, you’ll be presented with a license agreement screen like the following:
Click ‘Agree to All’ to proceed on to the next page.
7. You’ll now be prompted to enter your contact details such as your administrator email address. You’ll also be prompted to enter your nameservers, which you can fill in at this point, or skip it and fill it in later on.
8. Congratulations, you now have access to WHM control panel!
Once logged in successfully you should see a dashboard screen like the following:
This is the home screen for the WHM control panel, where you can access all the features of the cPanel server (click Explore all Features to show a sidebar with all the WHM features).
9. Next we want to click ‘Customise Nameservers’ and then the ‘Basic Config’ tab which will bring us to the following page:
Here you need to enter the details of the ethernet device to use to connect the server to the internet (this should be provided by your web hosting provider).
10. Finally, we want to navigate to the ‘Contact Information’ tab where you should see the following:
Here you should enter any contact details that you haven’t already added, and also any nameserver information that you may have skipped from earlier.
Congratulations, you’ve now successfully setup WHM and cPanel on Centos 7!
Guide 2: UKHost4u Method:
At UKHost4u we have many years (over 10) of experiance installing cPanel and as such have a custom-designed Bash script that we use for installing WHM and cPanel on our Dedicated & Virtual servers..
The following script removes some unnecessary features, updates all software, disables SELinux and disables Network Manager.
We first of all make sure that our yum is working, has completed any previous updates and installs some of the initial features we might wish to use (Here at UKHost4u we like nano over vi, but thats personal preference):
yum clean all yum-complete-transaction -y yum -y groupinstall base yum -y install nano yum-utils rdate wget bind-utils rsyslog zip unzip ipset deltarpm
This command removes unnecessary packages like the GUI desktop environments, just in case you might have installed them (We normally do a minimum install of Centos or CloudLinux so if thats the case these won’t be installed):
yum groupremove "FTP Server" "GNOME Desktop Environment" "KDE (K Desktop Environment)" "Mail Server or E-mail Server" "Mono" "Web Server" "X Window System" -y yum remove mlocate -y
cPanel / WHM does not work with Network Manager at this time, so these commands install the required services, configure them and removes the new Centos 7 network manager (This would only need to be done on a dedicated server or full VM):
yum -y install setuptool system-config-securitylevel-tui authconfig system-config-network-tui ntsysv for x in $(ls /etc/sysconfig/network-scripts/ifcfg-e*); do sed -i '/NM_CONTROLLED.*/d' $x; echo "NM_CONTROLLED=no" >> $x; done systemctl stop NetworkManager.service && systemctl start network.service systemctl disable NetworkManager.service && systemctl enable network.service yum remove NetworkManager -y
You can see cPanel’s notes on this here: https://documentation.cpanel.net/display/CKB/How+to+Disable+Network+Manager
These commands disable SELinux, just in case its not already disabled:
setenforce 0 grep SELINUX /etc/selinux/config sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
This command updates all yum packages (Again just for housekeeping reasons):
yum -y update all
This is the most important command in the script which populates cPanel with our specific settings, this is based on our own requirements so you might want to download this and manually adjust it to your own requirements:
wget -qO - http://pastebin.com/raw.php?i=XsWSi60j | tr -d '\r' | sh
Here is what it does for reference but you don’t need to do these individually if you run the above command:
#!/usr/bin/env bash if [ ! -d "/root/cpanel_profile/" ]; then mkdir /root/cpanel_profile/ fi echo "allowremotedomains=1" > /root/cpanel_profile/cpanel.config echo "chkservd_check_interval=120" >> /root/cpanel_profile/cpanel.config echo "defaultmailaction=fail" >> /root/cpanel_profile/cpanel.config echo "disableipnscheck=1" >> /root/cpanel_profile/cpanel.config echo "discardformmailbccsubject=1" >> /root/cpanel_profile/cpanel.config echo "email_account_quota_default_selected=unlimited" >> /root/cpanel_profile/cpanel.config echo "emailarchive=1" >> /root/cpanel_profile/cpanel.config #echo "exim_retention_days=14" >> /root/cpanel_profile/cpanel.config #echo "exim-retrytime=20" >> /root/cpanel_profile/cpanel.config #echo "extracpus=2" >> /root/cpanel_profile/cpanel.config echo "maxemailsperhour=500" >> /root/cpanel_profile/cpanel.config echo "referrerblanksafety=1" >> /root/cpanel_profile/cpanel.config echo "referrersafety=1" >> /root/cpanel_profile/cpanel.config echo "skipboxcheck=0" >> /root/cpanel_profile/cpanel.config echo "skipboxtrapper=1" >> /root/cpanel_profile/cpanel.config echo "update_log_analysis_retention_length=20" >> /root/cpanel_profile/cpanel.config echo "phploader=ioncube" >> /root/cpanel_profile/cpanel.config echo "proxysubdomains=0" >> /root/cpanel_profile/cpanel.config echo "proxysubdomainsoverride=0" >> /root/cpanel_profile/cpanel.config echo "skipformmail=0" >> /root/cpanel_profile/cpanel.config echo "cgihidepass=1" >> /root/cpanel_profile/cpanel.config echo "eximmailtrap=1" >> /root/cpanel_profile/cpanel.config echo "nobodyspam=1" >> /root/cpanel_profile/cpanel.config echo "phpopenbasedirhome=1" >> /root/cpanel_profile/cpanel.config echo "popbeforesmtpsenders=1" >> /root/cpanel_profile/cpanel.config echo "userdirprotect=1" >> /root/cpanel_profile/cpanel.config ## Below are possibly ones to change #echo "mysql-version=10.1" >> /root/cpanel_profile/cpanel.config echo "local_nameserver_type=powerdns" >> /root/cpanel_profile/cpanel.config
These commands fix the server time zone, this is based on our timezone being London:
rm -f /etc/localtime ln -s /usr/share/zoneinfo/$ZONEINFO /etc/localtime rdate -s rdate.cpanel.net
We need to now reboot after disabling SELinux:
After your server has rebooted you can install cPanel, again we have changed this a little to put the process into the background and be able to monitor it without the risk of disconnecting:
wget -N http://httpupdate.cpanel.net/latest nohup sh latest > /home/cpanel-install.log & sleep 2 tail -f /home/cpanel-install.log
After this you can login as normal based on the initial guide.
We would welcome any feedback you might have on this guide and anything you feel might be better done slightly different.
Questions & Answers:
What is cPanel?
cPanel is a control panel used for managing your web hosting services and is included with most web hosting plans. It’s main appeal is it’s ease of use, as you don’t need advanced technical knowledge to control all aspects of your hosting.
cPanel can be used to manage many areas of web hosting such as administering email accounts, DNS records, databases, files, analytics, software installations, and much more.
Benefits of C-Panel.
cPanel is an extremely versatile web hosting control panel and boasts a range of benefits including:
- Scalable – cPanel can be used in shared hosting, reseller hosting, Dedicated Servers and Virtual Private Servers
- Easy to install – once your server is setup, you just need to run the installation script to install it
- Portability – when you need to move a cPanel installation to another server, it’s made very easy by the migration tools provided by cPanel
- Easy to use – cPanel and WHM are easy to use and beginners will have no problem using the features
- Secure – cPanel is easy to keep updated and keep secure
- Easy Backups – cPanel and WHM include easy to use automated backup tools so it’s simple to keep your accounts backed up
How to login to cpanel?
Logging into cPanel is easy and can be done several different ways.
- Adding /cpanel to your website URL and entering it in the web browser. This will take you to the cPanel login screen.
- Adding :2083 to the end of your website URL and entering it in the web browser. This will redirect you to the server hostname which will allow you to login to cPanel.
- Navigating to the server hostname with :2083 at the end of the URL will allow you to login directly to cPanel
- Logging into your hosting provider’s billing system and logging in through there (this method differs for each hosting provider)
How the cPanel Dashboard does looks like?
Upon logging on to cPanel you will see the cPanel dashboard separated into sections like the picture below.
The sections are:
- Softaculous Scripts Installer
How to install WordPress using cPanel?
WordPress can be installed easily and quickly through cPanel with the Softaculous Apps Installer.
First, navigate to the Softaculous Apps Installer in the cPanel dashboard. In that section, find the cPanel WordPress installer icon (represented by the WordPress logo).
You will then see a screen like the following:
On this screen you can select ‘Install Now’ to proceed to the WordPress installation screen.
Here you need to add the relevant installation details for WordPress to install successfully.
The most important details to enter here are:
- Protocol – if you’re using an SSL certificate, choose HTTPS, otherwise choose HTTP
- Domain – here you must choose the domain name to install WordPress on to
- In Directory – this is where you specify which directory to install to (leave empty to install on the primary domain/public_html directory)
- Site Name – the name of your website
- Admin Login – here you must enter the administrator account login details
- Theme – this is where you can choose a theme for your WordPress installation (or you can leave this and do it later if you wish).
Once you’ve entered all the relevant details, just click ‘Install’ to proceed with the WordPress installation.
Now you just need to wait for a few minutes, and WordPress will be installed successfully.
Your wordpress admin dashboard can be accessed by adding /wp-admin to the URL of your website in your web browser.
How to create an email account in cPanel?
Creating an email account in cPanel is simple and takes just seconds to do.
First, login to the cPanel Dashboard and click the ‘Email Accounts’ icon in the Email section.
You’ll now be presented with a list of the email accounts present in your hosting account, as well as usage statistics and options to access cPanel webmail or change the password.
To add a new cPanel email account, click ‘Add Email Account’ at the top left. This will take you to a screen where you need to enter relevant account details to create the account:
Once you’ve entered the relevant details just click ‘Create Account’, and your account is ready to use!
Is there any alternative to cPanel?
There are several alternatives to cPanel in the hosting world including:
- Plesk – Plesk is a popular web hosting control panel compatible with PHP and ASP.net, which is designed for developers and features a wide range of tools and extensions for a high level of functionality
- DirectAdmin – DirectAdmin is a flexible, competitively priced control panel aimed at providing a fast control panel solution with high reliability and ease of use.
- Webmin – Webmin is an older control panel aimed at providing a flexible control panel solution from the browser for Unix systems and offers a wide range of functions and features.
- CentOS Web Panel – CentOS Web Panel is a free control panel which offers a simple yet powerful web hosting control panel solution with modern, up-to-date features and functionality