CentOS (Community ENTerprise Operating System) is the most popular Linux distribution used for web servers, running around 30% of the world's Linux-based websites, according to a survey by W3Techs. CentOS is built from the freely available sources for Red Hat Enterprise Linux 5.6 (RHEL) and supports 32- and 64-bit x86 architectures. Since it depends on Red Hat releasing the sources, CentOS is always behind the current Red Hat release. RHEL 5.6 was released in January 2011, and CentOS 5.6 followed last month. I downloaded and tested the latest version and found that CentOS remains a trustworthy server solution. System administrators familiar with any of the CentOS 5 releases will feel immediately at home with this release.
CentOS isn't simply a recompilation of Red Hat's code with trademarks and copyrights removed. The project also offers a live CD version, which Red Hat doesn't, and it merges RHEL's separate client and server versions into a single distribution. CentOS also provides the CentOS Extra repository with a handful of extra packages (such as the Xfce desktop) not provided by Red Hat. For this review, we tested CentOS only as a server.
CentOS 5.6 uses Linux kernel 2.6.18 with a variety of "enterprise" patches, back ports from later kernel versions, and four years of bug fixes. Red Hat released the resultant kernel, known as 2.6.18-238.el5, at the end of 2010. Though the initial release of the 2.6.18 kernel was in 2006, it has been maintained consistently since then, resulting in a mature, stable, and reliable platform – in short, an excellent base for an enterprise operating system.
Features from later kernels that have been back-ported into the 2.6.18 kernel include the ext4 filesystem, eCryptfs (a POSIX-compliant encrypted filesystem), support for Intel's Virtualization Technology for Directed I/O (VT-d), support for the Intel i7 memory controllers, and various drivers that support newer hardware.
The ext4 filesystem, successor to ext3, boosts large file performance and keeps disk fragmentation in check. Ext4 theoretically supports volumes with sizes up to 1 exabyte (1 million terabytes) and files sizes up to 16 terabytes. Practically, however, you can create only 16TB filesystems due to limitations in the e4fsprogs utilities used for maintaining ext4 filesystems. With those utilities you can convert an ext3 filesystem to ext4, or mount ext2 and ext3 filesystems.
To start testing CentOS 5.6, I downloaded installation media from the CentOS.org website. You can download the software in a variety of guises, including a set of seven CDs, a DVD, or a 700MB live CD. The DVD (two discs for the 64-bit version) provides the easiest installation, but with any of the media, installation is simple enough for any system administrator, particularly those used to installing Linux.
To enable ext4 as an option during installation, type linux ext4 at the boot: prompt of the installation process. You can then either create a custom partitioning layout that uses ext4 or use the default layout and check Review and modify partitioning layout. Modify the root partition (/) to ext4 but leave /boot as ext3 as CentOS 5.6 doesn't support booting from an ext4 partition.
During the installation you configure the networking (which is set to DHCP by default), select your timezone, set a root password, and select which packages to install. For a general-purpose server install the packages "server," "server-gui," and "virtualization" in order to install the essentials; you can add additional packages once the OS is installed.
After the install and initial boot, CentOS executes an initial setup wizard that gives an administrator the chance to configure the firewall, set up SELinux, and create an initial user. Once completed, a GUI login screen appears. Log in using the user created during the setup wizard. You can add additional users at any time using the Users and Groups application found under System -> Administration.
The CentOS server offers all the major components organizations need to build a mail, database, directory, web, or file server, and host virtual machines. However, not all of these services are installed by default, even if you select the server option during install. For example, CentOS installs neither MySQL server nor PostgreSQL servers. This is a little surprising, but installing any missing service via the Package Manager is painless.
To start the Package Manager go to Applications -> Add/Remove Software. The Browse tab shows software groups such as Desktop, Development, and Servers, and next to each is a list of the packages available. Click the Optional packages button to see exactly what is and what isn't installed.
You can also install software from the command line using the yum utility. The downside of yum is that it isn't always obvious which packages to install. Use yum keyword, where keyword is the service you want to install, as a way to find exact package names. Once you know the package name, installation is simple. To install MySQL, for instance, open a terminal window, switch user to root (su -) and run the command yum -y install mysql-server.
yum -y install mysql-server
For security reasons the only network accessible services running by default are the sendmail SMTP server and the OpenSSH server. To configure Apache and MySQL (or any other server components) to start at boot time, browse the system menu to System -> Administration -> Server Settings -> Services. Tick the relevant services (for example, httpd and mysqld) and click Save before exiting the application. You can also start services in a terminal window as root:
chkconfig --levels 235 httpd onchkconfig --levels 235 mysql on
CentOS provides several applications for configuring the server. You configure the network from System -> Administration -> Network and manage server components such as Apache and NFS under System -> Administration -> Server Settings. These management applications are simple but useful for basic tasks like adding a virtual host to Apache or creating a share for Samba. However, they aren't all-encompassing; for more complicated tasks you have to edit the relevant configuration files directly.
As a mail server CentOS offers a choice of Sendmail 8.13 (the default), Exim 4.63, or Postfix 2.3.3, which you can install using the Package Manager. Since two email servers can't run on the same machine, any default email server already installed should be removed or deactivated. For example, if you install Postfix, you can configure Sendmail to not start and Postfix to start at boot time using the commands:
chkconfig sendmail offchkconfig --level 345 postfix on
For providing web services CentOS comes with Apache 2.2.3, PHP 5.1, and MySQL 5.0.77. Although these aren't necessarily the latest versions (e.g. PHP is now at 5.3) they are more than adequate for most, if not all, situations. Maintaining consistent package versions over the CentOS 5 series enables easy upgrades without any surprises.
CentOS 5.6 offers two mutually exclusive variants of the popular Samba server for Windows file sharing. The default is Samba 3.0, which is the legacy version of Samba and has effectively reached its end of life. The alternative package, Samba 3.5.4, is compatible with the Active Directory Server controllers on Windows Server 2008 R2. If you are upgrading from a previous point release of CentOS 5 and don't need Server 2008 compatibility then the easiest thing to do is stick with Samba 3.0. New installations should start with Samba 3.5, as this will be the default version in CentOS 6.
Directory services in CentOS are provided by OpenLDAP 2.3 or the CentOS directory server 8.1 (based on the Red Hat Directory Server). OpenLDAP isn't installed by default but can be found under Network Servers in the Package Manager. After installation, use the Services application to ensure ldap is marked to start at bootup or use the command chkconfig --level 345 ldap on.
chkconfig --level 345 ldap on
If you prefer CentOS directory server, you can install it using the command yum -y install centos-db. Configuring a directory service is a complex task, so the CentOS directory comes with a Java management tool called centos-idm-manager. Before you use it, configure the directory server using the setup-ds-admin.pl command. Part of this process is to create an administrator for the directory (cn="Directory Manager" by default). Once that's configured, you can launch the management console with centos-idm-console -a http://localhost:9830 -u "cn=Directory Manager" -w password where password is the password configured during the setup.
yum -y install centos-db
centos-idm-console -a http://localhost:9830 -u "cn=Directory Manager" -w password
Like OpenLDAP, the CentOS directory server and the management server aren't started automatically. Use the Services application to ensure "dirsrv" and "dirsrv-admin" are marked to start at bootup or use the commands:
chkconfig --level 345 dirsrv onchkconfig --level 345 dirsrv-admin on
To host virtual machines, CentOS integrates Xen and KVM along with various command-line and GUI tools to manage virtual machines. The debate over which of the two integrated virtualization solutions to use on CentOS has been muted recently by Red Hat's decision to drop Xen from RHEL 6.0. Any new virtualization setups should use KVM to ease migration to CentOS 6 when it is released.
You can install KVM using the Package Manager or from the command line (as root):
yum -y install kvm virt-manager libvirt libvirt-python python-virtinst
The Virtual Machine Manager (virt-manager), available under Applications -> System Tools, lets you create and control virtual machines. Supported guest operating systems include Linux, Windows XP, and Windows Server. The Virtual Machine Manager GUI isn't as polished as some of the third-party virtualization solutions, but it is functional and gives easy access to controlling the virtual machines.
Unlike RHEL, CentOS costs nothing to download and install, where as RHEL is a commercial product. However, CentOS doesn't come with any professional support, meaning you could be left hunting around in forums to find answers when you have problems.
If professional support isn't an issue, then the pedigree, history, and maturity of CentOS make it an excellent choice as a server operating system. It offers a broad range of services, including virtualization, making it an excellent choice for almost any server job for organizations from small businesses right up to the enterprise.
Allowed tags: <a> link, <b> bold, <i> italics