Recently I did a blog on the installation of eGroupware to be used as an Exchange replacement (See my blog DIY IT: Groupware on a shoestring budget.) The suite is very powerful and makes an outstanding substitute for Exchange. But during that article I mentioned the necessity of having a previously installed and configured mail server. Without that mail server, the groupware server is fairly pointless (unless you just need a calendar server.)
So, what about the email server? What can you do? The answer to that is not only simple, it's also cheap. You can install and set up a Postfix mail server on that same server you install eGroupware. The combination of Postfix and eGroupware is quite a solid one, so let's not waste any time and get that Postfix server up and running.
This mail server will be install on the same machine as our eGroupware machine. For this example I will use a Ubuntu 10.10 installation. You will want to already have your domain purchased and your IP addressed routed. With all of that out of the way, you are ready to begin.
The installation of the mail server itself is very easy. All that is needed is a terminal window and sudo access. Here are the steps for the installation.
- Open up a terminal window. If the machine is a GUI-less server, just log in.
- Issue the command sudo apt-get install postfix.
- Type your sudo password and hit Enter.
- Allow any dependencies to be installed.
- Let the installation finish.
When the installation is finished, the Postfix daemon should be running. Test the connection from the command line by issuing the command:
telnet localhost 25
The above command will attempt to make a connection to the machine on port 25, which is the listing port for the mail server. If it connects, Postfix is up and running and should report back something like:
Connected to localhost.
Escape character is '^]'.
220 localhost.localdomain ESMTP Postfix (Ubuntu)
If the above text is presented, Postfix is ready to be configured. If a connection can not be made, the firewall rules might have to be checked, or the Postfix daemon may need to be restarted. To restart the daemon, enter the command:
sudo /etc/init.d/postfix start
After the daemon has started, attempt to connect again.
The configuration of Postfix will make up the bulk of the work here, but it's still a fairly simple process. In fact, Postfix might well be the email server with the simplest configuration. Here's how it works.
Postfix only has one main configuration file: /etc/postfix/main.cf. Open up that file in a text editor and look for the following options:
Configure these options according to the following guidelines:
- myhostname: This is the hostname of your mail server. Make sure to not place the FQKN here. For example, if the domain is my.domain.com, only enter domain for the myhostname option.
- mydestination: This declares where the mail server will be delivering to locally. The default is: mydestination = $myhostname localhost.$mydomain localhost. Most likely the default will work just fine.
- mynetworks: Here is where valid networks are defined. For example, an entry here if 127.0.0.1/8 would only deliver to the local machines. Generally speaking, that will not work. An entry similar to mynetworks = 127.0.0.1/8 192.168.100.1/24 will deliver to both local machines and within a LAN based on the 192.168.100.1 address scheme. For an email server to deliver internally and externally, configure this option like so: mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
If your mail server needs to deliver mail to an entire domain, add another entry to the section above like:
where mydomain.com is the actual domain.
Save that configuration file and restart the postfix daemon with the command:
sudo /etc/init.d/postfix reload
The mail server is now up and running!
Remember, this is a Linux email server, so in order for a user to have an email account, they must have an account on the server. This is simple. Back to the terminal window issue the command:
sudo useradd -m USERNAME
Where USERNAME is the actual name of the user to be added. This command will be followed by a request to enter a password for the new user. Once that is complete, the user should now be able to use their account on the mail server.
At this point, the groupware suite can be installed on top of the email server. Once that is complete, the users should be able to log onto the groupware tool and take advantage of web-based email. Of course this article only touches the surface of getting the email server up and running. There are always security concerns for any type of mail server, but that is another conversation for another day. But this does show how easy it is to get an email server up and running on the cheap!
Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website jackwallen.com.