How to Install cPanel & WHM in CentOS 6

cPanel is one of the most popular commercial control panel for Linux web hosting, I have been working with cPanel for last 3+ years to manage all Shared, Reseller and business hosting customers.

It comes with cPanel and Web Host Manager, which makes web hosting easier for you. WHM provides you root level access to your server whereas cPanel provides user level access interface to manage their own web hosting account on the server.

Features of cPanel

cPanel control panel is very versatile control panel for managing your hosting servers, It has lots of features which make Web hosting easier for you. Some of them are listed below:

  • Powerful GUI controls on your server with WHM.
  • Can perform tedious tasks like Backups, Migrations and restorations in a very easy and smooth manner.
  • Excellent DNS and mail server management for main server and as well as client account.
  • Can easily switch/enable/disable services for server.
  • Can configure SSL/TLS for all server services and client domains.
  • Easy integration with Phpmyadmin to provide a web based interface to manage your MySQL databases.
  • Feel free to Rebrand it.
  • Can be easily integrated with WHMCS to automate billing management.

Here In this article, We’ll be covering cPanel & WHM installation on CentOS/RHEL 6.5 and share some more useful information which will help you to manage cPanel & WHM.

Installation Prerequisites

  1. A fresh and minimal installation of CentOS 6.5 server.
  2. A minimum of 1 GB.
  3. A Minimum of 20GB free disk space required for cPanel installation.
  4. A cPanel license.

Installation of cPanel in CentOS and RHEL 6

First insure that OS version on which your Linux box is running, to do so, please use following command.

# cat /etc/redhat-release

CentOS release 6.4 (Final)

If you don’t have the latest version, please update your OS to its latest version, In CentOS and RHEL, we can simply do it with yum package installer.

# yum update

Once updates completes, and then check the latest OS version with same above command.

# cat /etc/redhat-release

CentOS release 6.5 (Final)

Next, ensure that your system has a standard hostname, otherwise set it as follows.

# hostname cpanel.tecmint.lan

Once you’ve ensured the OS version and hostname, you don’t have to install any other dependency packagees, cPanel auto installer script does all for you. We can download cPanel installer file under /home directory.

# cd /home && curl -o latest -L https://securedownloads.cpanel.net/latest && sh latest

This above command changes your session to the home directory, downloads the most recent version of cPanel & WHM, and runs the installation script.

Important: I strongly recommended to run cPanel auto installer script in screen mode if you are doing it with SSH because it takes 30-40 minutes to complete the installation depending on your server resources and bandwidth speed.

Sample Output
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.
....

Now, you need to wait for the cPanel installer script to complete its installation.

What Auto Installer Script Does for You

cPanel heavily modifies your operating system and that is the reason that no cPanel Uninstaller available on the web so far, you need to reformat your server to remove cPanel completely from your server.

  1. It checks for various packages to ensure that there will be no conflicts and it finds any package conflict, it uninstalls previous packages with yum and that’s why its recommended to install cPanel on a Fresh OS.
  2. Downloads language and base files for installation.
  3. Installs various Perl modules through CPAN and other required packages with yum.
  4. Downloads and compiles PHP and Apache with various associated modules.

Once that script completes its installation, it will shows up that cPanel installation is complete. You may be asked to reboot the server after installation.

After that you need to complete the installation wizard from its web based interface and you can access WHM with the following URL.

http://your-server-ip:2087

OR

http://your-host-name:2087

cPanel will open up its web interface like similar to below.

cPanel WHM Login

cPanel WHM Login

Please login with user “root” and your password. There are some more clicks remaining to complete the cPanel installation. Agree End User License Agreement by clicking “I Agree?/Go to Step 2” button:

cPanel WHM Agreement

cPanel WHM Agreement

Please do provide the working email address and contact SMS address in the column of “Server Contact Email Address” and “Server contact SMS address” respectively because your cPanel sends all important alerts, notification to this EMail-id (Recommended). You can fill the rest details as well, if you have one.

cPanel WHM Networking Setup

cPanel WHM Networking Setup

Please provide a valid FQDN hostname and Resolver entries for your server in this Networking section, you can use Google resolvers in this section if you don’t have your ISP’s resolvers. Please see the image below.

cPanel WHM Hostname Setup

cPanel WHM Hostname Setup

If you have more than one IP attached with your NIC card and you want to set up a specific IP for your Server’s main IP, you can do that from here, to do so please choose the IP from the drop down and click on “Go to Setup 4”.

cPanel WHM IP Address Setup

cPanel WHM IP Address Setup

In the 4th setup wizard, you can select DNS server which you want to use. You can choose one of them according to their Advantages, disadvantages and your server resources. Please read the comparison carefully and select the DNS server. Please see the image below.

cPanel WHM Setup Name Servers

cPanel WHM Setup Name Servers

In the same step, please write down Name Servers you want to use in format of ns1/ns2.example.com. Also, Add an A entry for your hostname and nameserver by selecting the check box, please see the image below.

cPanel WHM Add Name Servers

cPanel WHM Add Name Servers

You can select and set up different services like FTP, Mail and Cphulk in the Step 5 of this web based wizard, please see the snapshots and description below.

You can select FTP server of your choice from this wizard, which you want to use for your server depending on their advantages, disadvantages and depending upon your ease and requirements.

cPanel WHM FTP Setup

cPanel WHM FTP Setup

Cphulk brute force protection detects and block false password attacks activities and block their IP for your server. You can enable/disable and configure it from this installation wizard. Please see the snapshot below.

cPanel WHM Brute Force Protection

cPanel WHM Brute Force Protection

Last Step 6, allows you to enable quotas which helps you to track down the disk space usages.

cPanel WHM System Quotas

cPanel WHM System Quotas

Please select “Use file system quotas” and click on “Finish setup wizard” to complete the Installation process. Once you are done with Installation, WHM’s home page will Appear like below..

cPanel WHM Dashboard

cPanel WHM Dashboard

You can see that Home page of WHM is displaying all Control panel option and sidebar with search facility which allows you to search options by just typing their names.

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.

[email protected] [~]# /usr/local/cpanel/cpkeyclt

As I told you above 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. Here I have created an account with the username “tecmint” to show you the view of cPanel for users. Please see the image below.

cPanel Preferences

cPanel Preferences

Other Useful thing to know before you start working with Cpanel and WHM.

CPanel Backend Files

  1. Cpanel directory : /usr/local/cpanel
  2. Third Party tools : /usr/local/cpanel/3rdparty/
  3. Cpanel addons directory : /usr/local/cpanel/addons/
  4. Base files like Phpmyadmin, skins : /usr/local/cpanel/base/
  5. cPanel binaries : /usr/local/cpanel/bin/
  6. CGI files : /usr/local/cpanel/cgi-sys/
  7. Cpanel access & error log files : /usr/local/cpanel/logs/
  8. Whm related files : /usr/local/cpanel/whostmgr/

Important conf files

  1. Apache configuration file: /etc/httpd/conf/httpd.conf
  2. Exim mail server conf file:/etc/exim.conf
  3. Named conf file : /etc/named.conf
  4. ProFTP and Pureftpd conf file :/etc/proftpd.conf and /etc/pure-ftpd.conf
  5. Cpanel user file: /var/cpanel/users/username
  6. Cpanel configuration file (Tweak settings) : /var/cpanel/cpanel.config
  7. Networking configuration file: /etc/sysconfig/network
  8. Addons, parked and subdomain information: /etc/userdomains
  9. Cpanel update config file: /etc/cpupdate.conf
  10. Clamav conf file: /etc/clamav.conf
  11. Mysql configuration file: /etc/my.cnf
  12. PHP ini conf file : /usr/local/lib/php.ini

Reference Links

cPanel/WHM Homepage

For now that’s all with Cpanel installation, there are so many features in Cpanel and WHM which help you to setup web hosting environment. If you face any problem with setting up Cpanel in your Linux server or need any other assistance like backups, restorations, migrations etc, you can simply contact us.

Till then, Stay connected with Tecmint.com for more exciting and interesting tutorials in future. Do leave your valuable comments and suggestions below in our comment section.

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Ravi Saive

I am Ravi Saive, creator of TecMint. A Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux. Follow Me: Twitter, Facebook and Google+

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

67 Responses

  1. Sunil says:

    HI Ravi,

    Thanks for this post. Can you please tell me, if i can install cPanel VPS license in my Dedicated server. Or i need to buy cPanel Dedicated one for my Dedicated server ?

  2. Mike says:

    Hi

    I actually got cpanel installed and working by following your tutorial. But I’m kinda scared to continue using it because cpanel is not free. Is this a free version of cpanel?

    • Ravi Saive says:

      @Mike,

      Yes, you right CPanel is not free for commercial use only, if you are using for home level for practice, you can use it without any fear..

  3. Muthukumar says:

    Hi Ravi,

    The WHM panel is License only. Is it possible can i use the WHM panel internal network for internal sites hosting. Please advice. Moreover i want to host 5 sites internal network only. Let me know any other option pls.

    Let me know how much time to install the WHM panel.

  4. raaz says:

    sh latest
    Verifying archive integrity… All good.
    Uncompressing Cpanel & WHM Installer…..
    ____ _
    ___| _ \ __ _ _ __ ___| |
    / __| |_) / _` | ‘_ \ / _ \ |
    | (__| __/ (_| | | | | __/ |
    \___|_| \__,_|_| |_|\___|_|

    Installer Version v00053 re6361667eb509a53fa18abae65182fa60dae4822

    Beginning main installation.
    The system detected an installer lock file: (/root/installer.lock)
    Make certain that an installer is not already running.

    You can remove this file and re-run the cPanel installation process after you are certain that another installation is not already in progress.

    root 3531 0.0 0.1 106032 1224 pts/0 S+ 19:15 0:00 sh -c ps auxwww |grep 3890038900
    root 3533 0.0 0.0 103276 776 pts/0 S+ 19:15 0:00 grep 389003890
    but http://your-server-ip:2087
    can’t be reached please reply

    • raaz says:

      also telnet 192.168.212.132 2087
      Trying 192.168.212.132…
      Connected to 192.168.212.132.
      Escape character is ‘^]’.
      @Ravi sir please help

      • raaz says:

        futhermore on digging my tail -f /usr/local/cpanel/logs/error_log
        ==> cpsrvd: Setting up native SSL support … Done
        ==> cpsrvd: transferred port bindings
        ==> cpsrvd: bound to ports
        [2016-05-23 19:43:10 -0700] info [cpsrvd] Internal Server Error: “-” 500 The cPanel Server operation timed out at cpsrvd.pl line 533.

        ==> cpsrvd 11.56.0.18 started
        ==> cpsrvd: loading security policy….Done
        ==> cpsrvd: Setting up native SSL support … Done
        ==> cpsrvd: transferred port bindings
        ==> cpsrvd: bound to ports
        Please help

      • Ravi Saive says:

        @Raaz,

        Will it possible for you to grant access to server? if yes, just send me credentials to [email protected], I will check and install CPanel for you..

  5. Hosting Fever says:

    Fantastic tutorial… As a novice, i was fearing to install cPanel. But thanks to your tutorial, all went successful.

  6. raj says:

    i need to install whm cpanel on a domain via shell script

  7. manpreet singh says:

    system could not fetch tiers file when i switch to runlevel 3
    http://server1p:2087 it show could not connect to host
    reply me sir

  8. manpreet singh says:

    @ravi sir when i switch to runlevel 3 and run sh latest then it show system could not fetch tiers file

    • Ravi Saive says:

      @Manpreet,

      Try downloading TIERS using wget command and place in the same place where sh latest scripts exists and also make sure you’ve correct DNS resolvers in /etc/resolve.conf file.

      # wget http://httpupdate.cpanel.net/cpanelsync/TIERS
      
  9. manpreet singh says:

    for it show message of runelevel cpanel script should be running in runlevel 3 show message that the system could not fetch the tier file if i am running script of cpanel in runlevel 3 i.e sh latest

  10. manpreet singh says:

    Verifying archive integrity… All good.
    Uncompressing Cpanel & WHM Installer…..
    ____ _
    ___| _ \ __ _ _ __ ___| |
    / __| |_) / _` | ‘_ \ / _ \ |
    | (__| __/ (_| | | | | __/ |
    \___|_| \__,_|_| |_|\___|_|

    Installer Version v00052 r675dcdd3813bad0a549b02665738ff72a765dcf5

    Beginning main installation.
    2016-03-22 15:17:15 601 ( INFO): cPanel & WHM installation started at: Tue Mar 22 15:17:15 2016!
    2016-03-22 15:17:15 602 ( INFO): This installation will require 20-50 minutes, depending on your hardware.
    2016-03-22 15:17:15 603 ( INFO): Now is the time to go get another cup of coffee/jolt.
    2016-03-22 15:17:15 604 ( INFO): The install will log to the /var/log/cpanel-install.log file.
    2016-03-22 15:17:15 605 ( INFO):
    2016-03-22 15:17:15 606 ( INFO): Beginning Installation v3…
    2016-03-22 15:17:15 392 ( INFO): CentOS 6 (Linux) detected!
    2016-03-22 15:17:15 408 ( INFO): Checking RAM now…
    2016-03-22 15:17:15 467 ( INFO): Validating that the system hostname (‘node1.techmint.com’) is a FQDN…
    2016-03-22 15:17:16 1284 (DEBUG): – ssystem [BEGIN]: /usr/bin/rdate -s rdate.cpanel.net
    2016-03-22 15:17:17 1284 (DEBUG): – ssystem [END]
    2016-03-22 15:17:17 1286 ( INFO): The system set the clock to: Tue Mar 22 15:17:17 2016
    2016-03-22 15:17:17 1296 ( INFO): The system changed the clock by 1 seconds.
    2016-03-22 15:17:17 1002 ( INFO): The installation process will now set up the necessary empty cpanel directories.
    2016-03-22 15:17:17 1022 ( INFO): The installation process will now ensure that GPG is set up properly before it imports keys.
    2016-03-22 15:17:17 1025 ( INFO): The installation process will now import GPG keys for yum.
    2016-03-22 15:17:17 923 (DEBUG): Retrieving http://httpupdate.cpanel.net/cpanelsync/TIERS to the TIERS file…
    2016-03-22 15:17:17 923 (DEBUG): Retrieving http://httpupdate.cpanel.net/cpanelsync/TIERS.asc to the TIERS.asc file…
    2016-03-22 15:17:18 1477 ( INFO): Downloading GPG public key, cPanelPublicKey.asc
    2016-03-22 15:17:21 1446 ( INFO): Valid signature for TIERS
    2016-03-22 15:17:21 119 (DEBUG): Parsing command line arguments.
    2016-03-22 15:17:21 326 ( INFO): Install type: standard
    2016-03-22 15:17:21 124 ( INFO): Running health checks prior to start.
    2016-03-22 15:17:21 823 ( INFO): Validating whether the system can look up domains…
    2016-03-22 15:17:21 835 (DEBUG): Testing cpanel.net…
    2016-03-22 15:17:21 835 (DEBUG): Testing http://www.cpanel.net...
    2016-03-22 15:17:21 835 (DEBUG): Testing updates.cpanel.net…
    2016-03-22 15:17:21 835 (DEBUG): Testing httpupdate.cpanel.net…
    2016-03-22 15:17:21 835 (DEBUG): Testing layer2.cpanel.net…
    2016-03-22 15:17:21 835 (DEBUG): Testing layer1.cpanel.net…
    2016-03-22 15:17:21 835 (DEBUG): Testing http://www.google.com...
    2016-03-22 15:17:23 869 ( INFO): The system successfully connected to the httpupdate.cpanel.net server.
    2016-03-22 15:17:23 580 (ERROR): The installation process detected that the server was in runlevel 5.
    2016-03-22 15:17:23 581 (FATAL): The server must be in runlevel 3 before the installation can continue.
    Removing /root/installer.lock.
    can anyone help me for this problem

    • Ravi Saive says:

      @manpreet,

      To get rid of this problem, switch to run level 3 mode using init 3 command and then try the installation again, it will for 100%. As you see the last 2 lines states that you’re running the installation in run level 5 and asking you to switch to run level 3.

Leave a Reply to Hosting Fever Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.