CentOS 6.4 Email Gateway (Part 1)

This is a 7 Step "how to" in creating an Anti-Spam Email Gateway.

First step is to install a bare bones CentOS system. I chose the 32bit CentOS 6.4 Minimal Install from here:

CentOS 32bit Minimal Install

Once your chosen flavour of CentOS is installed and you have ensured that you have configured the system to access the internet we can commence the installation and configuration of the gateway.

I am making a few assumptions with regard to your knowledge of configuring linux and how your network is setup. Firstly, to configure your linux box or VM you should be familiar with using Putty and WinSCP to connect and make edits.You can download Putty here and download WinSCP here.

Secondly, I am assuming that you are placing the system behind a firewall and therefore network security is handled by another device such as a hardware firewall. For this reason we can turn off SELinux.

Edit the file:


Find the string:


Change it to:


Now reboot your installation for the changes to take effect.

Once your machine has rebooted run the command:


It should return:

SELinux status:                 disabled

Now we have SELinux disabled we can continue on with our install. We'll next instal NTP service. At your console type in:

yum install ntp
chkconfig ntpd on

Next we'll configure our time zone and ensure the date and time are correct on the machine. First we'll make a backup of the existing configuration:

mv /etc/localtime /etc/localtime.bak

Next we'll ensure we the correct time zone set for the machine by running the following:

ln -s /usr/share/zoneinfo/Australia/Canberra /etc/localtime

Make sure you change Australia/Canberra above to suit your location. Check in the location /usr/share/zoneinfo to which is closest to suit your needs. Now run the date command in your console to ensure the correct date and time has been set:

Wed Sep 25 13:57:03 EST 2013

If the date and time are incorrect, you can set them using the following:

rm /etc/localtime
ln -s /usr/share/zoneinfo/GMT /etc/localtime
date 092514012013
hwclock --systohc

The date sytax above is MMDDhhmmYYYY. To confirm you have the correct date and time again, run:

Wed Sep 25 14:03:49 EST 2013

To check the hardware clock:

Wed 25 Sep 2013 02:07:41 PM EST  -1.001041 seconds

Install the EPEL repo RPM:

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

Check if it is listed:

yum repolist

It should return something like this:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/metalink                                            | 3.7 kB     00:00
 * base: mirror.ventraip.net.au
 * epel: fedora.mirror.serversaustralia.com.au
 * extras: mirror.ventraip.net.au
 * updates: mirror.ventraip.net.au
epel                                                     | 4.2 kB     00:00
epel/primary_db                                          | 4.6 MB     00:10
repo id           repo name                                               status
base              CentOS-6 - Base                                         4,802
epel              Extra Packages for Enterprise Linux 6 - i386            8,048
extras            CentOS-6 - Extras                                          12
updates           CentOS-6 - Updates                                        945
repolist: 13,807

Edit the file /etc/yum.repos.d/epel.repo and add the line below under the [epel] section.


Install Yum priorities package:

yum install yum-priorities

Now let's do a system update to ensure the system is patched:

yum update

We have now gotten the system to the stage where we are ready to configure and install Postfix, Spam Assassin, Mailscanner, Postgrey and Mailwatch.

Go to Part 2


No Comments Yet.

Leave a comment

Sign up to our newsletter where you’ll receive notices on when we post new articles and helpful “how tos” to make your IT life easier.