How To Install PostfixAdmin on Debian 12
In this tutorial, we will show you how to install PostfixAdmin on Debian 12. PostfixAdmin is a web-based interface that simplifies the management of Postfix mail servers. It provides a user-friendly platform for administrators to manage email addresses, domains, and aliases.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of PostfixAdmin on a Debian 12 (Bookworm).
Prerequisites
- A server running one of the following operating systems: Debian 12 (Bookworm).
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for PostfixAdmin.
- Has a LAMP (Linux, Apache, MySQL, PHP) stack installed. You will also need a domain name with an MX record pointing to your server’s IP address.
- A user account with sudo privileges to execute administrative commands.
Install PostfixAdmin on Debian 12 Bookworm
Step 1. Ensure that your system is up to date with the latest security patches and software releases by running:
sudo apt update sudo apt upgrade
Step 2. Installing Postfix on Debian 12.
Postfix, a robust Mail Transfer Agent (MTA), facilitates email delivery. Install it using:
sudo apt install postfix
During installation, select “Internet Site” and input your domain name when prompted.
Next, modify /etc/postfix/main.cf
to integrate with Dovecot for SASL authentication:
smtpd_sasl_type = dovecot smtpd_sasl_path = private/auth
Save and close the file, then restart Postfix to apply the changes:
sudo systemctl reload postfix
Step 3. Installing Dovecot.
Dovecot serves as the IMAP/POP3 server. Install it with:
sudo apt install dovecot-core dovecot-imapd dovecot-pop3d
Next, configure Dovecot to communicate with Postfix by editing /etc/dovecot/conf.d/10-master.conf
and adding:
service auth { unix_listener /var/spool/postfix/private/auth { mode = 0660 user = postfix group = postfix } }
Restart Dovecot to apply the new configuration:
sudo systemctl restart dovecot
Step 4. Installing PostfixAdmin on Debian 12.
Fetch the latest PostfixAdmin version from its official repository:
wget https://github.com/postfixadmin/postfixadmin/archive/refs/tags/postfixadmin-3.3.13.tar.gz
Extract and move the contents to a web-accessible directory.
tar xvf postfixadmin-3.3.13.tar.gz sudo mv postfixadmin-3.3.13/ /var/www/html/postfixadmin
Assign the correct permissions to the PostfixAdmin directory:
sudo chown -R www-data:www-data /var/www/html/postfixadmin
Next, create a configuration file, config.local.php
, within the PostfixAdmin directory. Specify your database settings and admin setup password here.
Log into MySQL and create a database and user for PostfixAdmin:
CREATE DATABASE postfixadmin; GRANT ALL PRIVILEGES ON postfixadmin.* TO 'postfixadmin'@'localhost' IDENTIFIED BY 'password'; FLUSH PRIVILEGES;
Then, edit config.local.php
to include your database connection details:
$CONF['database_type'] = 'mysqli'; $CONF['database_user'] = 'postfixadmin'; $CONF['database_password'] = 'password'; $CONF['database_name'] = 'postfixadmin';
Step 5. Configuring Apache for PostfixAdmin.
Create a virtual host file for Apache, enabling access to PostfixAdmin via a web browser. Don’t forget to enable the site and reload Apache.
sudo nano /etc/apache2/sites-available/postfixadmin.conf
Add the following configuration:
<VirtualHost *:80> ServerName mail.example.com DocumentRoot /var/www/html/postfixadmin <Directory /var/www/html/postfixadmin> AllowOverride All </Directory> </VirtualHost>
Enable the site and reload Apache:
sudo a2ensite postfixadmin.conf sudo systemctl reload apache2
Step 6. Accessing the PostfixAdmin Web Setup.
Navigate to http://mail.example.com/setup.php
to initiate the web-based setup. Create the admin account following the on-screen instructions.
Congratulations! You have successfully installed PostfixAdmin. Thanks for using this tutorial for installing the latest version of PostfixAdmin on Debian 12 Bookworm. For additional help or useful information, we recommend you check the official PostfixAdmin website.