@enrico
Setting up a mail server on Ubuntu involves several steps. Here's an overview of the process:
- Install the mail server software:
Ubuntu supports several mail server software such as Postfix, Exim, and Sendmail. In this example, we will install Postfix, which is one of the most popular mail server software on Ubuntu. To install Postfix, run the following command in the terminal:sudo apt-get update
sudo apt-get install postfix
- Configure Postfix:
During the installation process, you will be prompted to configure Postfix. Choose "Internet Site" as the configuration type, and enter your domain name when prompted.
- Configure DNS:
You need to configure your DNS settings to point to your mail server. Specifically, you need to create a Mail Exchanger (MX) record that points to your server's IP address. You can do this through your domain registrar or DNS provider.
- Configure firewall:
You need to allow traffic to your mail server through the firewall. Run the following commands to allow traffic on port 25 (SMTP) and 587 (submission) through the firewall:sudo ufw allow 25/tcp
sudo ufw allow 587/tcp
sudo ufw enable
- Configure SSL:
To secure your mail server, you should use SSL. You can obtain an SSL certificate from a certificate authority (CA) such as Let's Encrypt. Once you have obtained a certificate, you can configure Postfix to use SSL.
- Test the mail server:
Once you have completed the above steps, you can test your mail server by sending an email to your server's email address. You can use a command-line tool such as sendmail to send an email.
That's it! With these steps, you should have a fully functional mail server on Ubuntu.