Get 50% Discount Offer 7 Days


Contact Info

Chicago 12, Melborne City, USA

+88 01682648101

[email protected]

Recommended Services
Supported Scripts
How to Configure a Mail Server on Linux VPS

It is useful to have a mail server on your system. Setting up a mail server on a Linux system is a useful tool that is used by many users, You can host your email account, also many services send their reports and messages to your email. You can do this with Postfix which is a post-transfer agent for Linux. So follow the instructions here to configure a Mail Server on Linux VPS.

Configure a Mail Server on Linux VPS

Now, you can learn how to do configure the mail server step-by-step on Linux.


Here, you can find some requirements before setting up the mail server:

_ Operating System: Any Linux distro

_ Software: Postfix and Mailx

_ Root access or access via sudo command

Configuring a Mail Server

As mentioned here, to start the mail server, you need to install the Postfix and Mailx server, which are sometimes installed by default. Now, go through the following instructions carefully.


Use your system package manager to install Postfix and Mailx by running the commands below:

1- command to use for Ubuntu, Debian, and Linux mint:

sudo apt install postfix mailutils

2- command to use for Fedora, CentOS, AlmaLinux, and RedHat:

sudo dnf install postfix mailx

3- Command to use for Arch Linux and Manjaro:

sudo pacman -S postfix mailx


During the installation process, you must select the type of email to configure. In this case, you will have two options: ‘Internet site‘ and ‘Local only

If your domain name is fully qualified, you can choose an internet site, otherwise choose the Local mode:

Configuring a Mail Server on linux vps


Here as you see in this image, you can set your fully qualified domain name or local domain name:

Configuring a Mail Server


At this point, you can start and enable the postfix server to start automatically on the next boot:

sudo systemctl start postfix
sudo systemctl enable postfix

Step 5)

Here, you can add your user and any other users who need to use mail service to the mail group:

sudo usermod -aG mail $(whoami)

Test your Mail Server

Now, you can test your mail server by sending an email to a root user account:

$ mail root
Subject: Testing email
This is an email from

Then, press Ctrl+D to send an email, then you can return to your terminal prompt.

In this section, you can use the command below to check the root inbox and see that you have received the test email:

$ sudo mail
"/var/mail/root": 1 message 1 new
>N 1 Sun Mar 12 00:54 15/489 Testing email

In this example, N means new email and 1 shows the ID of the massage. As you see, [email protected] (username@hostname) is the sender. Also delivery time and the subject. If you want to check your local mail, you can type massage ID and hit enter to confirm.


This article thought you how to configure a mail server on a Linux system. This server is important and useful cause, it allows you to control your email service privately and receive system alerts from various services.


What is Postfix?

It is an open-source mail transfer agent which routes and delivers mail.

Rate this post
Share this Post

Leave a Reply

Your email address will not be published. Required fields are marked *