Monday, September 4, 2017

Instalacija

How to Install cPanel/WHM on CentOS 7

cPanel is the most popular Linux based web hosting control panel. It provides a graphical user interface to easily manage and host multiple websites on a single VPS or dedicated server. With the help of it's powerful GUI we can easily perform most of the tasks we perform on a website's server using command line, for example, uploading files, creating emails, setting cron jobs, handling databases, etc. WHM (Web Host Manager) provides a root and reseller level access interface where user can manage settings related to server administration and account management. cPanel provides a user level access interface where user can manage their web hostings.

Features of cPanel/WHM

cPanel/WHM comes with a lot of notable features, some of them are listed below.
  • Multilingual GUI interface to manage a server and client websites.
  • Built-in file manager and phpMyAdmin to easily manage files and databases.
  • DNS support and management for both server and client websites.
  • Email management with DKIM and SPF support for authentication and encryption.
  • Easy SSL/TLS management for multiple domains using SNI.
  • Easy Backup and Migration of client accounts within different servers.
  • Can be easily integrated with almost all client management and billing software like WHMCS, Blesta etc.

Prerequisites

  • A Fresh VPS, Cloud Server or Dedicated Server running CentOS 7 or CentOS 7.2. You can also choose from a wide range of SSD Cloud Servers directly from us if you don't have one already.
  • A Static IP address, cPanel can not work on a dynamic IP address which is allocated dynamically if you have DHCP enabled on your ethernet interface.
  • Minimum 1 GB RAM but it is recommended that you have 2 GB of RAM.
  • Minimum 20 GB Disk Space but it is recommended that you have at least 40 GB Disk Space.
  • Root access to your server.
Notes
  • cPanel, once installed can not be removed from your server as it does not have any uninstaller. To remove cPanel you will have to reinstall your Operating System.
  • cPanel is commercial software and requires a licence to work but cPanel offers a 15 day trial, you can install your software using the trial and you can purchase the software later. The trial is automatically activated once cPanel is installed on your server.

Installation of cPanel/WHM

Before installing cPanel you must have Perl installed on your server as cPanel is written in Perl. To install Perl on your system, login as root user and run the following command.
    yum -y install perl
Now you will need to set the hostname for your server. A hostname is a FQDN or Fully Qualified Domain Name which will be used to identify your server. For example consider vps.mydomain.com - this is a FQDN which you can use as your hostname. To change your hostname run the following command
    hostname vps.mydomain.com
You can replace vps.mydomain.com with your hostname. You must own the domain of which your are setting up the hostname.
Next, you will need to change your current directory to /home directory, run the following command to do this.
    cd /home
Download the installation script from cPanel website by executing the following command -
    curl -o latest -L https://securedownloads.cpanel.net/latest
Now run the installation script by executing the following command -
    sh latest
This will start your cPanel installation, you can now sit back and relax as the installation takes around half hour to complete. Once the installation script is finished you will see the following output:
    2016-06-11 08:42:33  222 ( INFO): cPanel install finished in 21 minutes and 23 seconds!
    2016-06-11 08:42:33  938 ( INFO): Congratulations! Your installation of cPanel & WHM 11.56 is now complete. The next step is to configure your server.
    2016-06-11 08:42:33  938 ( INFO): Before you configure your server, ensure that your firewall allows access on port 2087.
    2016-06-11 08:42:33  938 ( INFO): On RHEL, CentOS, and CloudLinux systems, execute /scripts/configure_firewall_for_cpanel to accomplish this.
    2016-06-11 08:42:33  938 ( INFO): After ensuring that your firewall allows access on port 2087, you can configure your server.
    2016-06-11 08:42:33  938 ( INFO): 1. Open your preferred browser
    2016-06-11 08:42:33  938 ( INFO): 2. Type https://198.50.190.11:2087 in the address bar
    2016-06-11 08:42:33  938 ( INFO): 3. Enter the word root in the Username text box
    2016-06-11 08:42:33  938 ( INFO): 4. Enter your root password in the Password text box
    2016-06-11 08:42:33  938 ( INFO): 5. Click the Login button
    2016-06-11 08:42:33  938 ( INFO): Visit https://go.cpanel.net/whminit for more information about first-time configuration of your server.
    2016-06-11 08:42:33  938 ( INFO): Visit http://support.cpanel.net or https://go.cpanel.net/whmfaq for additional support
    2016-06-11 08:42:33  938 ( INFO): Thank you for installing cPanel & WHM 11.56!
You can now open your browser and go to https://your-server-ip:2087 to access WHM. Login with username root and your root account's password. Make sure that you use https to access WHM in browser. For example if your IP is 192.168.0.85 then you will have to go to https://192.168.0.85:2087
Once you are logged in you will be taken to initial server setup. In Step 1 you will be shown the cPanel & WebHost Manager End User License Agreement, you can go through the agreement and click on I Agree/Go to Step 2 once you are ready.
In Step 2 you will be taken to the Setup Networking section. Provide your contact information, a valid email address which should not be hosted on the same server. This email will be used for sending critical information about server.
Scroll down to find hostname section, you can enter a new hostname for your server by replacing the old one which we have given during installation. If you don't want to change the hostname, you can leave the hostname field as it is. Enter DNS resolvers for your server. Resolvers will be used to fetch DNS entries of any website. If your service provider has DNS resolvers then cPanel will automatically detect and fill them for you, if not then you can use Google's public DNS resolvers which are 8.8.8.8 and 8.8.4.4 or OpenDNS's public DNS resolvers which are 208.67.222.222 and 208.67.220.220.
Next you can select your Main Network Device, an IP available on that device will be considered as the main IP address of your server.
Once done click on Save & Go to Step 3 button.
In Step 3 you will see the section to Set Up IP Addresses. If you have more than one IP address assigned to your server and your interface, you can add them here. To add a new IP address just enter the IP address in IP Address(es) to Add field, if you have a pool of IP address you can also add multiple IP address using CIDR notations. Enter the Subnet Mask and choose the network interface. Click on Add IP(s) button to add the IP address. Down below you will see the list of current IP address available to your server.
If you wish to use the default settings just click on Skip This Step and Use Default Settings button on the top. If you have added IP address then click on Go to Step 4 button.
In Step 4 you will be taken to Nameserver configuration, you will have three options to choose from, you can compare the advantage and disadvantages of using different Name server applications. Recommended is that you choose BIND as it has most advantages. If you do not want to run a DNS server on your local machine you can disable the nameserver by choosing the disable option.
Next, choose the nameserver which your server will use. You may want it to be ns1.yourdomain.com or ns2.yourdomain.com. You will need to create hostnames in your domain control panel. Now add A Entries for your hostname by selecting the Add "A Entries" for Hostname checkbox.
Enter the IP address of your server if it is not prefilled. Finally click on Save & Go to Step 5 button to go to step 5.
In Step 5 You will see the configuration page for your services. In FTP configuration you can choose from two FTP applications, recommended is Pure-FTPD. Choose the disabled option if you want to disable the local FTP server. In mail configuration you can either choose Dovecot which is also recommended or you can choose to disable mail server by choosing disabled option.
Next you can configure cPHulk Brute Force Protection, select Enable cPHulk check box to enable cPHulk. Next you can select settings for cPHulk from many options. In Advanced setting of cPHulk you can choose duration to block a user from logging in if it encounters certain failures by Account and IP address.
You can also provide maximum failures before an IP address is blocked for a day. Finally click on Save & Go to Step 6 button.
In Step 6 you will be asked if you want to use file system quotas. It is recommended that you select Use file system quotas options. If you choose not to use file system quotas then you will not be able to track the disk space used by any user or website.
Click Finish Setup Wizard to complete the initial setup wizard. You will now 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 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. To disable this, select No, thank youoption.
Next, you will see cPHulk's username based protection feature which only blocks a certain user instead of blocking the IP address so that other user may login from same IP. There are more new features like PHP-FPM, ModSecurity, cPanel Reset Password and more. You can either choose to enable them or disable them by selecting No, thank you option.
Once you have chosen to enable or disable a feature. Click on Save Settings button to save the settings and go to WHM. You will now see the default home page of WHM.
To see the user level interface of cPanel/WHM, you will need to create a user account first. Go to Home > Account Functions > Create a New Account in WHM. In the "Create a New Account Interface", enter the main domain of user, username will automatically get filled according to the domain, you can also use a different username if you want to. Enter a password for your user, you may also use password generator to generate a strong password. Enter a valid email for your user. You can choose a package from the dropdown, but as we have installed cPanel recently there will not be any package. If you do not select any package, cPanel will provide unlimited resources to this account.
Next, in the settings options, select the default theme. You can choose paper_lantern which is a modern and responsive. If you want the old non responsive theme you can select x3 or x3mail, choose the language in the locale setting. In the reseller setting you can make the account a reseller account. A reseller has ability to create more accounts under it. In DNS settings select the options to enable DKIM and SPF on the account. In the mail routing settings, unless required, leave the options as Local Mail Exchanger. Click on the create button to create the user account. cPanel will now run the script to create the user account and the output will be shown to you.
Now you can go to https://your-server-ip:2083 to access cPanel, you will see the login prompt like shown below. Enter the username and password you have created recently and click on Login button.
Once you are logged in you will see the cPanel Home interface from where a user can manage all the settings related to their website.

Conclusion

In this detailed tutorial we have installed cPanel/WHM on a VPS/Dedicated Server running CentOS 7. cPanel helps you to manage multiple websites on a single shared server with ease.