0% found this document useful (0 votes)
43 views

Postfix Pre-Installation Steps: /sbin/service Sendmail Status

The document provides instructions for pre-installing, installing, configuring, and starting the Postfix mail transfer agent (MTA) on a Linux system. It also describes how to set up the Evolution mail client to send and receive email using the Postfix MTA. Key steps include checking for and stopping Sendmail, creating Postfix user accounts and groups, downloading and installing Postfix, configuring Postfix settings in main.cf like myhostname and mydomain, starting Postfix, and configuring Evolution for local mailbox retrieval and SMTP sending via Postfix.

Uploaded by

Furqan Anwar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

Postfix Pre-Installation Steps: /sbin/service Sendmail Status

The document provides instructions for pre-installing, installing, configuring, and starting the Postfix mail transfer agent (MTA) on a Linux system. It also describes how to set up the Evolution mail client to send and receive email using the Postfix MTA. Key steps include checking for and stopping Sendmail, creating Postfix user accounts and groups, downloading and installing Postfix, configuring Postfix settings in main.cf like myhostname and mydomain, starting Postfix, and configuring Evolution for local mailbox retrieval and SMTP sending via Postfix.

Uploaded by

Furqan Anwar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Postfix Pre-Installation Steps

The first step before installing Postfix is to make sure that Sendmail is not already
running on your system. You can check for this using the following command:

/sbin/service sendmail status

If sendmail is not running the following output will be displayed:

sendmail is stopped

If sendmail is running you will see the following:

sendmail is running

If sendmail is running on your system it is necessary to stop it before installing and


configuring Postfix. To stop sendmail run the following command as super user:

/sbin/service sendmail stop

The next step is to ensure that sendmail does not get restarted automatically when
the system is rebooted. The first step is find out which run levels will automatically
start sendmail. To do this we can use the chkconfig commandline tool as follows:

/sbin/chkconfig --list | grep sendmail

The above command will typically result in output similar to:

sendmail 0:off 1:off 2:on 3:off 4:on 5:on 6:off

This means that if the system boots into runlevels 2, 4 or 5 then the sendmail
service will automatically start. To turn off sendmail we can once again use the
sendmail command as follows:

/sbin/chkconfig sendmail off

The chkconfig defaults to changing the settings for runlevels 2, 3, 4 and 5. If you
can configure for specific runlevels using the –levels command line option if
necessary.

To verify the settings run chkconfig one more time as follows:

/sbin/chkconfig --list | grep sendmail

And check that the output is as follows:

sendmail 0:off 1:off 2:off 3:off 4:off 5:off 6:off


Sendmail is now switched off and configured so that it does not auto start when the
system is booted. We can now move on to installing Postfix.
Creating Postfix User Accounts and Groups
Postfix requires that some special user accounts and groups be created prior to
installation.

First create a user account "postfix" with a user id and group id that are unique (ie
not used by any other user account). Ideally this should also be an account that no-
one can log into. The account does not need an executable login shell or a home
directory that exists. Entries can be added using the /usr/sbin/adduser and
/usr/sbin/addgroup command line tools.

Typical /etc/password and /etc/group file entries look like this.

/etc/passwd:

postfix:*:6789:6789:/no/where:/no/shell

/etc/group:

postfix:*:6789:

Next, create a group called "postdrop" with a group id that is not used by any other
user account. Not even by the postfix user account. A typical /etc/group entry looks
like:

postdrop:*:9876:
Installing Postfix
It is recommended that you download the latest version of Postfix and install it on
your system. Most Linux distributions include Postfix but this is sometimes not
imstalled by defaults and may well not be the latest release.

The very latest Postfix release can be downloaded from:

http://www.postfix.org/download.html

Once download unpack the archive and build it using the “make” command:

make

After the build is complete the package must be installed. Installation must be
performed as super user and can be achieved using make as follows:

make install

The installation process will ask a number of questions. Most of these questions
have default responses and in all cases it should be safe to accept the default:

install_root: /

tempdir: [/mydir/postfix-2.2.5] (usually directory where you


installed the sources)
config_directory: /etc/postfix
daemon_directory: /usr/libexec/postfix
command_directory: /usr/sbin
queue_directory: /var/spool/postfix
sendmail_path: /usr/sbin/sendmail
newaliases_path: /usr/bin/newaliases
mailq_path: /usr/bin/mailq
mail_owner: postfix
setgid_group: postdrop
html_directory: no
manpage_directory: /usr/local/man
readme_directory: no

Having answered the questions make will install Postfix on your system and you are
ready to configure it.
Configuring Postfix
The main configuration settings for Postfix are located in the /etc/postfix/main.cf.
This file contains many configuration options many of which are beyond the scope
of the introductory book. There are many resources on the internet that provide
detailed information on Postfix so this section will focus on the basic options
required to get email up and running.

The key options in the main.cf file are:

myhostname = mta1.domain.com
mydomain = domain.com
myorigin = $myhostname
inet_interfaces = $myhostname

Other settings will have either been set up for you by the installation process or are
not needed unless you are feeling adventurous and want to configure a more
sophisticated email system.

The format of myhostname is host.domain.extension. For example if your Linux


system is called MyLinuxHost and you internet domain is MyDomain.com you would
set the myhostname option as:

myhostname = mylinuxhost.mydomain.com

The mydomain setting is just the domain part of the above setting. For example:

mydomain = mydomain.com

The myorigin and inet_interfaces options use the settings we have just created so
do not need to be changed (although the inet_interfaces may be commented out by
default so you should remove the “#” at the beginning of this particular line in the
main.cf file).
Starting Postfix
Once the /etc/postfix/main.cf file is configured with the correct settings it is now time to start up
postfix. This can be achieved from the command line as follows:
/usr/sbin/postfix start
The postfix process should now start up. The best way to check that everything is working is to
check you mail log. This is typically in /var/log/maillog and should now contain an entry that
looks like:
Nov 21 13:05:46 mylinuxhost postfix/postfix-script: starting the Postfix mail system
Nov 21 13:05:46 mylinuxhost postfix/master[10334]: daemon started -- version 2.2.5,
configuration /etc/postfix

As long as you don't see any error messages you have successfully installed and started Postfix
and you are ready to set up a mail client and start communicating with the outside world.

Configuring a Linux Mail Client


Having installed configured and started the Postfix system it is now time to set up a
mail client so that you can send and receive email messages.

For this example we are going to use the Evolution email client as the example.
Evolution is a powerful email client that is styled to a large extent on the Microsoft
Outlook tool.

When you first start up Evolution (which can be run from the command-line or from
the GNOME Desktop menu) for the first time you will be presented with a set up
wizard that will take you through the configuration process.

The Identity screen will ask for information about your email account. You will need
to provide the following information:

• Your full name (what gets displayed in the “From” field of the email client of
any person who receives email from you.
• Your email address. Typically you will use domain that was set up in the
main.cf file. For example [email protected].

Once you have filled in these fields click “Next” to proceed to the next stage of
configuration which is where we tell Evolution how to pick up received mail. The
default configuration for Postfix is to place email in a /var/spool/mail/<login id>. For
example if your log in ID on the system is john your email will be placed in a file
called /var/spool/mail/john.
On the Evolution “Receive Mail” screen, therefore, we need to change the “Server
Type” to “Standard UNIX mbox spool or directory”. The wizard should then fill in the
correct location of the mailbox for your account.

The final step is to tell the Evolution mail client how to send mail. Press “Forward”
on the “Receive Mail” screen to move to the “Sending Mail” setup screen. On this
screen change the “Server Type” to SMTP and set the “Host” field to the same
setting used for the myhostname option in the /etc/postfix/main.cf file.

All being well you should now be able to send and receive mail. If you encounter
any problems check the mail log file on your system as described earlier and you
should be able to perform an internet search for the error message to find many
places where the solution is described.

You might also like