Installing CentOS Server for Production

by Ostatic Staff - Aug. 17, 2010

Installing a Linux server is easy, especially if you download one of the latest CentOS ISOs. There’s a nice wizard to walk you through the installation process, and it’s perfectly acceptable to do a standard default install. But, if you intend to do any serious hosting or expect production quality performance out of the system, or if you are just as particular as I am, than a bit of customizing of the install at the beginning could save you lots of time later on down the road.

The first few screens of the installer are fairly basic. For Red Hat based systems like CentOS I use a graphical installer. I always skip testing the media, I never saw the point in that… if it’s broken it’ll let me know, but it’s been a long time since I had a bad install disk. Partitioning the disk is the first important step in creating a sustainable server image. Here are the steps I follow when partitioning a disk:

  1. Create a 200MB /boot partition. You probably won’t use all of that space, but it’s good to have just in case.

  2. Create a 2GB swap partition. The old rule of thumb was to have one and a half times the amount of RAM in swap. However, the practicality of that rule went out the window when we started installing systems with 32GB of RAM. It is possible to add swap later if needed, but for our environment it is very rare, and 2GB seems to be a good standard.

  3. Add the rest of the disk to LVM. Name the volume group something short and reasonable, like vg1.

The rest of the partitioning setup is done in LVM. LVM allows you to modify the partitions on the fly, without rebooting the server. In a production environment, bringing down a server can be a major event with several players involved, so it’s best if it can be avoided.

Create these partitions in LVM:

  1. / - 500MB - Name: root
  2. /tmp - 1024MB - Name: tmp
  3. /var - 1024MB - Name: var
  4. /usr - 2048MB - Name: usr
  5. /opt - 1024MB - Name: opt
  6. /home - 1024MB - Name: home

By default, CentOS will put all of the directories above under one big root filesystem. The problem with this is that if you have an application that decides to core dump or just go nuts writing logs, you could fill up the entire filesystem and possibly crash the server. By separating out the filesystems into separate partitions, you reduce the risk of any one application or user using up too much disk space.

The next few screens are also fairly basic; choosing the grub boot loader, assigning an IP address, and choosing the location. The final piece of customization I encourage everyone installing a server to do is to customize the software packages.

First, uncheck GNOME. It’s a server, there’s no reason to run a GUI on it, much less a large desktop class GUI like GNOME. In the customization screen, I always select the development tools and libraries, and then uncheck dial-up under base system, because it’s been seven years since I used dial up. It’s good to familiarize yourself with the options available here, and keep in mind what type of server this is going to be. The best servers have only the software that they absolutely need to run, and nothing else.

This is a quick rundown of how I manage installing servers, and it’s been tested and working in the data center for four years or so now. LVM gives you a lot of options, and is well worth digging into and learning. If you’ve got any tips for me, or ideas on how to make the install even better, I’d love to hear them! Drop me a line in the comments.