Setting Up Your Server With cPanel and WHM
You should now have access to your dedicated or VPS server. Depending on the policies of the company you obtain your server from, it may already have cPanel and WHM installed. However, even if that is the case, you should review the items that we will cover in this chapter to make sure nothing was missed. We will discuss how to install cPanel and WHM on your server, and also how to finish initial configuration in WHM.
If you are certain you have this covered already, you can move on to Chapter 3, where we will discuss other settings that you should check before moving on to setting up Apache, PHP, and databases in Chapter 4.
Accessing Your Server for the First Time and Determining if You Need to Install cPanel and WHM
No matter how or where you host your server, the company that hosts it should provide you with basic information about how to connect to your server so that you can begin working with it.
You should have the following information:
- The main IP address of your server
- A list of any additional IP addresses your server has been assigned as well as netmask information, if you are going to be expected to bind these extra IPs to your server yourself
- The root password of the server (or information about where you can find it)
- Confirmation that you do have a cPanel/WHM license, and that it has been activated
If you are missing any of this information, contact your host to obtain it.
Getting the Tools You Need to Access Your Server
Our first order of business is to access the server and figure out what we need to do to get cPanel and WHM working. To do this, you will need two tools: an SSH client and a web browser (and Internet access, of course).
If you are running Windows on the computer you will be accessing your server from, then you will need to download and install an SSH client. One good free one is PuTTY: http://www.chiark.greenend.org.uk/~sgtatham/putty/
On the download page, there are a number of different applications and sub-projects available for download. If you've never used an SSH client before and don't know what you might need, you should probably download the Windows installer version that installs most of the tools available on this site (called putty-VERSION#- installer.exe). Just run the installer, and follow the recommendations.
On Mac OS X and Linux, your operating system most likely includes a full-featured SSH client. Linux/Unix users can also choose to install PuTTY if they prefer. PuTTY is not available natively for Mac OS X, though you might be able to get the Unix source to build.
On Mac OS X, you can use the Terminal to access the command line and use it for SSH. Typically, you will find the Terminal application here: /Applications/Utilities/Terminal
Once you've identified the SSH client you are going to use, you will also need a graphical web browser. Any modern web browser should work fine: Firefox, Internet Explorer, Safari, Konqueror, Netscape, Opera, etc. The only thing you should be sure of before beginning is that you are using the latest version of whatever web browser you choose. Old or discontinued web browsers may not work properly with WHM and cPanel.
Log into Your Server
Now that you have the required tools, you can log into your server for the first time. Start up your SSH client or Terminal or whatever method you choose to use.
You will be logging into the server as the user called root, which is the master administrator account for machines running Linux/Unix.
You do need to be careful when logged into your server as root, because unless you have a VPS, the root user can do anything on the machine, including removing critical files that the operating system needs to operate thus causing your server to fail, and perhaps even requiring all data to be removed and the operating system to be reinstalled. Think before you act when you are logged in as root!
Log into Your Server Using Windows
Start the PuTTY application, and you will be presented with a session configuration window:

There are a wide variety of settings that you can change, but this book cannot go into great detail about this or any other SSH client. The only critical information you will need to enter is the information on the Session screen. Type your server's main IP address (which you'll have from your host NOC's welcome letter). Leave the protocol set to SSH and the port set to 22, and click Open at the bottom of the window. You should shortly be prompted for your username which is root and the user's password. Enter it, and you will be at the root shell (similar to a DOS command line). Now you can skip down to the Are cPanel and WHM Installed Already section.
Log into Your Server Using Mac OS X or Linux
You should be at a command line at this point (from now on referred to as a shell). Type the following to log into your server:
ssh -lroot IPADDRESS
ssh is the command itself that tells your computer to try connecting to the specified IP address via SSH. -lroot is a combination of the option -l which tells SSH what user to try logging into and the actual name of that user (root in this case). No space is necessary between the option -l and the username. This is followed by a space and the IP address of your server. The SSH command always assumes you want to use the standard SSH port number 22 to connect unless you add -pPORT# to the command. Here's an example: ssh -lroot 111.111.111.111 -p6731
This example will try to connect to the server at IP-111.111.111.111 as the user root using port 6731 (instead of port 22).
Since this is the first time you've connected to this server, you will probably be prompted if you actually want to connect to it, or not before you actually get to the login prompt. Here's an example from my Mac (your own display may differ):
Last login: Mon Apr 24 18:49:02 on ttyp2
Welcome to Darwin!
Computer:~ aric$ ssh -lroot 111.111.111.111
reverse mapping checking getaddrinfo for 111.111.111.111.reverse.
layeredtech.com failed - POSSIBLE BREAKIN ATTEMPT!
The authenticity of host ‘111.111.111.111 (111.111.111.111)' can't be established.
RSA key fingerprint is d3:9b:46:6e:1d:ba:60:50:2c:85:26:bb:24:c1:81:a4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘111.111.111.111' (RSA) to the list of known hosts.
root@111.111.111.111's password:
Last login: Mon Apr 24 18:47:04 2006 from support.ltsvnoc.layeredtech.com [root@82 ~]#
After you attempt to log in for the first time, your computer may warn you that reverse mapping checking failed for your new server. If so, ignore it for now, it is something we can get the host to fix later. You may also be prompted if you want to continue connecting to this machine. If so, type yes. This is just your computer's way of letting you know that it has never connected to this machine before and so doesn't recognize it.
After the first connection attempt, the RSA key for the server will be saved on your computer. Every time you connect to this machine from now on, the server's key will be compared against the saved local key. If they match, you'll be able to continue connecting. If not, you'll probably get a warning about mismatched keys and may have to delete the local key if you want to continue connecting. However, if you get such a warning, you should make sure that you're connecting to the correct server and not getting redirected to some other server.
You will be prompted to enter the password for the user you specified in the SSH command (root). Type in the root password you were given by your host. Linux does not display what you are typing as a form of security, so just type carefully and press Enter/Return when you've finished. If you typed it properly, you should now see a line letting you know what time and date someone last logged into this server. It should also display the IP address (or host name) of the computer that connected to your server (be sure you recognize the login time/location to be sure someone else isn't accessing your server other than your data center or yourself). You will then be at the server's root shell command prompt (which may end with a # or $, or even some other character).
Are cPanel and WHM Installed Already?
To figure out if cPanel and WHM have been installed, you can check this in several different ways (assuming your host hasn't already explicitly told you if it is installed or not). One way is to check and see if cPanel is installed and functioning via the root shell. You can try to determine it by looking for unique files:
ls /scripts/upcp
If you can see the upcp script in that location, then cPanel and WHM have been installed already. If that script doesn't exist, then you will probably have to install cPanel and WHM yourself.
Alternately, you can try connecting to your main server IP address via your web browser: http://111.111.111.111/

If you see a screen similar to the previous one, cPanel and WHM have already been installed. If not, then you may have more work ahead. Just to be absolutely sure, try also connecting to your server via port 2087 (secure) in your browser: https://111.111.111.111:2087/ or https://111.111.111.111/securewhm
You could also connect via port 2086 (nonsecure) in your browser: http://111.111.111.111:2086/ or http://111.111.111.111/whm
If you get prompted to enter your username and password, then WHM and cPanel are installed. For now though, don't bother logging in even if WHM is active (unless you plan to skip ahead in this book).
How to Install WHM and cPanel
If you are certain WHM and cPanel haven't been installed on your server yet, and that you do have an active license for it, you will need to install it. Thankfully, cPanel Inc. has made the process fairly easy on supported hardware and operating systems (see Chapter 1 for more on supported hardware and OSes).
First, make sure the server itself is as pristine as possible. If you've had another control panel or other similar software installed, you may have problems installing cPanel. If you've just gotten your server details from your host NOC, then it's probably ready for cPanel right now.
To install WHM and cPanel, you will need to log into your server as root first. Once you are at the shell prompt, type the following to begin the installation process:
mkdir /home/cpins
cd /home/cpins
wget http://layer1.cpanel.net/latest
sh latest
Note that this process is the same for all supported operating systems. The installer will figure out what hardware and software you have and install the appropriate files.
This will create a directory to hold the installation files and then fetch the latest cPanel installer script and run it. The script itself will take care of everything else.

As you can see, the script will warn you about not trying to run this installer if cPanel is already installed, as it will wipe out your existing configuration files. Press Ctrl+C if you want to quit the installer before the installation begins. After it starts, you should not interrupt it for any reason or you may end up with an unstable system.
The actual installation process, once begun, can take quite a while, so you may want to go get some coffee or tea while you're waiting. You won't be required to enter any information at all during the installation, so you might as well relax. The time it takes for the installation to complete depends on how fast your server is. Low-end hardware like a Celeron or Sempron will obviously take longer than a dual Xeon or dual Opteron server. The listed time to finish the install (10 to 70 minutes) is fairly reasonable.
During the installation process, the install script downloads and installs critical files and services needed to run both WHM and cPanel. When the process finishes, hopefully without any errors, you will be returned to the root shell prompt.
If you get any errors during the installation, or if the installation fails, contact your host or cPanel license provider for assistance.
Accessing WHM and Finishing the Installation Process
Even if your host has installed WHM and cPanel for you, they may not have finished the process for you. You need to access WHM and check before doing anything else.
Accessing WHM may be familiar to you if you had a reseller account with another web host before obtaining your own server. If you were a reseller, you accessed WHM to manage your client's cPanel accounts. Even so, you'll be shocked at the wealth of features in WHM that you only have access to when logged in as the user root.
To access WHM securely, access the main IP address of your server like this in your web browser: https://111.111.111.111:2087/ or https://111.111.111.111/ securewhm.
You will probably get a warning about the server SSL certificate. If so, accept the certificate and continue. You will then be prompted to log in. To access WHM as the server administrator, you log in as the user root and use the same root password you used to access your server via SSH earlier.
If you have problems accessing your server using the secure method above, you can access it without SSL/TLS like this: http://111.111.111.111/whm or http ://111.111.111.111:2086/. This is not recommended unless you simply cannot get into WHM securely because it is possible for hackers to intercept insecure communications between your computer and your server. The username and password are for the same as the secure login method: the user is root and the password is your server's root password.
Finishing Installation
Once you log in, you will either be greeted by the main WHM screen with lots of text in the sidebar and icons in the center, or by a screen that is mostly empty, except for some writing in the sidebar on the left:
Welcome to Web Host Manager®!
It appears this is your first time using Web Host Manager®. This wizard
will guide you through setting up your server.
If you see the full WHM screen, then your installation is complete, and you can skip to the next section.
WHM Setup: The License
If you see the Welcome text mentioned earlier, click the Next button to be shown the cPanel license agreement. You should read this agreement, and then you must click the I Agree button at the bottom of the agreement if you want to continue using WHM and cPanel.
WHM Setup: Basic Information
The screen will change once you accept the license agreement, and you will be asked to fill out some information. Note that you won't need to actually make any changes to this section right now if you don't want to, but you will need to revisit this screen by clicking Basic cPanel/WHM Setup at the top of the WHM sidebar once you've finished the installation process.
Basic Information: Contact Details
These details will be used by the server to contact users in case of downtime.
Depending on which version of WHM and cPanel you have installed as well as what operating system/hardware you are using, the options in this basic setup section may be slightly different or rearranged.

The Server Contact E-mail Address will be the address e-mail is sent to, when there are problems with the server (the server is overloaded, services fail and need to be restarted, etc.). Exactly what kinds of warnings you will get via e-mail depend on what you set in the Contact Manager (discussed later in Chapter 3). Keep in mind that this e-mail address will automatically appear in every account's DNS zone on this server (see Chapter 7 for information about DNS zones). Therefore, make sure this e-mail address is a real e-mail address that you check regularly, but one that you don't mind the public having.
The Server Contact Pager Address is an e-mail address where the server can contact you if there is a problem. Note, the server cannot handle SMS messages, so your provider must provide a standard e-mail gateway for your pager or cell phone. What you are contacted about this way depends on the settings in the Contact Manager.
Server Contact AIM Address is the screen name or AOL Instant Messenger (AIM) username where you can be contacted if there is a problem with your server. Again, contact is governed by the Contact Manager settings.
AIM Username is the AIM username the server itself should log into in order to contact you via that messaging service. You may need to set up a special AIM username for the server. You can do this by clicking the word here in the item description.
AIM Password is the password of the AIM account you want the server to log into when there is a problem in order to AIM you. This password is stored in plaintext on this screen, so don't use a password you use for any other service and especially make sure it is not the server root password.
The Server Contact ICQ item is the ICQ number (another instant messaging service also owned by AOL) you can be reached at in case of an emergency with the server. What you get contacted about depends on the settings in the Contact Manager.
ICQ ID allows you to set the ICQ number the server should log into in order to send you a message via the ICQ instant messaging service.
ICQ Password is the password for the ICQ ID number the server will use to contact you. Again, this password is stored in plaintext on this screen, so be careful with what password you use.
Basic Information: Default Themes and Directories
You can set up a default cPanel theme and a default home directory for all your accounts.

The Default cPanel Theme setting allows you to specify which theme you want all new accounts to use by default. This setting can be changed at the time of account setup. (See Chapters 5 and 6 for more on working with accounts.) Oddly, this item is not a drop-down box of choices. You need to manually type in the name of the default theme as it appears in the List Installed cPanel Themes item in the Themes section of WHM (see Chapter 9 in this book, or Chapter 12 in cPanel: User Guide and Tutorial, ISBN-1-904811-92-2, Packt Publishing for more about cPanel themes). The default is x, which is cPanel Inc.'s own theme, updated automatically with cPanel, so it generally will offer access to new features and content before third-party themes, which may take a while to update. If you don't know what to choose, x (X-Skin) is a good default choice.
The Default Home Directory is the name of the directory where you would like to store cPanel users' accounts including their mail, web, and FTP-related files. Typically, the default entry of /home is fine. If you have more than one hard drive or prefer that users' home directories get stored elsewhere, enter the directory name here prefixed with a forward slash (/). Entering a name here will not create that directory; it will be up to you to do so. /home is automatically created on all cPanel servers. Also, this is just the default directory. If you have more than one home directory, you can switch accounts manually between directories at any time. However, it is generally not a good idea to move an account to a different home directory unless you absolutely have to do so. This is because some web scripts require specifying the absolute path on the server to some content and if you switch the user from /home to /home2, those scripts will break until the user edits them.
The Home Directory Prefix lets WHM know what directories are home directories by specifying part of the name that every home directory will contain. This item should not contain a forward slash. The default is home and that is fine under most circumstances. Keep in mind that whatever you type here will act as a wildcard selector, matching any directory with those letters in it. For example, if the prefix is home then a directory with the name home2 or homersimpson is considered a possible location for additional user accounts. If you don't put any value in this box, WHM won't look for other home directories. This item cannot be more than a single value.
Basic Setup: User IDs and Networking
These basic settings are related to networking.

Minimum UID allows you to set a number under which new Linux users will not create new user accounts. In Linux, every new account and group gets assigned a unique number. Don't type anything into this box unless you know what you are doing because setting this number too low will cause very serious problems on your server.
Main Shared Virtual Host IP will be automatically set to the first IP address set up on this server. You can switch it to any other IP address bound to this server if you wish. Don't try to set the IP address to 127.0.0.1 (localhost) or any IP address not publicly bound to this server or no one will be able to access the accounts you set up. The main shared IP address is the one on which all new accounts that do not have a dedicated IP address specified will be bound to. You may not set this to more than one IP address. If you want resellers to use a different IP address for their shared accounts, you can set that up in the Reseller Center (see Chapter 6 for more about reseller accounts).
The Alternate Main Ethernet Device item allows you to specify which Ethernet controller is the public one (the one connected to the Internet). You can leave this blank if you wish, but if you try to add additional IP addresses to this server and that process fails even though you've entered it correctly, you probably need a different interface listed here. Most common are eth0, eth0:1, and eth1, but you should ask your host NOC what interface you should be using.
Basic Setup: Hostname, Nameservers, and DNS Values
The basic setup of WHM has options to set up the server's current hostname and up to four default nameserver.

Hostname displays your server's hostname. People who are new to the world of dedicated servers are often confused about the concept of a hostname. A hostname is a unique name for the server itself. When set up properly, you can access your server via one of its bound IP addresses or the hostname. A hostname always looks like a subdomain or what is more properly called a Fully Qualified Domain Name (FQDN). That is, it has three parts like this: servername.domain.com. It should be a real domain, something that you personally own or have control over. It should also never match the name of an existing subdomain in that domain. You could call your server powerful.myhostingcompany.com so long as you own the myhostingcompany.com domain name. You won't be able to use "powerful" as a subdomain, though, so choose carefully. (Learn more about DNS management in Chapter 7.)
When the hostname is set up properly, you will be able to access WHM using the server hostname rather than the main IP address if you prefer. You should make sure that the hostname properly resolves to this server. This means that you will have to set up an A record in the DNS zone for the domain name you are using for the server hostname. Note, changing the hostname in this area doesn't actually reset the real server hostname; you will need to do that by using the Hostname feature under the Network Setup section of WHM once installation is finished.
The Primary, Secondary, Third, and Fourth Nameserver items all do the same basic thing: Set up the nameservers that this server will use by default. You must define at least two, and you can optionally set up to four. Type the name of the nameservers you want to use in the appropriate boxes (ns1.domain.com, ns2.domain.com, etc.) and then click the Assign IP Address button next to each entry, one at a time. This should assign the nameserver an IP address from your server (unless it is already set up to point to another IP address). The box that pops up will display the nameserver's assigned IP address. Once it does that, you can close it and click the Add an A Entry for this Nameserver button, and WHM will set up a DNS zone if needed for this IP address or add an A record to an existing domain on the server if needed. You will need to log into your registrar for the nameservers you want to use and point these nameserver addresses to the IP addresses that WHM just displayed for each one. How you set this up at your registrar differs, so you should discuss the matter with your domain registrar if you are unclear what to do.
This is followed by DNS related Time to Live values.

Domain Time to Live (TTL) defines how much time (in seconds) DNS servers will cache the domain host lookup information before checking for changes and re-caching it. The default value is OK, but shorter times will cause the local DNS server to check for changes more often. Shorter values may also increase the load on the local DNS server process, since it must re-cache information more often. If you're not certain what value would be good, leave this set to the default value. All new accounts created will use this domain TTL value when the DNS zone is set up.
Nameserver Time to Live controls the default setting in seconds that nameserver values will be cached.
Master Nameserver is a depreciated setting that will probably be removed altogether at some point. It allows you to set up a master and slave relationship between multiple DNS servers. Don't bother with this feature. If you want to use a separate master nameserver (instead of one DNS server for each server you own), you will want to use the DNS Clustering feature in WHM's Cluster/Remote Access section. See Chapter 7 for more about DNS clustering.
Basic Setup: CGI and Apache Logging
In WHM you can enable or disable an alias for cgi-bin scripts. You can also change the style in which you receive your Apache logs.

The CGI Script Alias setting allows you to set the default for cgi-bin directory creation. If this item is set to y, then every new domain and subdomain will have a cgi-bin directory created so the user can use CGI scripts (like Perl scripts). Setting this to n will turn off the CGI feature by default for new accounts. You can change this setting for each account you set up.
The Apache Access Log setting can be set to combined or access. This changes what is reported in Apache raw logs. Generally, you'll probably want the added information that combined provides.
After making the necessary changes remember to click Save.
After you have finished working with the basic cPanel and WHM settings, click the Next button in the WHM sidebar to continue to the next installation step. Don't forget to come back to the Basic cPanel/WHM Setup later if you've skipped any important settings.
WHM Setup: Disk Quota Setup
This will start a process on the server that will set up disk quotas on the server so that WHM can keep track of how much disk space each user is using. This process may take a while.

Thankfully, you don't have to watch the display until the process is finished if you don't want to. You can click Next in the sidebar at any time, and the quota setup will be completed in the background while you work. Just don't reboot the server in the middle of this process.
WHM Setup: Nameserver Setup
Now you can choose to set up the local DNS server on this server. cPanel uses a program called Bind to serve DNS information about the domains on this server. Generally, you will want to set up the nameserver process.

This should not take long. Once finished, click Next Step in the WHM sidebar to continue with setup.
WHM Setup: DNS Resolvers
Now you will want to specify at least two off-server, working DNS servers. Typically, your host NOC can provide you with this information. If you don't have anything else, you can set this to two IP addresses from your own server. However, for security reasons (which we will discuss in Chapter 3) this isn't a good idea, and it is thus best if you can avoid it.

Specify at least two different IPs and then save the changes and click Next Step in the sidebar to continue with setup.
WHM Setup: Setting the MySQL Root Password
Since every cPanel server comes with MySQL (a database server) set up, you will need to set a root (master) password. Don't confuse the root user password with the MySQL root password. They are, and should always be entirely different. It is unlikely you will ever need to remember this password unless you plan to connect to the MySQL as root. Even if you do decide to do so later, you can change the MySQL root password again at any time. Make it long and random. Include upper and lower case letters and numbers, but do try to stay away from extended characters and symbols, or phpMyAdmin may not be able to connect to the MySQL server.

Type the password into the box, save the changes and then click Finish in the sidebar to finish the installation process. Congratulations on the successful setup of your server!
Summary
In this chapter, you've learned how to download and install cPanel on your server. You have also learned how to finish the installation by configuring some settings in WHM. In particular, you've configured how your server will contact you in case of problems. You now know how to set up what default themes and directories WHM and cPanel will use, and also know about minimum user IDs and basic networking interfaces.
You have learned about the server hostname, configured nameserver values and basic DNS settings, and also defined how CGI and Apache logging are handled. In addition, we have seen how to set up initial disk space quota tracking on your server, start the nameserver process (Bind), configure the DNS resolvers, and set the root MySQL password for your server.
You've finished the basic setup of your server, but there is still more work to be done before you can move paying customers onto your server. Chapter 3 will deal with all of the additional settings you will want to configure, before moving on to Apache, PHP, and database configuration in Chapter 4.
By Aric Pedersen
Contributed by Packt Publishing
This chapter is from the book "Web Host Manager Administration Guide", published by Packt Publishing.
Where to buy this book
You can buy Web Host Manager Administration Guide from the Packt Publishing website: http://www.packtpub.com/web_host_manager/book
Free shipping to the US, UK, Europe, Australia, New Zealand and India.
Alternatively, you can buy the book from Amazon, BN.com, Computer Manuals and most internet book retailers.













