How To Install postfix on Ubuntu 20.04

In this tutorial we learn how to install postfix on Ubuntu 20.04. postfix is High-performance mail transport agent High-performance mail transport agent

Introduction

In this tutorial we learn how to install postfix on Ubuntu 20.04.

What is postfix

postfix is:

Postfix is Wietse Venema’s mail transport agent that started life as an alternative to the widely-used Sendmail program. Postfix attempts to be fast, easy to administer, and secure, while at the same time being sendmail compatible enough to not upset existing users. Thus, the outside has a sendmail-ish flavor, but the inside is completely different. Task: mail-server

Package: postfix Architecture: amd64 Version: 3.4.10-1ubuntu1 Priority: optional Section: mail Origin: Ubuntu Maintainer: Ubuntu Developers [email protected] Original-Maintainer: LaMont Jones [email protected] Bugs: https://bugs.launchpad.net/ubuntu/+filebug Installed-Size: 4433 Provides: default-mta, mail-transport-agent Depends: libc6 (>= 2.14), libdb5.3, libicu66 (>= 66.1-1~), libsasl2-2 (>= 2.1.27+dfsg), libssl1.1 (>= 1.1.1), debconf (>= 0.5) | debconf-2.0, netbase, adduser (>= 3.48), dpkg (>= 1.8.3), lsb-base (>= 3.0-6), ssl-cert, cpio, e2fsprogs Recommends: python3, ca-certificates Suggests: procmail, postfix-mysql, postfix-pgsql, postfix-ldap, postfix-pcre, postfix-lmdb, postfix-sqlite, sasl2-bin | dovecot-common, libsasl2-modules | dovecot-common, resolvconf, postfix-cdb, mail-reader, ufw, postfix-doc Conflicts: mail-transport-agent, smail Replaces: mail-transport-agent Filename: pool/main/p/postfix/postfix_3.4.10-1ubuntu1_amd64.deb Size: 1197944 MD5sum: 0bcfd08016f1d756a56be377abec7b38 SHA1: c310e97c116df70ce9cbaf00d10743b3a118e941 SHA256: 50ccbd35955890bb412ae9db1b6e0cd08ba462b7c6d2cd3c2f5fdc0f30273acb Homepage: http://www.postfix.org Description-en: High-performance mail transport agent Postfix is Wietse Venema’s mail transport agent that started life as an alternative to the widely-used Sendmail program. Postfix attempts to be fast, easy to administer, and secure, while at the same time being sendmail compatible enough to not upset existing users. Thus, the outside has a sendmail-ish flavor, but the inside is completely different. Task: mail-server

There are three methods to install postfix on Ubuntu 20.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install postfix Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install postfix using apt-get by running the following command:

sudo apt-get -y install postfix

Install postfix Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install postfix using apt by running the following command:

sudo apt -y install postfix

Install postfix Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install postfix using aptitude by running the following command:

sudo aptitude -y install postfix

How To Uninstall postfix on Ubuntu 20.04

To uninstall only the postfix package we can use the following command:

sudo apt-get remove postfix

Uninstall postfix And Its Dependencies

To uninstall postfix and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:

sudo apt-get -y autoremove postfix

Remove postfix Configurations and Data

To remove postfix configuration and data from Ubuntu 20.04 we can use the following command:

sudo apt-get -y purge postfix

Remove postfix configuration, data, and all of its dependencies

We can use the following command to remove postfix configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge postfix

References

Summary

In this tutorial we learn how to install postfix package on Ubuntu 20.04 using different package management tools: apt, apt-get and aptitude.