Recently I needed to set up a server with all the usual server components — Web, mail, and file sharing. It needed to be rock-solid and reliable. I didn’t want to download 4GB of software from the Net, so I turned to CentOS’ Single Server CD.
CentOS, which stands for Community ENTerprise Operating System, is an enterprise-focused Linux distribution built from the freely available sources (under the GPL and similar licenses) from Red Hat. CentOS 4 is based on Red Hat Enterprise Linux 4 and supports the x86 (i586 and i686), x86_64 (AMD64 and Intel EMT64), IA64, Alpha, and S390 and S390x architectures.
The Single Server CD contains most of the items required for a basic server set up, but without a GUI. It’s great for those who want a functional install quickly. Also, since there is no memory-hungry GUI, you can run a basic server with just 128MB of RAM, though of course you will need more if you need to deploy large databases.
Installing Single Server CD is straightforward, especially if you have installed other Linux distributions. You need to download the Single Server CD from a local mirror, burn it to a disc, and boot your server from that CD.
Even though the Single Server CD doesn’t contain a GUI, the installation process uses a graphical interface, which means it’s easy to install. Follow the on-screen instructions and the install should be effortless. Tip: If your server doesn’t contain any other data and you are happy to have all the disks reformatted, use the “automatically partition” option when it comes to the Disk Partitioning Setup, as this will save you lots of time.
I suggest disabling SELinux and turning off the firewall, especially if your server is secure inside your local LAN. You can change the firewall settings later if you like with the system-config-securitylevel command.
You can safely choose to install the default software packages. This will give you a basic CentOS system with Web, mail, and FTP servers, DNS, and Windows file sharing via Samba. On a modern machine you should be able to have the server installed in less than 20 minutes.
Not all the packages on the CD are installed. For instance, if you require PostgreSQL, you’ll have to install it later from the disc. To install PostgreSQL, mount the CD-ROM (mount /media/cdrom) and use yum to install the client libraries and the server:
yum localinstall /media/cdrom/CentOS/RPMS/postgresql-7*
yum localinstall /media/cdrom/CentOS/RPMS/postgresql-server-7*
PHP 5 and MySQL 5
The strength of CentOS is its reliability and stability. It is built around proven packages and doesn’t rely on bleeding-edge software. However, there is a disadvantage to this, namely that some of the newest software isn’t installed. The most critical omissions, in my opinion, are PHP 5 and MySQL 5, but these packages are available through the CentOS Plus Repository.
By default CentOS 4.4 comes with PHP 4.3.9. To upgrade to PHP 5, make sure your server is connected to the Internet and run the command:
yum –enablerepo=centosplus upgrade php*
The same goes for MySQL. The default in CentOS 4.4 is MySQL 4.1.20. To upgrade to 5, use the following commands:
yum –enablerepo=centosplus upgrade mysql*
yum –enablerepo=centosplus install mysql-server-5*
Since CentOS 4.4 Single Server CD doesn’t come with a GUI, you need to do all your configuration via the command line. Here are few keys commands and files to help you configure your server.
To start and stop a service use:
service XYZ start
service XYZ stop
Where XYZ is the service name, e.g. postgresql.
To configure the networking run:
To configure a printer run:
By default there are several system services that are not started at boot time, including the Web server and the MySQL server. To ensure that the essential services are started at boot time, run the following commands:
chkconfig –levels 235 httpd on
chkconfig –levels 235 mysql on
chkconfig –levels 235 smb on
chkconfig –levels 235 vsftpd on
If you need POP3 and IMAP services, you need to configure the dovecot daemon. By default, the dovecot daemon provides only IMAP services. If you also want POP3 you must edit /etc/dovecot.conf and put in the line:
protocols = imap imaps pop3 pop3s
Dovecot isn’t started by default either (but is installed as one of the standard packages). To make sure it is started at boot time, type:
chkconfig –levels 235 dovecot on
Once you have everything configured correctly, reboot, not because Linux needs it, but just to be sure that everything comes up and runs as expected.
CentOS is a reliable and robust Linux distribution, and the Single Server CD version is close to perfect for anyone looking for a simple but yet functional server distribution without having to download four or five CDs from the net.