You've already forked postfix-ubuntu
165 lines
2.6 KiB
Markdown
165 lines
2.6 KiB
Markdown
|
|
# Postfix for Ubuntu 24.04 Server
|
|||
|
|
[](#)
|
|||
|
|
[](#)
|
|||
|
|
[](#)
|
|||
|
|
[](./LICENSE)
|
|||
|
|
|
|||
|
|
Install Postfix on Ubuntu 24.04 server.
|
|||
|
|
|
|||
|
|
This is not a demo and not an experiment.
|
|||
|
|
No installer prompts, no guesswork — reliable and repeatable mail server deployment.
|
|||
|
|
|
|||
|
|
## Why this installer exists
|
|||
|
|
Postfix itself is simple. The interactive installer is not. This avoids incorrect menu selections.
|
|||
|
|
|
|||
|
|
## What this installer does
|
|||
|
|
✔ Fully non-interactive setup
|
|||
|
|
✔ Optional mailutils integration
|
|||
|
|
✔ Runs as a proper MTA
|
|||
|
|
✔ Suitable for relay + local delivery
|
|||
|
|
✔ Consistent, repeatable configuration
|
|||
|
|
|
|||
|
|
## What this installer does *NOT* do
|
|||
|
|
It won’t stop you from running the script without reading the documentation like there’s no tomorrow.
|
|||
|
|
Skip the README, and whatever happens next is your headache, not a bug report.
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## 1. Prepare the system
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
sudo apt update -y
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## 2. Download the installer
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
git clone https://git.x-files.dk/mail/postfix-ubuntu.git
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
cd postfix-ubuntu
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## 3. Run the installer
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
sudo ./postfixinstall -m <yes|no>
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
### Flags
|
|||
|
|
|
|||
|
|
| Option | Meaning |
|
|||
|
|
|---|---|
|
|||
|
|
| `-m yes` | Install Postfix + Mailutils |
|
|||
|
|
| `-m no` | Install only Postfix |
|
|||
|
|
|
|||
|
|
Examples:
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
sudo ./postfixinstall -m yes # Postfix + Mailutils
|
|||
|
|
sudo ./postfixinstall -m no # Pure Postfix only
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## 2. Service Status
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
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
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
### More Information
|
|||
|
|
|
|||
|
|
More guides and documentation can be found on [wiki.x-files.dk](https://wiki.x-files.dk)
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
### License
|
|||
|
|
Licensed under the [MIT License](./LICENSE).
|
|||
|
|
|
|||
|
|
---
|