# Postfix Admin Installation Guide Originally by Mischa Peters . Copyright (c) 2002 - 2005 High5! Licensed under GPL for more info check LICENSE.TXT # Requirements - Postfix - Apache / Lighttpd - PHP 8.2 or greater (for web server) - one of the following databases: - MariaDB/MySQL - PostgreSQL - SQLite # READ THIS FIRST! When this is an upgrade from a previous version of Postfix Admin, please read DOCUMENTS/UPGRADE.TXT also! If you need to setup Postfix to be able to handle Virtual Domains and Virtual Users check out: - the PostfixAdmin documentation in the DOCUMENTS/ directory - our wiki at https://sourceforge.net/p/postfixadmin/wiki/ There are also lots of HOWTOs around the web. Be warned that many of them (even those listed below) may be outdated or incomplete. Please stick to the PostfixAdmin documentation, and use those HOWTOs only if you need some additional information that is missing in the PostfixAdmin DOCUMENTS/ folder. - https://www.linuxbabe.com/redhat/postfixadmin-create-virtual-mailboxes-centos-mail-server ( Postfix+MySQL+Postfixadmin+Dovecot) # Installation steps ## 1. Unarchive new Postfix Admin (if you installed PostfixAdmin as RPM or DEB package, you can skip this step.) Assuming we are installing Postfixadmin into /srv/postfixadmin, then something like this should work. Please check https://github.com/postfixadmin/postfixadmin/releases to get the latest stable release first (the 4.0.1 version/url below is probably stale) ```shell cd /srv/ wget -O postfixadmin.tgz https://github.com/postfixadmin/postfixadmin/archive/refs/tags/v4.0.1.tar.gz tar -zxvf postfixadmin.tgz mv postfixadmin-4.0.1 postfixadmin ``` Alternatively : ```shell cd /srv git clone https://github.com/postfixadmin/postfixadmin.git cd postfixadmin git checkout postfixadmin-4.0 ``` If you're happy to try out newer functionality and perhaps hit unfixed bugs, you can try the 'master' branch by a `git checkout master` (or don't run the final git checkout in the above). Since PostfixAdmin 4.0, you'll need to run the `install.sh` script to install necessary third party libraries. ```bash /bin/bash install.sh ``` Which will * install the 'composer' tool locally (see https://getcomposer.org, creates: composer.phar) and * download dependent PHP libraries (`composer install`) * create a templates_c directory if one does not exist. ## 2.Setup Web Server Assuming /var/www/html is where your webserver reads from, either create a symlink: `$ ln -s /srv/postfixadmin/public /var/www/html/postfixadmin` or setup an alias in your webserver config. For Apache, use: ```apacheconf Alias /postfixadmin /srv/postfixadmin/public ``` ## 3. Setup a Database With your chosen/preferred database server (i.e. MySQL or PostgreSQL), you need to create a new database. A good name for this could be: postfix The mechanics of creating the database vary depending on which server you are using. Most users will find using phpMyAdmin or phpPgAdmin the easiest route. If you wish to use the command line, you'll need to do something like: For MySQL: ```mysql CREATE DATABASE postfix; CREATE USER 'postfix'@'localhost' IDENTIFIED BY 'choose_a_password'; GRANT ALL PRIVILEGES ON `postfix` . * TO 'postfix'@'localhost'; FLUSH PRIVILEGES; ``` For PostgreSQL: ```postgresql CREATE USER postfix WITH PASSWORD 'whatever'; CREATE DATABASE postfix OWNER postfix ENCODING 'unicode'; ``` For SQLite: ```shell mkdir /srv/postfixadmin/database touch /srv/postfixadmin/database/postfixadmin.db sudo chown -R www-data:www-data /srv/postfixadmin/database ``` (both the directory and the database need to be writeable) ## 4. Configure PostfixAdmin The **/srv/postfixadmin/config.inc.php** file contains all available config options and their default values. While you can edit config.inc.php directly, doing so will make future updates harder and is not recommended. Instead, you should create a **config.local.php** file instead. An example is below. The most important settings are those for your database server, and the hashing mechanism to be used to store passwords in your database. ### Example config.local.php e.g. /srv/postfixadmin/config.local.php : ```PHP