diff --git a/README.md b/README.md index 6d2454e..6ae47c2 100644 --- a/README.md +++ b/README.md @@ -4,54 +4,122 @@ [![MailServer](https://img.shields.io/badge/server-postfix-8B1E3F)](#) [![License](https://img.shields.io/badge/License-MIT-green)](./LICENSE) -Automated Bash installer for deploying **Postfix** non-interactively on Ubuntu 24.04 Server — ideal when you just need a working mail server and don’t want a screen full of configuration prompts. The script comes with an optional Mailutils installation flag. +Automated installer for **Postfix** on Ubuntu 24.04. +Zero-click configuration — no interactive screens, no “mail name?” prompts. -This is a **production-focused installer**, not a demo. +This is a **production-ready mail server installer**, not a lab exercise. --- -### Preparing - -Update your package index before running the installer: - -``` -sudo apt update -y -``` - ---- - -### Download the Script - -Clone the repository from your Git server: +## 1. Install ``` git clone https://git.x-files.dk/mail/postfix-ubuntu.git -``` - -``` cd postfix-ubuntu -``` - -### Usage - -Run the script using the `-m` flag to control whether Mailutils will be installed as well (`yes` or `no`). - -``` sudo ./postfixinstall -m ``` -### Example +### Flags -Install Postfix **with** Mailutils: +| Option | Meaning | +|---|---| +| `-m yes` | Install Postfix + Mailutils | +| `-m no` | Install only Postfix | + +Examples: ``` -sudo ./postfixinstall -m yes +sudo ./postfixinstall -m yes # Postfix + Mailutils +sudo ./postfixinstall -m no # Pure Postfix only ``` -Install Postfix **only**: +--- + +## 2. Service Status ``` -sudo ./postfixinstall -m no +systemctl status postfix +systemctl enable postfix +``` + +Send test mail (if Mailutils installed): + +``` +echo "Postfix is alive" | mail -s "Test" root@localhost +``` + +--- + +## 3. Default Configuration + +Main config file: + +``` +/etc/postfix/main.cf +``` + +Common values: + +``` +myhostname = mail.example.com +myorigin = /etc/mailname +mydestination = localhost, $myhostname +relayhost = +inet_interfaces = all +``` + +Reload config: + +``` +sudo systemctl reload postfix +``` + +--- + +## 4. TLS + Certbot Integration (optional) + +Recommended additions: + +``` +smtp_tls_security_level = may +smtp_tls_loglevel = 1 +smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt +``` + +Apply: + +``` +sudo systemctl reload postfix +``` + +--- + +## 5. Useful Commands + +List queue: + +``` +mailq +``` + +Flush queue: + +``` +postfix flush +``` + +Logs: + +``` +journalctl -u postfix -f +``` + +Control service: + +``` +systemctl stop postfix +systemctl start postfix +systemctl reload postfix ``` --- @@ -63,5 +131,6 @@ More guides and documentation can be found on [wiki.x-files.dk](https://wiki.x-f --- ### License - Licensed under the [MIT License](./LICENSE). + +---