How to install cPanel/WHM on CentOS 7
- 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)
Before we proceed to the installation section, you must note these to important points:
- Once you have installed cPanel/WHM, it can’t be removed from your system. You will have to reinstall your the operating system to remove it.
- cPanel is commercial software and requires a licence to work, however, there is a 15 day trial (which is automatically activated once you install cPanel), you can install your software using the trial then purchase the software later.
In this tutorial, we can check how to install cPanel on a CentOS 7 server. Before installing cPanel onto the server Perl must be installed. For that, login as root and run the given below command:
yum install perl -y
The next step is to set a host-name for the server. The host-name must be a fully qualified domain name. For example server.example.com
It is to be noted that the hostname setup must be owned by the user. Next change the directory to /home, to run the following command:
1. Ensure that your server has a standard hostname (FQDN or Fully Qualified Domain Name), otherwise set it as follows (in this example, cpanel is the hostname and tecmint.lan is the domain name):
# hostnamectl set-hostname cpanel.tecmint.lan
2. cPanel is written in Perl, ensure that you have Perl installed on your server, other wise run the command below to install it on your system.
# yum install perl
3. You do not have to run any commands to install it, there is an auto installer script built for you. All you have to do is download the cPanel installer script with the cURL command, if you don’t have the cURL command installed, first install it like so.
# yum install curl
4. Then download the latest installer script to home directory.
# curl -o latest -L https://securedownloads.cpanel.net/latest
5. Now, run the auto installer script. Note that if you have logged in the server using SSH, we strongly recommend running cPanel auto installer script in screen mode, because it takes 40-60 mins to complete the installation depending on your server resources and Internet connection speeds.
# sh latest
Verifying archive integrity... All good. Uncompressing cPanel & WHM Installer..... ____ _ ___| _ \ __ _ _ __ ___| | / __| |_) / _` | '_ \ / _ \ | | (__| __/ (_| | | | | __/ | \___|_| \__,_|_| |_|\___|_| Installer Version v00061 r019cb5809ce1f2644bbf195d18f15f513a4f5263 Beginning main installation. 2017-03-04 04:52:33 720 ( INFO): cPanel & WHM installation started at: Sat Mar 4 04:52:33 2017! 2017-03-04 04:52:33 721 ( INFO): This installation will require 20-50 minutes, depending on your hardware. 2017-03-04 04:52:33 722 ( INFO): Now is the time to go get another cup of coffee/jolt. 2017-03-04 04:52:33 723 ( INFO): The install will log to the /var/log/cpanel-install.log file. 2017-03-04 04:52:33 724 ( INFO): 2017-03-04 04:52:33 725 ( INFO): Beginning Installation v3... 2017-03-04 04:52:33 428 ( INFO): CentOS 6 (Linux) detected! 2017-03-04 04:52:33 444 ( INFO): Checking RAM now... 2017-03-04 04:52:33 233 ( WARN): 2017-03-04 04:52:33 233 ( WARN): To take full advantage of all of cPanel & WHM's features, 2017-03-04 04:52:33 233 ( WARN): such as multiple SSL certificates on a single IPv4 Address 2017-03-04 04:52:33 233 ( WARN): and significantly improved performance and startup times, 2017-03-04 04:52:33 233 ( WARN): we highly recommend that you use CentOS version 7. 2017-03-04 04:52:33 233 ( WARN): 2017-03-04 04:52:33 233 ( WARN): Installation will begin in 5 seconds. ....
At this point, sit back and relax, perhaps, you can grab yourself a cup of coffee as you wait for the cPanel installer script to complete the installation.
Login as root and enter the root password. Note to use https while accessing the WHM. For example https://your ip address:2087
After login to WHM, you will be taken to the initial server setup.
Click on ‘I Agree/Go to Step 2’ and move on to the next step.
Step 2 takes you to the Setup Networking section. Fill out the contact email address to get the important notification regarding the server.
Moving on to the next section will take you to enter the hostname you own. If no change is needed, then ignore.
Next enter the DNS resolvers for your server. These are used to fetch the DNS entries of any websites. cPanel will automatically detect DNS resolvers if the service provider has. If not then use Google’s public DNS resolvers 184.108.40.206 and 220.127.116.11 or OpenDNS’s public DNS resolvers which are 18.104.22.168 and 22.214.171.124.
Next, choose the Main Network Device. The IP available on that device will be considered as the primary address of your server.
After the completion, click ‘Save & Go to Step 3’.
In step 3, you will set up IP addresses, where it allows the user to assign multiple IP addresses. To add a new one, enter the IP address in the IP address field. If there’s a collection of IP address then add multiple IP addresses using CIDR notations. Enter the Subnet Mask and select the network interface. Click on Add IP(s) to add IPs. The list of current IP address available to the server are listed down. To move forward with default settings then click on ‘Skip This Step’ and use default settings. After all the entries then click on ‘Go to Step 4’.
Step 4 takes you to Nameserver configuration. The recommended option is BIND. DNS cannot be allowed to run from the local server by clicking on the disable option.
In the next step, you can choose the name server which the server will use. You can use ns1.yourdomain.com or ns2.yourdomain.com. Before that, you may need to create hostname in the domain control panel. Next, add A entries for the hostname by selecting Add “A Entries” for the Hostname checkbox.
Enter the IP address of the server and click on ‘Save & Go to Step 5’.
Step 5 is to set the FTP configuration, this can be chosen from 2 FTP applications. Pure-FTPD is the recommended FTP server. Dovecot is recommended for the mail configuration or you can disable the option for choosing the mail server.
Next section comes with the cPHulk Brute Force Protection, where it’s also optional by checking the box to enable cPHulk. After turning on the cPHulk it provides different options. The Advanced settings help to set the figures for the login failure attempts made in the server.
After all the configuration have been made, click on ‘Save & Go to Step 6’ button.
Step 6 is for enabling the file system quota. The recommended option is to select ‘Use file system quotas’ option. If that option is not selected then tracking the disk space consumed by each user won’t be possible.
Clicking on ‘Finish Setup Wizard’ will complete the initial setup wizard. In the feature list, you can see the cPanel ID. This feature allows the user to login to cPanel with his cPanel ID. It also enables the user to login to multiple cPanels with a single user ID. Click’ No, thank you’ option to disable the feature.
Also, next comes with the cPhulk feature options where you can enable or disable them by clicking ‘No, thank you’ option.
Click on ‘Save Settings’ button to save the settings and go to WHM. You will now see the default home page of WHM.
If you need any further help, please contact our support department
Now you can see some new features of cPanel in its Feature Showcase. In recommended features you will see cPanelID, which enables a user to login to cPanel with his/her cPanelID. This feature enables a user to login to multiple cPanels with single user id. You can enable this feature by choosing the enable option, otherwise disable it by choosing No, thank you.
Once you are done with Installation, WHM’s home page will Appear as shown in the screenshot below. You can see that Home page of WHM is displaying all Control panel option and sidebar with search facility which enables you to search options by just typing their names.
cPanel WHM Dashboard
Important: Sometimes, cPanel installer script is not able to update the licence because of firewall or resolvers entries and you’ll see trial warning in the page. You can do it manually with following command.
Remember at the beginning we mentioned that, Cpanel is for user level access and WHM is for root level access, you need to create an account with option available in WHM. In this example, we created a test account with the username “tecmint” to show you the view of cPanel for users.
Below are useful lists of cPanel backend and config files you may want to know about before starting to work with Cpanel and WHM.
CPanel Backend Files
- Cpanel directory : /usr/local/cpanel
- Third Party tools : /usr/local/cpanel/3rdparty/
- Cpanel addons directory : /usr/local/cpanel/addons/
- Base files like Phpmyadmin, skins : /usr/local/cpanel/base/
- cPanel binaries : /usr/local/cpanel/bin/
- CGI files : /usr/local/cpanel/cgi-sys/
- Cpanel access & error log files : /usr/local/cpanel/logs/
- Whm related files : /usr/local/cpanel/whostmgr/
Important cPanel Configuration Files
- Apache configuration file: /etc/httpd/conf/httpd.conf
- Exim mail server conf file:/etc/exim.conf
- Named conf file : /etc/named.conf
- ProFTP and Pureftpd conf file :/etc/proftpd.conf and /etc/pure-ftpd.conf
- Cpanel user file: /var/cpanel/users/username
- Cpanel configuration file (Tweak settings) : /var/cpanel/cpanel.config
- Networking configuration file: /etc/sysconfig/network
- Addons, parked and subdomain information: /etc/userdomains
- Cpanel update config file: /etc/cpupdate.conf
- Clamav conf file: /etc/clamav.conf
- Mysql configuration file: /etc/my.cnf
- PHP ini conf file : /usr/local/lib/php.ini
source : more info