Jun
24
2012

Setting up a cPanel server

Thinking about using cPanel on your hosting server? Good choice. Setting up a cPanel server takes a little patience, but it’s very easy and straight forward. Basically, everything you need in order to set up a hosting environment on a Linux server is provided for you, you just need to do the configurations through their easy to use WHM panel. This tutorial will explain how to get started with setting up a cPanel server.

Before you get started, you’ll want to make sure that your server is ready to run cPanel. Take a peek at the cPanel requirements page to make sure that your server will work with cPanel:

http://cpanel.net/products/cpanelwhm/system-requirements.html

That being said, by now I’m assuming that before you continue reading this, you will have met the following requirements:

  • You already have a physical server or supported VPS platform meeting the minimum requirements indicated above. For sake of preference, this guide is based on a Redhat-type server, CentOS 5 specifically.
  • You have root access to your server and have a basic system administrative level of knowledge of LAMP, cPanel, and WHM

All set? Great…let’s continue!

The Linux Install

First you need a fresh OS installation on your server. Don’t bother trying to use an existing server or one that’s already seasoned, as cPanel will likely remove existing software. If you already installed Linux, great. If not, that should be your first step. I personally prefer to use the kickstart method to do a network install, as it allows you to easily deploy and standardize Linux installations.

– Download a net install ISO from a CentOS mirror (like http://mirror.rackspace.com/CentOS/) . At the time this article is written, CentOS 5.4 is the current version, so I’d download the following file:

http://mirror.rackspace.com/CentOS/5.4/isos/x86_64/CentOS-5.4-x86_64-netinstall.iso

Then either burn it to a CD and boot off it, or if using a remote access card that supports ISO loading, load it up and boot to the net install image. Now you need to set up the kickstart file. If you have an existing server that runs any for of Redhat, you should find an anaconda file in your root user’s folder that contains your existing installation information, which you can just edit and apply to another machine. Or, click here for a sample kickstart file . In this you need to edit a few things:

  • url : This should be the location of the repo, respective of the version of CentOS you downloaded. So my URL would be:

http://mirror.rackspace.com/CentOS/5.4/os/x86_64/

  • network : This should reflect the correct device and IP information at least, and you can adjust the nameservers ( resolvers) and hostname later if needed.
  • rootpw : Your root password

The partitioning information in my example is very basic. It will set up a 6GB swap partition, a /boot partition, and a single root partition for everything else. You can modify this as needed if you want to create more partitions on the your server, like a separate one for /home, /var, etc. Here are a couple links to help you with your kickstart file:

http://www.faqs.org/docs/Linux-HOWTO/KickStart-HOWTO.html

http://wiki.centos.org/TipsAndTricks/KickStart

http://www.linuxtopia.org/online_books/centos5/centos5_installation_guide/centos5_ch-redhat-config-kickstart.html

You need to move your kickstart file to a location where your new server will be able to access it over a network, either internally or externally, and make sure you’re booted to the Linux install prompt. Once you’re there, type in the console:

linux ks=http://<ip>/locationofkickstart.cfg ksdevice=eth0 IP=xxx.xxx.xxx.xxx netmask=xxx.xxx.xxx.xxx gateway=xxx.xxx.xxx.xxx

You need to make sure the ksdevice and IP parameters are correct, and they can be the same as what’s in the actual kickstart file. This should start your Linux installation, and will take 10 minutes or more depending on the speed of your server and network.

The cPanel Installation

Now that you have a clean Linux installation, you can install cPanel. The actual base installation of cPanel is very easy:

wget http://layer2.cpanel.net/latest

sh latest

This will install everything – WHM/cPanel, Perl, MySQL, Apache, etc. Sit back and relax for a bit as this generally takes an hour or longer.

Set up your Software

cPanel is installed at this point, and all you need to do is some basic configuration:

  • Basic settings – Configure in WHM > Tweak Settings
  • EasyApache – Go to WHM >Apache Update and build Apache according to your preferences

This is only the basic setup, but if you go though WHM you’ll see a lot more configurable options. From here, I suggest you review the cPanel/WHM setup guide:

http://twiki.cpanel.net/twiki/bin/view/AllDocumentation/InstallationGuide/WebHome

1 Comment + Add Comment

  • Most webhosting has cPanel installed for you but this article teaches you the ins and outs of installing one yourself. Very very informative. Will bookmark it for future reference. Thanks!

Leave a comment