Mail Server - Postfix and MySQL Installation

Now we've added the vmail user, we are ready to install Postfix and MySQL. Remember, we will be using MySQL to control the domains and user details for our mail server.




As well as installing Postfix and the relevant MySQL packages, we'll also install telnet and mailx. These two packages will allow us to test the installation at different stages of the mail server setup.

Note:  In Ubuntu 10.10 the mailx package has been replaced by the package 'mailutils.'  if you are using Ubuntu 10.10, change the last part of the following command and replace 'mailx' with 'mailutils'

Let's go ahead and do that:

sudo aptitude install postfix postfix-mysql mysql-server postfix-tls libsasl2-2 libsasl2-modules libsasl2-modules-sql sasl2-bin libpam-mysql openssl telnet mailx

As the base Cloud Servers are minimal Linux images, quite a few packages will be installed.

You will be asked some questions during the installation.


Firstly, you will need to set the root password for MySQL:


Once done, you will be asked to repeat the password.

Next is the postfix installation.


The first screen is informative and you can simply press Enter/Return on the keyboard.

Next select 'Internet Site' and press Enter/Return:


The next screen asks for the system mail name:


Enter the same name as set in the previous article. In this case, I entered ''.


The base Postfix and MySQL installation is now complete.

You can test the Postfix installation by sending a quick email from the Cloud Server to a working email address.

From the terminal:


You will need to replace the '' with a working email address - your usual email address will suffice.

You will need to enter the subject and body of the email. Once done press Enter/Return and enter a single period (.) - this lets the mail command know the message has finished.

You will need to press Enter/Return a couple more times to send the mail. Once done you will be placed back at the command prompt.

This is what my terminal looked like during the test:

Subject: test email from
test body of email

A few seconds later I had a new and shiny email from my Cloud Server. Note that at this stage the 'from' field was shown to be:

The next articles will show how to set the correct domain in the 'from' field.


The base Postfix and MySQL installation is very simple and the Cloud Server is already set to send emails.

The next article will look at creating the mail database in MySQL for multiple domains and users.

Previous Article
Next Article

© 2015 Rackspace US, Inc.

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License

See license specifics and DISCLAIMER