{"id":48,"date":"2026-02-06T07:35:17","date_gmt":"2026-02-06T07:35:17","guid":{"rendered":"https:\/\/vyos.web.id\/?p=48"},"modified":"2026-02-06T07:36:03","modified_gmt":"2026-02-06T07:36:03","slug":"install-postfix-ubuntu-24-04","status":"publish","type":"post","link":"https:\/\/vyos.web.id\/?p=48","title":{"rendered":"Install Postfix \u2013 Ubuntu 24.04"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\"><\/h3>\n\n\n\n<h3 class=\"wp-block-heading\"> Set hostname (<strong>REQUIRED<\/strong>)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Postfix is very sensitive to the system hostname.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>hostnamectl set-hostname mail.yourdomain.id\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Edit <code>\/etc\/hosts<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nano \/etc\/hosts\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>127.0.1.1   mail.yourdomain.id mail\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Verify:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>hostname\nhostname -f\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The output <strong>must be<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mail.yourdomain.id\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Install Postfix<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>apt update\napt install postfix mailutils -y\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">When the setup wizard appears, choose:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>General type:<\/strong> Internet Site<\/li>\n\n\n\n<li><strong>System mail name:<\/strong> mail.yourdomain.id<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Check Postfix service<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl status postfix\nss -lntp | grep :25\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Postfix must be <strong>listening on port 25<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Basic Postfix hardening<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Edit the configuration file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nano \/etc\/postfix\/main.cf\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Ensure the following settings:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>myhostname = mail.yourdomain.id\nmydomain = yourdomain.id\nmyorigin = $mydomain\n\ninet_interfaces = all\ninet_protocols = ipv4\n\nmydestination = $myhostname, localhost.$mydomain, localhost\nmynetworks = 127.0.0.0\/8, &#91;::1]\n\nhome_mailbox = Maildir\/\n\nsmtpd_banner = $myhostname ESMTP\n\n# Prevent open relay\nsmtpd_recipient_restrictions =\n    permit_mynetworks,\n    permit_sasl_authenticated,\n    reject_unauth_destination\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Restart Postfix:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl restart postfix\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Test local email delivery<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>echo \"Postfix OK\" | mail -s \"Test Email\" root\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Check inbox:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mail\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Test outbound (internet) email<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>echo \"Hello from Ubuntu Postfix\" | mail -s \"Test SMTP\" your@gmail.com\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Monitor the mail log:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">tail -f \/var\/log\/mail.log<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211;have trying..<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Set hostname (REQUIRED) Postfix is very sensitive to the system hostname. Edit \/etc\/hosts: Add: Verify: The output must be: Install Postfix When the setup wizard appears, choose: Check Postfix service Postfix must be listening on port 25. Basic Postfix hardening Edit the configuration file: Ensure the following settings: Restart Postfix: Test local email delivery Check [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-48","post","type-post","status-publish","format-standard","hentry","category-mail-server"],"_links":{"self":[{"href":"https:\/\/vyos.web.id\/index.php?rest_route=\/wp\/v2\/posts\/48","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vyos.web.id\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vyos.web.id\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vyos.web.id\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vyos.web.id\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=48"}],"version-history":[{"count":2,"href":"https:\/\/vyos.web.id\/index.php?rest_route=\/wp\/v2\/posts\/48\/revisions"}],"predecessor-version":[{"id":50,"href":"https:\/\/vyos.web.id\/index.php?rest_route=\/wp\/v2\/posts\/48\/revisions\/50"}],"wp:attachment":[{"href":"https:\/\/vyos.web.id\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=48"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vyos.web.id\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=48"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vyos.web.id\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=48"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}