Configuring Exim on Linux | Your Installation Guide

Image of technicians setting up Exim on Linux in an IOFLOOD datacenter to enhance email services

When improving our email management on Linux servers at IOFLOOD we have learned that installing Exim provides all the capabilities we require. Exim offers features like SMTP relay control and mail filtering, making it an ideal choice for managing email services efficiently. Today’s article aims to guide our customers through the process of installing Exim on Linux, to improve the email infrastructure on their bare metal hosting.

In this guide, we will navigate the process of installing Exim on your Linux system. We will provide you with installation instructions for Debian and Ubuntu using the APT package manager, and CentOS and AlmaLinux using the YUM package manager. We’ll delve into more advanced topics like compiling Exim from source, and installing a specific version. Finally, we will guide you on how to use the Exim command and verify that the correct version is installed.

Let’s get started with the step-by-step Exim installation on your Linux system!

TL;DR: How Do I Install Exim on Linux?

To install Exim on Linux Debian-based distributions like Ubuntu, you can run the command sudo apt-get install exim4. For RPM-based distributions like CentOS, use the command sudo yum install exim.

# For Debian-based distributions like Ubuntu
sudo apt-get install exim4

# For RPM-based distributions like CentOS
sudo yum install exim

# Output:
# 'Reading package lists... Done'
# 'Building dependency tree... Done'
# 'Reading state information... Done'
# 'The following additional packages will be installed: exim4-base exim4-config exim4-daemon-light'
# 'Suggested packages: eximon4 exim4-doc-html exim4-doc-info spf-tools-perl swaks'
# 'The following NEW packages will be installed: exim4 exim4-base exim4-config exim4-daemon-light'
# '0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.'

This will install Exim on your Linux system. However, this is just the basic installation. There’s much more to learn about installing and using Exim. Continue reading for more detailed information and advanced usage scenarios.

How to Install Exim on Linux

Exim is a Mail Transfer Agent (MTA) that is used by many Linux and Unix systems to manage mail services. It’s responsible for receiving, routing, and delivering email messages. It’s highly flexible and configurable, allowing it to handle a wide range of mail setups. Exim is often used in situations where mail traffic is heavy and requires efficient management.

Now, let’s delve into how to install Exim on Linux.

Installing Exim with APT

If you’re using a Debian-based distribution like Ubuntu, you can install Exim using the APT package manager. Here’s how you can do it:

sudo apt update
sudo apt install exim4 -y

# Output:
# 'Reading package lists... Done'
# 'Building dependency tree... Done'
# 'Reading state information... Done'
# 'The following additional packages will be installed: exim4-base exim4-config exim4-daemon-light'
# 'Suggested packages: eximon4 exim4-doc-html exim4-doc-info spf-tools-perl swaks'
# 'The following NEW packages will be installed: exim4 exim4-base exim4-config exim4-daemon-light'
# '0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.'

The sudo apt update command updates your package lists while sudo apt install exim4 -y installs Exim on your system. The -y option is used to automatically answer ‘yes’ to the prompts and run non-interactively.

Installing Exim with YUM

If you’re using an RPM-based distribution like CentOS, you can install Exim using the YUM package manager. Here’s how:

sudo yum update
sudo yum install exim -y

# Output:
# 'Loaded plugins: fastestmirror, ovl'
# 'Loading mirror speeds from cached hostfile'
# 'Resolving Dependencies'
# '--> Running transaction check'
# '--> Package exim.x86_64 0:4.94-3.el7 will be installed'
# '--> Finished Dependency Resolution'
# 'Dependencies Resolved'
# 'Installed: exim.x86_64 0:4.94-3.el7'
# 'Complete!'

Similar to the APT commands, sudo yum update updates your package lists and sudo yum install exim -y installs Exim on your system.

With Exim installed on your system, you’re now ready to start managing your email services more effectively!

Installing Exim from Source Code

Sometimes, you may need to install Exim from source code. This could be due to the need for a specific version not available in your distribution’s package manager, or because you want to customize the installation. Here’s a general guide on how you can do this:

wget https://ftp.exim.org/pub/exim/exim4/exim-4.94.tar.gz

# Extract the downloaded tar file

tar xvf exim-4.94.tar.gz

# Navigate to the extracted directory

cd exim-4.94

# Compile and install Exim

make
sudo make install

# Output:
# 'make[1]: Entering directory `/home/user/exim-4.94/build-Linux-x86_64'
# '>>> version 4.94 of Exim successfully compiled.'

Installing Different Versions of Exim

Installing Specific Versions from Source

The process of installing a specific version from source is similar to the general installation from source. You just need to replace the version number in the download URL with the version you want. For example, to download version 4.93, use wget https://ftp.exim.org/pub/exim/exim4/exim-4.93.tar.gz.

Installing Specific Versions with APT and YUM

To install a specific version of Exim with APT or YUM, you can specify the version number after the package name, like sudo apt install exim4=4.93 or sudo yum install exim-4.93. However, not all versions may be available in the package repositories.

Version Comparison

Different versions of Exim come with different features, improvements, and bug fixes. Here’s a brief comparison of some recent versions:

VersionKey Features
4.94Improved queue runner performance, New smtp transport option hosts_try_auth
4.93New dnsdb lookup type, Several security fixes
4.92Support for TLSv1.3, New ratelimit ACL condition

Using Exim and Verifying Installation

Basic Exim Usage

Once Exim is installed, you can use the exim command to interact with it. For example, to send a test email, you can use echo "Test email body" | exim [email protected].

Verifying Exim Installation

To verify that Exim is installed correctly, you can use the exim -bV command. This will display the version of Exim that is installed.

exim -bV

# Output:
# 'Exim version 4.94 #3 built 01-Jul-2021 17:14:20'
# 'Copyright (c) University of Cambridge, 1995 - 2018'
# '(c) The Exim Maintainers and contributors in ACKNOWLEDGMENTS file, 2007 - 2018'
# 'Berkeley DB: Berkeley DB 5.3.28: (September  9, 2013)'
# 'Support for: crypteq iconv() IPv6 GnuTLS move_frozen_messages DKIM DNSSEC Event OCSP PRDR SOCKS TCP_Fast_Open'
# 'Lookups (built-in): lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmnz dnsdb dsearch nis nis0 passwd sqlite'
# 'Authenticators: cram_md5 plaintext
# Routers: accept dnslookup ipliteral manualroute queryprogram redirect'
# 'Transports: appendfile/maildir autoreply lmtp pipe smtp'
# 'Fixed never_users: 0'
# 'Size of off_t: 8'
# 'Configuration file is /etc/exim.conf'

The output shows the Exim version, along with other information about the build and configuration. If Exim is installed correctly, you should see a similar output.

Exploring Alternative MTAs

While Exim is a powerful MTA, it’s not the only game in town. Other MTAs like Postfix and Sendmail also offer unique features and advantages. Let’s take a closer look at these alternatives.

Postfix: A Secure and Easy-to-Use MTA

Postfix is a widely used MTA known for its strong focus on security and easy configuration. It was designed to be a secure and faster alternative to Sendmail.

To install Postfix on Debian-based distributions, use this command:

sudo apt-get install postfix

# Output:
# 'Reading package lists... Done'
# 'Building dependency tree... Done'
# 'Reading state information... Done'
# 'The following additional packages will be installed: postfix-sqlite'
# 'Suggested packages: procmail postfix-mysql postfix-pgsql postfix-ldap postfix-pcre sasl2-bin dovecot-common resolvconf postfix-cdb postfix-doc'
# 'The following NEW packages will be installed: postfix postfix-sqlite'
# '0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.'

For RPM-based distributions, use this command:

sudo yum install postfix

# Output:
# 'Loaded plugins: fastestmirror, ovl'
# 'Loading mirror speeds from cached hostfile'
# 'Resolving Dependencies'
# '--> Running transaction check'
# '--> Package postfix.x86_64 2:2.10.1-9.el7 will be installed'
# '--> Finished Dependency Resolution'
# 'Dependencies Resolved'
# 'Installed: postfix.x86_64 2:2.10.1-9.el7'
# 'Complete!'

Sendmail: The Veteran MTA

Sendmail is one of the oldest MTAs and was the de-facto MTA for Unix systems for many years. It’s highly flexible and powerful, but it’s also known for its complex configuration.

To install Sendmail on Debian-based distributions, use this command:

sudo apt-get install sendmail

# Output:
# 'Reading package lists... Done'
# 'Building dependency tree... Done'
# 'Reading state information... Done'
# 'The following additional packages will be installed: sendmail-bin sendmail-cf sensible-mda'
# 'Suggested packages: rmail sendmail-doc'
# 'The following NEW packages will be installed: sendmail sendmail-bin sendmail-cf sensible-mda'
# '0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.'

For RPM-based distributions, use this command:

sudo yum install sendmail

# Output:
# 'Loaded plugins: fastestmirror, ovl'
# 'Loading mirror speeds from cached hostfile'
# 'Resolving Dependencies'
# '--> Running transaction check'
# '--> Package sendmail.x86_64 0:8.14.7-5.el7 will be installed'
# '--> Finished Dependency Resolution'
# 'Dependencies Resolved'
# 'Installed: sendmail.x86_64 0:8.14.7-5.el7'
# 'Complete!'

Comparing Exim, Postfix, and Sendmail

Each of these MTAs has its strengths and weaknesses. Here’s a brief comparison:

MTAAdvantagesDisadvantages
EximHighly flexible, Easy to configure, Excellent documentationNot as fast as Postfix or Sendmail
PostfixHigh performance, Great security features, Easier to configure than SendmailNot as flexible as Exim or Sendmail
SendmailHighly flexible, Supports a wide variety of mail setupsComplex configuration, Slower than Postfix

While Exim is a great MTA, Postfix and Sendmail are viable alternatives depending on your specific needs. It’s always a good idea to explore different options and choose the one that best fits your use case.

Troubleshooting Common Exim Issues

Even with the best preparations, you might encounter problems when installing or using Exim. Here are some common issues and how to solve them.

Exim Not Starting

Sometimes, after installing Exim, it might fail to start. This could be due to several reasons, such as a misconfigured Exim configuration file or conflicts with other MTAs.

If Exim fails to start, you can check its status with the following command:

sudo systemctl status exim

# Output:
# '● exim.service - LSB: exim Mail Transport Agent'
# '   Loaded: loaded (/etc/init.d/exim; bad; vendor preset: enabled)'
# '   Active: failed (Result: exit-code) since Tue 2021-07-20 10:20:38 UTC; 1min 7s ago'
# '     Docs: man:systemd-sysv-generator(8)'
# '  Process: 11640 ExecStart=/etc/init.d/exim start (code=exited, status=1/FAILURE)'

The output will give you more information about the error. You can also check the Exim log files in /var/log/exim/ for more detailed error messages.

Conflicts with Other MTAs

If you have another MTA like Postfix or Sendmail installed, it could conflict with Exim. To avoid this, ensure you stop and disable the other MTA before installing Exim.

For example, to stop and disable Postfix, you can use the following commands:

sudo systemctl stop postfix
sudo systemctl disable postfix

# Output:
# 'Stopped Postfix Mail Transport Agent.'
# 'Removed symlink /etc/systemd/system/multi-user.target.wants/postfix.service.'

Exim Configuration Errors

Exim has a complex configuration file, and a small mistake can cause problems. If you’re encountering issues, check your Exim configuration file for any errors. You can do this with the exim -bV command, which will also show any configuration errors.

exim -bV

# Output:
# 'Exim version 4.94 #3 built 01-Jul-2021 17:14:20'
# 'Copyright (c) University of Cambridge, 1995 - 2018'
# '(c) The Exim Maintainers and contributors in ACKNOWLEDGMENTS file, 2007 - 2018'
# 'Berkeley DB: Berkeley DB 5.3.28: (September  9, 2013)'
# 'Support for: crypteq iconv() IPv6 GnuTLS move_frozen_messages DKIM DNSSEC Event OCSP PRDR SOCKS TCP_Fast_Open'
# 'Lookups (built-in): lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmnz dnsdb dsearch nis nis0 passwd sqlite'
# 'Authenticators: cram_md5 plaintext
# Routers: accept dnslookup ipliteral manualroute queryprogram redirect'
# 'Transports: appendfile/maildir autoreply lmtp pipe smtp'
# 'Fixed never_users: 0'
# 'Size of off_t: 8'
# 'Configuration file is /etc/exim.conf'
# 'Configuration error in line 507: option "local_domains" unknown'

In this example, the output shows there’s an error in line 507 of the configuration file. You can then open the configuration file and fix the error.

Remember, troubleshooting is a normal part of working with any software. Don’t get discouraged if you encounter issues. With a bit of patience and persistence, you can get Exim up and running on your Linux system.

Unraveling the Mystery of MTAs

Before we delve deeper into the world of Exim, it’s crucial to understand what Mail Transfer Agents (MTAs) are and why they play such a vital role in managing emails on a Linux system.

The Role of MTAs in Email Management

An MTA is a software application that receives, sends, and delivers emails. It’s the backbone of any email system. When you send an email, your email client hands it over to the MTA, which then routes it to the recipient’s MTA. If the recipient is on the same system, the MTA also delivers the email to their mailbox.

Here’s a simple example of how an MTA works when you send an email:

# User sends an email

echo "This is the body of the email" | mail -s "This is the subject" [email protected]

# Output:
# 'EOT'

In this example, the mail command is used to send an email. The -s option specifies the subject, and the text after the echo command is the body of the email. Once you run this command, the MTA takes over and sends the email to [email protected].

Why Choosing the Right MTA Matters

Different MTAs offer different features and advantages. Some are easier to configure but offer fewer features, while others are highly flexible but have a steep learning curve. Your choice of MTA can significantly impact how effectively you can manage emails on your Linux system.

For example, if you’re running a small server with light email traffic, a simple MTA like SSMTP might be enough. However, if you’re managing a large server with heavy email traffic, you might need a more powerful MTA like Exim or Postfix.

Choosing the right MTA is about understanding your needs and the features of different MTAs. It’s about finding the right balance between ease of use, flexibility, and power. And that’s why understanding how to install and use Exim is so important.

Using MTAs in System Administration

Understanding MTAs, like Exim, is not just about managing emails on your Linux system. It’s also about understanding the broader implications of MTAs in system administration and security.

MTAs and System Administration

As a system administrator, you’re responsible for ensuring that your server runs smoothly and efficiently. Part of this involves managing the email traffic on your server. A poorly configured MTA can lead to inefficiencies, such as slow email delivery or even lost emails. By understanding how to install and configure an MTA like Exim, you can ensure that your server’s email system runs optimally.

MTAs and Security

Emails are a common attack vector for hackers. A poorly secured MTA can open up your server to all sorts of attacks, from spam to phishing and malware. By understanding how to secure your MTA, you can protect your server and your users from these threats.

For example, you can configure Exim to use encrypted connections, reject emails from known spam sources, and limit the rate of incoming connections to prevent denial-of-service attacks.

Exploring Related Concepts: Email Encryption and Spam Filtering

If you’re interested in delving deeper into the world of MTAs, you might want to explore related concepts like email encryption and spam filtering.

Email encryption ensures that your emails are secure in transit, preventing eavesdroppers from reading your emails. Spam filtering, on the other hand, helps keep your inbox clean by filtering out unwanted emails.

Exim supports both these features. You can configure Exim to use Transport Layer Security (TLS) for email encryption, and you can use Exim’s ACLs (Access Control Lists) for spam filtering.

Further Resources for Mastering Exim and MTAs

Here are some resources that can help you deepen your understanding of Exim and MTAs:

Recap: Exim Mail Manager Install

In this comprehensive guide, we’ve taken a deep dive into the world of Exim, a powerful Mail Transfer Agent (MTA) for Linux systems.

We began with the basics, learning how to install Exim on different Linux distributions using package managers like APT and YUM. We then ventured into more advanced territory, exploring how to compile Exim from source and use its advanced features for efficient email management.

Along the way, we tackled common challenges you might face when using Exim, such as conflicts with other MTAs and configuration errors, providing you with solutions and workarounds for each issue.

We also looked at alternative MTAs like Postfix and Sendmail, giving you a broader perspective on the landscape of MTAs for Linux. Here’s a quick comparison of these MTAs:

MTAAdvantagesDisadvantages
EximHighly flexible, Easy to configure, Excellent documentationNot as fast as Postfix or Sendmail
PostfixHigh performance, Great security features, Easier to configure than SendmailNot as flexible as Exim or Sendmail
SendmailHighly flexible, Supports a wide variety of mail setupsComplex configuration, Slower than Postfix

Whether you’re just starting out with Exim or you’re looking to level up your Linux mail server management skills, we hope this guide has given you a deeper understanding of Exim and its capabilities.

With its balance of flexibility, ease of configuration, and robust documentation, Exim is a powerful tool for managing emails on Linux. Happy mailing!