{"id":7860,"date":"2024-02-23T17:37:32","date_gmt":"2024-02-23T17:37:32","guid":{"rendered":"https:\/\/www.webhi.com\/how-to\/?p=7860"},"modified":"2024-10-14T13:59:13","modified_gmt":"2024-10-14T13:59:13","slug":"install-mail-server-ubuntu-debian-linux","status":"publish","type":"post","link":"https:\/\/www.webhi.com\/how-to\/install-mail-server-ubuntu-debian-linux\/","title":{"rendered":"How to setup a Mail server on Ubuntu"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/02\/mail_ubuntu_en.jpg\" alt=\"setup and deploying a full-featured mail server on Ubuntu 20.04\/22.04 using Postfix, Dovecot, MySQL, and OpenDMARC.\" class=\"wp-image-7873\" srcset=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/02\/mail_ubuntu_en.jpg 1200w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/02\/mail_ubuntu_en-300x169.jpg 300w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/02\/mail_ubuntu_en-1024x576.jpg 1024w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/02\/mail_ubuntu_en-768x432.jpg 768w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/02\/mail_ubuntu_en-150x84.jpg 150w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure>\n\n\n\n<p>A mail server allows you to send and receive email. Setting up your own mail server on Ubuntu gives you more control over your email and increases privacy and security. However, managing your own mail server requires a bit more technical knowledge.<\/p>\n\n\n\n<p>This comprehensive guide will walk you through all the steps to create a fully-functioning mail server on Ubuntu 20.04\/22.04 from start to finish.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"prerequisites\">Prerequisites<\/h2>\n\n\n\n<p>Before getting started, you&#8217;ll need the following:<\/p>\n\n\n\n<ul>\n<li>A Ubuntu 20.04\/22.04 server with a static public IP address. Using a VPS is recommended.<\/li>\n\n\n\n<li>A registered domain name. This will be used to send and receive emails from your mail server.<\/li>\n\n\n\n<li>Administrative access to your Ubuntu server.<\/li>\n\n\n\n<li>Basic knowledge of the Linux command line.<\/li>\n<\/ul>\n\n\n\n<p>We&#8217;ll be using Postfix for the SMTP server, Dovecot for IMAP\/POP3, and OpenDMARC for email authentication. A MySQL database will also be configured to store information like virtual domains and users.<\/p>\n\n\n\n<p>Let&#8217;s start by updating the package repository and installing some dependencies on our Ubuntu server:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo apt update\n$ sudo apt install postfix postfix-mysql dovecot-imapd dovecot-pop3d mariadb-server openssl openssl-blacklist<\/code><\/pre>\n\n\n\n<p>Next, we&#8217;ll go through the steps to configure each component.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"configuring-postfix\">Configuring Postfix<\/h2>\n\n\n\n<p>Postfix handles the SMTP service for sending and receiving emails. We need to update some settings in the main Postfix configuration file.<\/p>\n\n\n\n<p>Open the file with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo nano \/etc\/postfix\/main.cf<\/code><\/pre>\n\n\n\n<p>Find the&nbsp;<code>myhostname<\/code>&nbsp;parameter and set it to your registered domain name:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"apacheconf\" class=\"language-apacheconf\">myhostname = mail.example.com<\/code><\/pre>\n\n\n\n<p>Next, find the&nbsp;<code>mydomain<\/code>&nbsp;parameter and set it to your domain:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"apacheconf\" class=\"language-apacheconf\">mydomain = example.com<\/code><\/pre>\n\n\n\n<p>Set the&nbsp;<code>myorigin<\/code>&nbsp;parameter to&nbsp;<code>$mydomain<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"apacheconf\" class=\"language-apacheconf\">myorigin = $mydomain<\/code><\/pre>\n\n\n\n<p>Under the&nbsp;<code>INTERNET_PROTOCOLS<\/code>&nbsp;section, make sure&nbsp;<code>ipv4<\/code>&nbsp;is enabled:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"apacheconf\" class=\"language-apacheconf\">inet_interfaces = all\ninet_protocols = all<\/code><\/pre>\n\n\n\n<p>This allows Postfix to listen on all available IPv4 network interfaces.<\/p>\n\n\n\n<p>Now find the&nbsp;<code>mydestination<\/code>&nbsp;parameter and set it to the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"apacheconf\" class=\"language-apacheconf\">mydestination = $myhostname, localhost.$mydomain, $mydomain<\/code><\/pre>\n\n\n\n<p>This specifies the domains that Postfix will deliver mail to locally.<\/p>\n\n\n\n<p>Save and close the file when you are done editing.<\/p>\n\n\n\n<p>Next, we need to set up SMTP authentication. Generate a password file for Postfix with the&nbsp;<code>postmap<\/code>&nbsp;command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo postmap \/etc\/postfix\/sasl_passwd<\/code><\/pre>\n\n\n\n<p>Create the user and password file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo nano \/etc\/postfix\/sasl_passwd<\/code><\/pre>\n\n\n\n<p>Add your email and password on separate lines:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"apacheconf\" class=\"language-apacheconf\">mail.example.com username@example.com\nmail.example.com password123<\/code><\/pre>\n\n\n\n<p>Save and close the file.<\/p>\n\n\n\n<p>Now edit the Postfix SASL configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo nano \/etc\/postfix\/sasl\/smtpd.conf<\/code><\/pre>\n\n\n\n<p>Make sure it has the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"apacheconf\" class=\"language-apacheconf\">pwcheck_method: saslauthd\nmech_list: plain login<\/code><\/pre>\n\n\n\n<p>This sets Postfix to use the&nbsp;<code>saslauthd<\/code>&nbsp;service for authentication.<\/p>\n\n\n\n<p>Restart Postfix to load the new configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo systemctl restart postfix<\/code><\/pre>\n\n\n\n<p>Postfix is now configured and ready for sending and receiving emails.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"configuring-dovecot\">Configuring Dovecot<\/h2>\n\n\n\n<p>Dovecot will be used to handle IMAP and POP3 protocols for accessing emails from mail clients like Outlook or Thunderbird.<\/p>\n\n\n\n<p>Open the Dovecot configuration file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo nano \/etc\/dovecot\/dovecot.conf<\/code><\/pre>\n\n\n\n<p>Find the protocols section and enable imap and pop3:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"apacheconf\" class=\"language-apacheconf\">protocols = imap pop3<\/code><\/pre>\n\n\n\n<p>Enable SMTP authentication:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"apacheconf\" class=\"language-apacheconf\">disable_plaintext_auth = yes<\/code><\/pre>\n\n\n\n<p>Set the mail location:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"apacheconf\" class=\"language-apacheconf\">mail_location = maildir:\/var\/mail\/%d\/%n<\/code><\/pre>\n\n\n\n<p>Now open the SMTP authentication config file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo nano \/etc\/dovecot\/conf.d\/10-auth.conf<\/code><\/pre>\n\n\n\n<p>Find the&nbsp;<code>auth_mechanisms<\/code>&nbsp;parameter and set it to:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"apacheconf\" class=\"language-apacheconf\">auth_mechanisms = plain login<\/code><\/pre>\n\n\n\n<p>This allows plain text and login authentication similar to Postfix.<\/p>\n\n\n\n<p>Finally, open the permissions file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo nano \/etc\/dovecot\/conf.d\/10-mail.conf<\/code><\/pre>\n\n\n\n<p>And set:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"apacheconf\" class=\"language-apacheconf\">mail_access_groups = mail<\/code><\/pre>\n\n\n\n<p>This allows members of the&nbsp;<code>mail<\/code>&nbsp;group to access mailboxes.<\/p>\n\n\n\n<p>Save and restart Dovecot:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo systemctl restart dovecot<\/code><\/pre>\n\n\n\n<p>Dovecot is now ready to handle IMAP and POP3 mail access.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"mysql-database-setup\">MySQL Database Setup<\/h2>\n\n\n\n<p>Next, we&#8217;ll set up a MySQL database to store virtual domains and users for our mail server.<\/p>\n\n\n\n<p>Log into the MySQL shell:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo mysql<\/code><\/pre>\n\n\n\n<p>Create a database called&nbsp;<code>mailserver<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"sql\" class=\"language-sql\">CREATE DATABASE mailserver;<\/code><\/pre>\n\n\n\n<p>Create a new user and grant permissions on the database:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"sql\" class=\"language-sql\">GRANT SELECT,INSERT,UPDATE,DELETE ON mailserver.* TO 'mailuser'@'127.0.0.1' IDENTIFIED BY 'password123';<\/code><\/pre>\n\n\n\n<p>Exit MySQL:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"sql\" class=\"language-sql\">quit<\/code><\/pre>\n\n\n\n<p>Now we can import the Postfix configuration SQL file to create the necessary tables:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo mysql mailserver &lt; \/etc\/postfix\/mysql\/postfix_db.sql<\/code><\/pre>\n\n\n\n<p>The MySQL database is now ready to store domain and user information for our mail server.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"virtual-domains-and-users\">Virtual Domains and Users<\/h2>\n\n\n\n<p>With the database configured, we can create virtual domains and users.<\/p>\n\n\n\n<p>A virtual domain allows you to host multiple domains from a single mail server.<\/p>\n\n\n\n<p>First, open the Postfix virtual domain configuration file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo nano \/etc\/postfix\/mysql-virtual_domains.cf<\/code><\/pre>\n\n\n\n<p>Uncomment the config_directory parameter and set it to our MySQL config:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"apacheconf\" class=\"language-apacheconf\">config_directory = \/etc\/postfix\/mysql<\/code><\/pre>\n\n\n\n<p>Now let&#8217;s create a virtual domain entry in the database. Log into MySQL:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo mysql mailserver -p<\/code><\/pre>\n\n\n\n<p>Insert a row for the domain:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"sql\" class=\"language-sql\">INSERT INTO `virtual_domains` (`id` ,`name`) VALUES ('1', 'example.com');<\/code><\/pre>\n\n\n\n<p>Exit MySQL.<\/p>\n\n\n\n<p>Next, open the virtual users file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo nano \/etc\/postfix\/mysql-virtual_mailboxes.cf<\/code><\/pre>\n\n\n\n<p>Set the&nbsp;<code>config_directory<\/code>&nbsp;like before:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"apacheconf\" class=\"language-apacheconf\">config_directory = \/etc\/postfix\/mysql<\/code><\/pre>\n\n\n\n<p>This allows Postfix to lookup users in MySQL.<\/p>\n\n\n\n<p>Enter MySQL again:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo mysql mailserver -p <\/code><\/pre>\n\n\n\n<p>Create a sample user:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"sql\" class=\"language-sql\">INSERT INTO `virtual_users` (`id`, `domain_id`, `password` , `email`) VALUES ('1', '1', ENCRYPT('password123', CONCAT('$6$', SUBSTRING(SHA(RAND()), -16))), 'username@example.com');<\/code><\/pre>\n\n\n\n<p>This creates a user &#8220;username@example.com&#8221; with an encrypted password.<\/p>\n\n\n\n<p>Now we need to allow the user to access mailboxes. Insert a row into&nbsp;<code>virtual_aliases<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"sql\" class=\"language-sql\">INSERT INTO `virtual_aliases` (`id`, `domain_id`, `source`, `destination`) VALUES ('1', '1', 'username@example.com', 'username@example.com');<\/code><\/pre>\n\n\n\n<p>Exit MySQL and restart Postfix for the changes to take effect:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo systemctl restart postfix<\/code><\/pre>\n\n\n\n<p>We can create more domains and users in the same way.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"opendmarc\">OpenDMARC<\/h2>\n\n\n\n<p>OpenDMARC implements the DMARC email authentication standard. This helps improve security and prevent spam and phishing.<\/p>\n\n\n\n<p>First, install OpenDMARC:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo apt install opendmarc opendmarc-tools<\/code><\/pre>\n\n\n\n<p>Open the main config file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo nano \/etc\/opendmarc.conf<\/code><\/pre>\n\n\n\n<p>Set your domain:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"apacheconf\" class=\"language-apacheconf\">AuthservID mail.example.com<\/code><\/pre>\n\n\n\n<p>Enable logging and reporting:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"apacheconf\" class=\"language-apacheconf\">Socket inet:8893@localhost \nLogLevel debug\nSyslog true\n\nRejectFailures false\nReportFailures true\n\nHistoryFile \/var\/lib\/opendmarc\/opendmarc.dat\nStatsSocket \/var\/run\/opendmarc\/opendmarc.sock\n\nMinServers 3  \nServerInterval 60<\/code><\/pre>\n\n\n\n<p>This logs activity to syslog and enables daily report emails.<\/p>\n\n\n\n<p>Add your domain as the From address:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">\/etc\/opendmarc\/ignore.hosts\nmail.example.com<\/code><\/pre>\n\n\n\n<p>Now enable OpenDMARC:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo systemctl enable opendmarc\n$ sudo systemctl start opendmarc<\/code><\/pre>\n\n\n\n<p>Finally, generate the DMARC TXT record for your domain:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo opendmarc-gen-policy --domain example.com --policy none --report email:postmaster@example.com<\/code><\/pre>\n\n\n\n<p>Take this TXT record and add it to your domain&#8217;s DNS configuration.<\/p>\n\n\n\n<p>OpenDMARC is now active and will validate incoming emails.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"testing-the-mail-server\">Testing the Mail Server<\/h2>\n\n\n\n<p>Our Ubuntu mail server should now be properly configured. Let&#8217;s do some testing to validate that it works.<\/p>\n\n\n\n<p>First, send a test email from the server itself with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ echo \"This is a test\" | mail -s Testing username@example.com<\/code><\/pre>\n\n\n\n<p>Check if the mail was delivered:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo ls -l \/var\/mail<\/code><\/pre>\n\n\n\n<p>You should see a file named after the user you sent it to if delivery was successful.<\/p>\n\n\n\n<p>Next, configure an email client like Thunderbird to connect to the mail server. Add a new account using the IMAP and SMTP credentials you configured.<\/p>\n\n\n\n<p>Send a test message to the email address on your domain. It should be delivered to the user&#8217;s inbox folder on the Ubuntu server.<\/p>\n\n\n\n<p>You can also use Telnet to manually connect to Postfix SMTP and send a message:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ telnet mail.example.com 25<\/code><\/pre>\n\n\n\n<p>Type&nbsp;<code>EHLO<\/code>, then&nbsp;<code>MAIL FROM:<\/code>,&nbsp;<code>RCPT TO:<\/code>&nbsp;and finally the test message data. This validates that SMTP sending and delivery are working properly.<\/p>\n\n\n\n<p>Check \/var\/log\/mail.log and \/var\/log\/syslog for any errors with Postfix, Dovecot, MySQL or OpenDMARC during testing. Debug and resolve any issues that come up.<\/p>\n\n\n\n<p>When everything is working as expected, your Ubuntu mail server is ready for use!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"securing-the-mail-server\">Securing the Mail Server<\/h2>\n\n\n\n<p>Now that we have a functioning mail server, let&#8217;s talk about some best practices for securing it:<\/p>\n\n\n\n<ul>\n<li>Use HTTPS\/SSL for services whenever possible to encrypt traffic. Obtain SSL certificates for your domain.<\/li>\n\n\n\n<li>Restrict access to mail services by IP address using Postfix&nbsp;<code>mynetworks<\/code>&nbsp;or TCP Wrappers hosts allow list.<\/li>\n\n\n\n<li>Enable firewall rules only allowing traffic on port 25 (SMTP), 143 (IMAP), 993 (IMAP+TLS) and 110 (POP3).<\/li>\n\n\n\n<li>Disable password authentication in SSH and use key-based login only.<\/li>\n\n\n\n<li>Make sure your system packages are always up to date by enabling automatic security updates.<\/li>\n\n\n\n<li>Monitor server logs regularly for signs of attacks or unauthorized access attempts.<\/li>\n\n\n\n<li>Setup logrotate to archive and compress logs.<\/li>\n\n\n\n<li>Disable any unnecessary services not being used.<\/li>\n\n\n\n<li>Create lower privilege system users for services like Dovecot and Postfix.<\/li>\n\n\n\n<li>Use strong passwords and enable two-factor authentication where possible.<\/li>\n\n\n\n<li>Backup your mail data and MySQL databases regularly.<\/li>\n<\/ul>\n\n\n\n<p>Following security best practices will help protect your mail server and users&#8217; private information. The key things are restricting access, staying up to date, monitoring activity, backing up data, and using encryption.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h2>\n\n\n\n<p>That concludes this step-by-step guide on deploying a mail server on Ubuntu 20.04. We installed and configured Postfix, Dovecot, MySQL, and OpenDMARC. We also covered important security measures to protect the mail server.<\/p>\n\n\n\n<p>With your own Ubuntu mail server, you can fully control your email while improving privacy, security and deliverability. Users can access mail over IMAP and SMTP using any standard email client.<\/p>\n\n\n\n<p>Running a mail server takes more hands-on maintenance compared to using a hosted email provider. But the benefits of having your own private server often outweigh the extra effort.<\/p>\n\n\n\n<p>Let me know if you have any other questions! I&#8217;m happy to provide more details on any part of the mail server setup process.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A mail server allows you to send and receive email. Setting up your own mail server on Ubuntu gives you more control over your email and increases privacy and security. However, managing your own mail server requires a bit more technical knowledge. This comprehensive guide will walk you through all the steps to create a ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/www.webhi.com\/how-to\/install-mail-server-ubuntu-debian-linux\/\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[69,277],"tags":[],"yoast_head":"\n<title>How to setup a Mail server on Ubuntu - WebHi Tutorials &amp; Documentations<\/title>\n<meta name=\"description\" content=\"Step-by-step guide to deploying a full-featured mail server on Ubuntu 20.04\/22.04 using Postfix, Dovecot, MySQL, and OpenDMARC. Learn to install, configure, and secure your own private mail server.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webhi.com\/how-to\/install-mail-server-ubuntu-debian-linux\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to setup a Mail server on Ubuntu - WebHi Tutorials &amp; Documentations\" \/>\n<meta property=\"og:description\" content=\"Step-by-step guide to deploying a full-featured mail server on Ubuntu 20.04\/22.04 using Postfix, Dovecot, MySQL, and OpenDMARC. Learn to install, configure, and secure your own private mail server.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webhi.com\/how-to\/install-mail-server-ubuntu-debian-linux\/\" \/>\n<meta property=\"og:site_name\" content=\"WebHi Tutorials &amp; Documentations\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webhi.technology\" \/>\n<meta property=\"article:published_time\" content=\"2024-02-23T17:37:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-10-14T13:59:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/02\/mail_ubuntu_en.jpg\" \/>\n<meta name=\"author\" content=\"webhi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@WebHiTechnology\" \/>\n<meta name=\"twitter:site\" content=\"@WebHiTechnology\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"webhi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"TechArticle\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/install-mail-server-ubuntu-debian-linux\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/install-mail-server-ubuntu-debian-linux\/\"},\"author\":{\"name\":\"webhi\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54\"},\"headline\":\"How to setup a Mail server on Ubuntu\",\"datePublished\":\"2024-02-23T17:37:32+00:00\",\"dateModified\":\"2024-10-14T13:59:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/install-mail-server-ubuntu-debian-linux\/\"},\"wordCount\":1256,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\"},\"articleSection\":[\"Linux system administration\",\"Mail Servers\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webhi.com\/how-to\/install-mail-server-ubuntu-debian-linux\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/install-mail-server-ubuntu-debian-linux\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/install-mail-server-ubuntu-debian-linux\/\",\"name\":\"How to setup a Mail server on Ubuntu - WebHi Tutorials &amp; Documentations\",\"isPartOf\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#website\"},\"datePublished\":\"2024-02-23T17:37:32+00:00\",\"dateModified\":\"2024-10-14T13:59:13+00:00\",\"description\":\"Step-by-step guide to deploying a full-featured mail server on Ubuntu 20.04\/22.04 using Postfix, Dovecot, MySQL, and OpenDMARC. Learn to install, configure, and secure your own private mail server.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/install-mail-server-ubuntu-debian-linux\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webhi.com\/how-to\/install-mail-server-ubuntu-debian-linux\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/install-mail-server-ubuntu-debian-linux\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webhi.com\/how-to\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to setup a Mail server on Ubuntu\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#website\",\"url\":\"https:\/\/www.webhi.com\/how-to\/\",\"name\":\"WebHi Tutorials &amp; Documentations\",\"description\":\"System administration and knowledge base\",\"publisher\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webhi.com\/how-to\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\",\"name\":\"WebHi Technology\",\"url\":\"https:\/\/www.webhi.com\/how-to\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png\",\"contentUrl\":\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png\",\"width\":288,\"height\":95,\"caption\":\"WebHi Technology\"},\"image\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webhi.technology\",\"https:\/\/twitter.com\/WebHiTechnology\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54\",\"name\":\"webhi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1784239260\",\"contentUrl\":\"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1784239260\",\"caption\":\"webhi\"},\"sameAs\":[\"https:\/\/www.webhi.com\/how-to\"],\"url\":\"https:\/\/www.webhi.com\/how-to\/author\/webhi\/\"}]}<\/script>\n","yoast_head_json":{"title":"How to setup a Mail server on Ubuntu - WebHi Tutorials &amp; Documentations","description":"Step-by-step guide to deploying a full-featured mail server on Ubuntu 20.04\/22.04 using Postfix, Dovecot, MySQL, and OpenDMARC. Learn to install, configure, and secure your own private mail server.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webhi.com\/how-to\/install-mail-server-ubuntu-debian-linux\/","og_locale":"en_US","og_type":"article","og_title":"How to setup a Mail server on Ubuntu - WebHi Tutorials &amp; Documentations","og_description":"Step-by-step guide to deploying a full-featured mail server on Ubuntu 20.04\/22.04 using Postfix, Dovecot, MySQL, and OpenDMARC. Learn to install, configure, and secure your own private mail server.","og_url":"https:\/\/www.webhi.com\/how-to\/install-mail-server-ubuntu-debian-linux\/","og_site_name":"WebHi Tutorials &amp; Documentations","article_publisher":"https:\/\/www.facebook.com\/webhi.technology","article_published_time":"2024-02-23T17:37:32+00:00","article_modified_time":"2024-10-14T13:59:13+00:00","og_image":[{"url":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/02\/mail_ubuntu_en.jpg"}],"author":"webhi","twitter_card":"summary_large_image","twitter_creator":"@WebHiTechnology","twitter_site":"@WebHiTechnology","twitter_misc":{"Written by":"webhi","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/www.webhi.com\/how-to\/install-mail-server-ubuntu-debian-linux\/#article","isPartOf":{"@id":"https:\/\/www.webhi.com\/how-to\/install-mail-server-ubuntu-debian-linux\/"},"author":{"name":"webhi","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54"},"headline":"How to setup a Mail server on Ubuntu","datePublished":"2024-02-23T17:37:32+00:00","dateModified":"2024-10-14T13:59:13+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webhi.com\/how-to\/install-mail-server-ubuntu-debian-linux\/"},"wordCount":1256,"commentCount":0,"publisher":{"@id":"https:\/\/www.webhi.com\/how-to\/#organization"},"articleSection":["Linux system administration","Mail Servers"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webhi.com\/how-to\/install-mail-server-ubuntu-debian-linux\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webhi.com\/how-to\/install-mail-server-ubuntu-debian-linux\/","url":"https:\/\/www.webhi.com\/how-to\/install-mail-server-ubuntu-debian-linux\/","name":"How to setup a Mail server on Ubuntu - WebHi Tutorials &amp; Documentations","isPartOf":{"@id":"https:\/\/www.webhi.com\/how-to\/#website"},"datePublished":"2024-02-23T17:37:32+00:00","dateModified":"2024-10-14T13:59:13+00:00","description":"Step-by-step guide to deploying a full-featured mail server on Ubuntu 20.04\/22.04 using Postfix, Dovecot, MySQL, and OpenDMARC. Learn to install, configure, and secure your own private mail server.","breadcrumb":{"@id":"https:\/\/www.webhi.com\/how-to\/install-mail-server-ubuntu-debian-linux\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webhi.com\/how-to\/install-mail-server-ubuntu-debian-linux\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.webhi.com\/how-to\/install-mail-server-ubuntu-debian-linux\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webhi.com\/how-to\/"},{"@type":"ListItem","position":2,"name":"How to setup a Mail server on Ubuntu"}]},{"@type":"WebSite","@id":"https:\/\/www.webhi.com\/how-to\/#website","url":"https:\/\/www.webhi.com\/how-to\/","name":"WebHi Tutorials &amp; Documentations","description":"System administration and knowledge base","publisher":{"@id":"https:\/\/www.webhi.com\/how-to\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webhi.com\/how-to\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webhi.com\/how-to\/#organization","name":"WebHi Technology","url":"https:\/\/www.webhi.com\/how-to\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/","url":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png","contentUrl":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png","width":288,"height":95,"caption":"WebHi Technology"},"image":{"@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webhi.technology","https:\/\/twitter.com\/WebHiTechnology"]},{"@type":"Person","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54","name":"webhi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/image\/","url":"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1784239260","contentUrl":"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1784239260","caption":"webhi"},"sameAs":["https:\/\/www.webhi.com\/how-to"],"url":"https:\/\/www.webhi.com\/how-to\/author\/webhi\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/7860"}],"collection":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/comments?post=7860"}],"version-history":[{"count":6,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/7860\/revisions"}],"predecessor-version":[{"id":9446,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/7860\/revisions\/9446"}],"wp:attachment":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/media?parent=7860"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/categories?post=7860"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/tags?post=7860"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}