Monday, February 15, 2010

HowTo: CentOS Install for a cPanel Web Server

SkyHi @ Monday, February 15, 2010
his is a basic installation tutorial for the CentOS operating system for dedicated server duties ! :)
CentOS is a free whitelabel distro of RedHat Enterprise with all the bells and wistles, and is the OS of choice for many web hosting companies

Installing the OS using ‘Text Mode’ :

1 – Insert the first Linux installation CD-ROM (disc 1) in the CD-ROM drive of your server and restart the server.
2 – At the boot: prompt, type text and press the Enter key. This starts the installation process.
3 – On the Language Selection screen, select English as the language that you want to run the installation program in, then click OK.
4 – On the Keyboard Selection screen, select the keyboard attached to your server, then click OK.
5 – On the Mouse Selection screen, select the mouse attached to your server, then click OK.
6 – On the Welcome screen, review the installation information, then click OK.
7 – On the Installation Type screen, select Custom, then click OK.
8 – On the Disk Partitioning Setup screen, select Disk Druid. Quote:
- If your disk has existing partitions, select each partition and click Delete.
9 – Create the following disk partitions: Quote:
The following partitions are recommended prior to installing cPanel: 

**1 GB /
*50 MB /boot (No seperate /boot for FreeBSD)
**1 GB /tmp
*10 GB /usr
**7 GB /var
**1 GB swap (swap should be 2x RAM)
Remaining space to /home Note: The above partitioning scheme is assuming a 40 GB hard drive. If you have a larger hard drive, you should increment /usr & /var accordingly. To create the / partition ‘root’: Quote:
* On the Partitioning screen (see step 8 ) , click New.
* In the Mount Point field, type / .
* For the Filesystem type select ext3.
* In the Size (MB) field, type 1024, then click OK. To create the /boot partition: Quote:
* On the Partitioning screen (see step 8 ) , click New.
* In the Mount Point field, type /boot.
* For the Filesystem type select ext3.
* In the Size (MB) field, type 50, then click OK. To create the /tmp partition : Quote:
* On the Partitioning screen (see step 8 ) , click New.
* In the Mount Point field, type /tmp .
* For the Filesystem type select ext3.
* In the Size (MB) field, type 1024, then click OK. To create the /usr partition : Quote:
* On the Partitioning screen (see step 8 ) , click New.
* In the Mount Point field, type /usr .
* For the Filesystem type select ext3.
* In the Size (MB) field, type 10240, then click OK. To create the /var partition : Quote:
* On the Partitioning screen (see step 8 ) , click New.
* In the Mount Point field, type /var .
* For the Filesystem type select ext3.
* In the Size (MB) field, type 7168, then click OK. To create the swap partition: Quote:
* On the Partitioning screen (see step , click New.
* For the Filesystem type field, select swap.
* In the Size (MB) field, enter a number that is twice the current RAM (1024 If you are using 512 MB Ram), then click OK. To create the /home partition: Quote:
* On the Partitioning screen (see step , click New.
* In the Mount Point field, type /home.
* For the Filesystem type select ext3.
* In the Size (MB) field, select Fill all available space, then click OK.
10 – When finished, Click OK.
11 – On the Boot Loader Configuration screen, select LILO Boot Loader, then click OK.
12 – On each of the following three screens, click OK.
13 – On the Network Configuration screen, clear Use bootp/dhcp, enter your server network configuration, then click OK.
14 – On the Hostname Configuration screen, enter the fully qualified host name of your server, then click OK.
15 – On the Firewall Configuration screen, select No firewall, then click OK.
16 – On the Language Support screen, select English (USA), then click OK.
17 – On the Time Zone Selection screen, select the location, then click OK.
18 – On the Root Password screen, enter in the root password for your server, re-enter the password to confirm it, then click OK.
19 – If you want to create an account that you can use to remotely log on to your server using SSH or FTP, click Add.
*** Provide the login name and password, then click OK.
20 – Review the information on the User Account Setup screen, then click OK.
21 – Review the information on the Authentication Configuration screen, then click OK.
22 – On the Package Group Selection screen, verify that only the following packages are selected. Clear all other check boxes.
Quote:
. Network Support
. Messaging and Web Tools
. DNS Name Server
. Network Managed Workstation
. Software Development
23 – Click OK.
24 – Review the Installation to begin screen, then click OK.
25 – Insert the second/third installation CD-ROM when notified to, then click OK.
26 – To create a boot disk, click Yes. Otherwise, click No.
27 – When done, the installation complete screen displays.
28 – Click OK, then press Enter to restart.
[2] Checking the host name and network settings :
After your first boot, you must check your system’s host name and network configuration to ensure that they are correct. To check your system’s host name and network configuration:
- Log on to the system as the root user.
- Type vi /etc/hosts to open the host file and modify the contents.
- Verify that the file is in the following format:

- Verify that the loopback entry (127.0.0.1) appears in the file. A correctly configured file should look like this: Note : The IP addresses used here are for illustration purposes only; they are not valid values.
Quote:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
10.1.1.1 myhost.mydomain.com myhost – Modify the file as needed.
- Type :wq to close the file.
- Type vi /etc/sysconfig/network to open the network sysconfig file and modify the contents.
- Verify the host name. A correctly configured file should look like this: Note : The IP addresses used here are for illustration purposes only; they are not valid values.
Quote:
NETWORKING=yes
HOSTNAME=myserver.mydomain.com
GATEWAY=10.100.0.1 – Modify the file as needed.
- Type :wq to close the file.
- Type vi /etc/sysconfig/network-scripts/ifcfg-eth0 to open the network scripts file and modify the contents.
- Verify that network information. A correctly configured file should look like this: Note : The IP addresses used here are for illustration purposes only; they are not valid values.
Quote:
DEVICE=eth0
BOOTPROTO=static
BROADCAST=10.1.1.1
IPADDR=10.1.1.1
NETMASK=255.255.0.0
NETWORK=10.1.0.0
ONBOOT=yes – Modify the file as needed.
- To make these changes active, restart the system by typing:
Quote:
shutdown -r now [3]cPanel Installation Instructions:
Quote:
Important : You must have a valid cPanel license. If you do not have a valid cPanel license, please contact one of cPanel distributors listed at http://www.cpanel.net/dist.htm or buy a license directly from cPanel at http://www.cpanel.net/store/. cPanel now uses a universal install script which can be found at http://layer1.cpanel.net/. You can use the following commands in the root shell to download and start the installation script:
Quote:
mkdir /home/cpins
cd /home/cpins
wget http://layer1.cpanel.net/latest
sh latest At this point the installation has started and may take anywhere from 30 – 60 minutes to complete. At no point during the installation should you be prompted for user input. You will know the cPanel installation has been completed by the screen output coming to a stop & the statement “Done.” is printed on your screen. You should then hit “ctrl c”† to continue. Note: You must be on a stable connection to install cPanel. If your shell session disconnects during a cPanel install the cPanel installation will be aborted. You can restart the cPanel installation by completing “sh cpanel-*”† again, however it is recommended that you reformat your machine & start over to ensure a clean slate before placing the machine into production.
[4]cPanel/WHM Configuration: Following a successful install you should setup cPanel/WHM as soon as possible. In order to complete this process you will need to log into your machine using its main (eth0/fxp0) IP address; you should input something similar to this into your browser:
Quote:
https://xxx.xxx.xxx.xxx:2087 Note: you should replace xxx.xxx.xxx.xxx with your actual IP address. Further to that, you will be prompted about a self signed SSL certificate; ignore this by clicking on “Yes”. A self signed certificate is generated by cPanel/WHM to ensure a secure/encrypted communication with your server. You will now be prompted with a few questions related to how you would like your installation of cPanel/WHM customized. You can walk through the wizard by clicking on “Next Step” or if you are an experienced user feel free to click on “Finish” to skip to the end. For a complete user guide on how to access cPanel/WHM and/or use any of the functions within cPanel/WHM, please visit cPanel do*****ents section at http://www.cpanel.net/docs.htm That’s all for now .. Just keep in mind, this is not the all-in-one package for server installaion, you’ll have to secure the server, update your kernel, install a firewall, configure SSH, apply patches …. etc,etc,etc,etc Zzzzzzzzzzz This was just to illustrate the BASIC steps to get you online.


Responses

  1. CentOS and cPanel – Install Question

    Hello,

    The base figures are a good place to start but I am not sure the scale factor is entirely accurate. Var needs atleast 6 gig to be safe with a cpanel install but 10 isn’t a bad idea. The same goes for usr. With more accounts, these don’t grow nearly as quickly as the home directory will. It is good to make them larger, but you don’t need to quadrupal the size of them by any means.

    One thing I would like to note is that there is no backup partition listed. Is this going to be handled separately?

    Also, 1 gig for / is passable, but if you have an extra gig to spare, having / fill up means cpanel is off-line. I would also recommend 2 gig for /tmp if possible. I hope this helps.

    Regards,
    Rob


  2. Here is a snippet from the WHM admin manual in relation to Partition Size / Memory / CPU rec’s for a cPanel install.

    Source URL: http://www.cpanel.net/docs/pdf/whm/

    if you would like cPanel Inc to do your installation for you and you have obtained
    a license, you may request an installation at http://support.cpanel.net/. Make sure
    to provide your IP, the root pass of your server, and the operating system
    installed on the server. We do not charge for installations.
    The following partition scheme is recommended:
    /
    boot 35 Megabytes (Mb)
    /usr 2048+ Mb (If you have a 60 gig drive try 4096 for /usr, 5000 if you have an
    80 gig drive, etc.)
    /var 1500+ Mb
    /tmp 512+ Mb
    cPanel
    WebHost Manager User Manual
    2
    / 1024 Mb
    /home grow to fill disk
    swap 2x memory size
    NOTE: The “/tmp” directory is a special directory that is required to be writeable
    by all users and processes on the system. In general, directories that are writable
    by all users and processes are cause for security concern, however this
    directory is a special case. To minimize any security impact as a result of
    having an unsecured “/tmp” directory, it is recommended that “/tmp” be mounted
    on a seperate partition in order to take advantage of the “no exec” option
    available under both Linux and FreeBSD. If a separate mount point exists for
    “/tmp”, then the installer will verify and potentially remount the partition with the
    “no exec” option. Additionally, the installer will ensure that the sticky bit is set on
    the directory and that the other permissions are correct. If “/tmp” is not mounted
    on a separate partition, the installer will create a file system disk image of 512 Mb
    and mount “/tmp” on the newly created disk image with the “no exec” directive.
    Under most circumstances, 512 Mb is sufficient for the “/tmp” partition; however,
    your system may require additional space. It is therefore recommended that you
    include a separate partition for the “/tmp” mount point (sized according to your
    size specification) prior to installing cPanel.
    Minimum CPU/RAM/HD:
    P266
    256 Meg of ram
    4 Gig of space
    To install WebHost Manager
    Make sure you are logged in as root.
    # cd /home
    # wget http://layer1.cpanel.net/latest
    Note: For FreeBSD, you need to download and untar the latest installer package
    from http://www.cpanel.net/.
    # sh latest
    The installer has now started, and will take between 30 and 60 minutes
    depending on your machine. If you are asked any questions press the Enter key,
    or q if there is no default. After the installation is complete, you need to setup
    WebHost Manager – refer to Logging on for the First Time for more information.
    NOTE: You must be on a stable internet connect to install cPanel. If your shell
    session disconnects during the installation of cPanel, the installation will be
    aborted. You can restart the installation by using “sh latest” again however, we
    cPanel
    Installation
    3
    recommend reformatting your machine and starting over to ensure there are no
    problems with the installation.


  3. CentOS and cPanel – Install Question

    Hello,

    This is what we normally suggest and use for machines we setup:
    /boot 128Mb ( we suggest this much so you have room for older kernels, incase the server cannot boot to the current kernel)
    /tmp 2Gb
    swap 2x amount of RAM
    / 10Gb
    /home rest of disk.

    Now /usr does not need its own partition it will go on the / partition, and use part of the 10 gig allocated to it.

    Now If you feel that you are going to use a lot of space with databases you might was to increase the space allocated to / to 15g.

    We have found that making a /usr and /var partition does not really help the overall performance of the server in any fashion and often times puts a limit on the size of the partition. When leaving them at / they have around 10 gig to work with, where as if you make a 1.5 gig partition that is its limit and you cannot fit anything else on it.


  4. Here is another take on Partition Size suggestions:

    Start the CentOS install and just choose the Server Install method, don’t add or remove any packages and it will be good to go. Partitioning depends on what you plan on doing with the box. If your going to have a large amount of MySQL data then your going to want to make /var larger, you will want to make sure you give plenty of space in /usr because of customer logs and mailing lists. If you plan on giving your customer a ton of space make sure /home is fairly large.

    With a 250GB Drive i would probably do something like the following

    500 MB /boot
    15 GB /
    2 GB /tmp
    2 GB
    40 GB /var
    40 GB /usr
    REST /home

REFERENCE
http://paragonhost.wordpress.com/2006/11/14/howto-centos-install-for-a-cpanel-web-server/