On Linux, we like to do everything ourselves. That’s why we offer you this guide to create your own mail server on Ubuntu Linux.
Norton Secure VPN 2023 for up to 5 Devices | |
19,99 $ |
Connect and update your server
Use SSH to connect to your VPS server. You can use PuTTY to make it easier to get started with SSH.
Then type the command apt-get update
Install Bind
Type the command sudo apt install bind9. Bind is needed to configure a DNS server and Postfix.
At this point we must take into account that the IP address of our Ubuntu 18.04 machine is 192.168.250.7, it is necessary to replace it with the IP address where we will perform the installation. For this example, we will use mail.test.com as FQDNS.
Now we need to create a new zone for our example. To do this, create a new file with the zone information.
sudo nano /var/cache/bind/db.test
Then add the following:
Don’t forget to replace the IP address by the one of your server and change the domain to the one you want to use. Press CTRL+O to save the changes and CTRL+X to close the nano editor.
Before activating the newly created zone, it is necessary to check the file configuration.
Type: sudo named-checkzone test.com. /var/cache/bind/db.test
Now add the new zone to the configuration file
sudo nano /etc/bind/named.conf.default-zones
zone “test.com.” {
master type;
file “db.test” ;
} ;
Again, CTRL + O to save the changes and CTRL + X to close it.
Type the command sudo nano /etc/bind/named.conf.options
Now, in the file /etc/bind/named.conf.options you have to remove the comment bars in the redirectors line and include the Google DNS- 8.8.8.8. Delete the // symbols.
Restart Bind by typing sudo systemctl reload bind9 or
sudo systemctl restart bind9
Type the command sudo apt install postfix
Postfix is a mail server coded in C. It is fast, open source and easily accessible.
During the installation, you will need to configure the package. On the first screen, choose the option Internet Site.
Then, for the server name, put test.com.
You need users to send emails to each other.
Type the command: sudo usermod -aG mail $(whoami)
create users add them to the mail group so that they can send and receive mail:
sudo useradd -m -G mail -s /bin/bash/ joe
Next, we need to set a password for the newly created user:
sudo passwd joe
In order to receive an e-mail from the terminal, we will install the mailutils package:
sudo apt install mailutils
Now type the command: mail joe@test.com
This will allow you to send a message to joe, the user you created earlier. After the above command, you will type the subject of the message and its content. Then type CTRL + D to finish.
You can type mail clara@test.com to send a mail to clara. Provided of course that you have created a user with the name of clara.
Read also :
The Windows 11 update error can occur for several reasons, such as corrupted files, connectivity issues, or conflicts with third-party…
The "You don’t currently have permission to access this folder" error often appears when you try to access a folder…
When developing Flutter applications, it's common to encounter errors related to SDK version compatibility. One of these common errors is…
During the installation of Windows, you may encounter an error indicating that the selected disk is not compatible with the…
The error "Windows could not start the Windows Update service on the local computer" occurs when the operating system fails…
The Windows Update Service is essential for keeping your system up to date with the latest security and performance improvements.…