Mail server - Postfix and MySQL installation
Now we've configured the base Slice details and 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.
Installation
As well has 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.
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 Slices 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 'mail.demoslice.com'.
Test
The base Postfix and MySQL installation is now complete.
You can test the Postfix installation by sending a quick email from the Slice to a working email address.
From the terminal:
mail address@example.com
Note you will need to replace the 'address@example.com' 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:
mail adress@example.com
Subject: test email from demoslice.com
test body of email
.
Cc:
A few seconds later I had a new and shiny email from my Slice. Note that at this stage the 'from' field was shown to be:
demo@mail.demoslice.com
The next articles will show how to set the correct domain in the 'from' field.
Summary
The base Postfix and MySQL installation is very simple and the Slice is already set to send emails.
The next article will look at creating the mail database in MySQL for multiple domains and users.
PickledOnion


Article Comments:
Luke commented Sun Dec 07 05:18:58 UTC 2008:
Hi. I wend through the complete tutorial and when testing it didn't work, so know I'm going through it all again and I noticed that the mail command isn't working anymore. It did work the first time I wend through the tutorial through. What would be the point to start trouble shooting this?
Will commented Sat Jan 31 15:36:00 UTC 2009:
Hi, it appears that I may have done something sort of dumb. I followed your instructions, but I set the mail name in the postfix configuration to "example.com" (not really example.com, but another one), instead of "mail.example.com". Will that affect anything? I was able to send a test email by the way.
Daniel Codrea commented Mon Mar 23 08:31:31 UTC 2009:
Hi, I followed the examples in the article step by step, I used a mail command , but nothing happened. No error, but no mail either. Can you assist please? Daniel
Patrick Sanchez commented Mon Mar 23 10:50:25 UTC 2009:
I can't send mail also. After typing the subject, my console seems to hang.
Hexstream commented Wed Apr 29 14:18:29 UTC 2009:
After you've entered the subject, the mail command is simply waiting for the body of the message. Type it in, then input a dot alone on one line when you're done. That is, press Enter, ".", Enter.
chovy commented Fri May 15 04:11:58 UTC 2009:
How do I re-define the options when running the initial sudo apt-get install ... command?
ie: if i want to change my mail server domain in postfix et.al