Data Management

Administer Postfix with this web-based tool

Learn how to install Postfixadmin, a handy web-based tool that makes administering your Postfix mail much easier.

The open source Postfix mail server is a breeze to get up and running, though aspects of it could be much easier to manage with a GUI. Fortunately, there are GUI tools available, and the most intriguing one is Postfixadmin.

Postfixadmin is a web-based admin tool used to manage mailboxes, virtual domains, and aliases; you will also find support for vacation/out-of-the-office messages. The UI is easy to use, and the installation is fairly straight-forward. Let's get this tool installed so you can enjoy an easier method of managing your Postfix mail server.

Requirements

  • Postfix 2.0 or higher
  • Apache 1.3.27 / Lighttpd 1.3.15 or higher
  • PHP 5.1.2 or higher
  • MySQL 3.23 or higher (5.x recommended) or PostgreSQL 7.4 or higher

Installation

Step 1: Download and unpack the source

Go to the Postfixadmin SourceForge page and download the latest release of the software. Once you have that file on your server, move the file to the document root of your web server. With the source in the document root, unpack the file using a command similar to sudo tar xvzf postfixadmin-XXX.tar.gz (XXX is the release number). After this file is unpacked, it will create a new directory named postfixadmin-XXX (XXX is the release number) that you should rename to postfixadmin with a command like sudo mv postfixadmin-XXX postfixadmin (XXX is the release number).

Step 2: Create the database

Postfixadmin requires a database. I will demonstrate how to set this up with a MySQL database. You can either create the database using a tool like MySQL Workbench or from the command line. If you opt for the command line, here are the commands you will need to create the database (aptly named "postfix"):

CREATE DATABASE postfix;
CREATE USER 'USER'@'localhost' IDENTIFIED BY 'PASSWORD';
GRANT ALL PRIVILEGES ON `postfix` . * TO 'USER'@'localhost';

All entries above in bold are user specific, and the USER must have full access to the MySQL database (which may be root).

If you'll be using a different database, check the Postfixadmin documentation for specific information on your database of choice.

Step 3: Configure Postfixadmin so it can see the database

In the file /var/www/postfixadmin/config.inc.php, you will find the following entries that must be configured:
$CONF['configured'] = ' ';

$CONF['setup_password'] = ' ';

$CONF['postfix_admin_url'] = ' ' ;

$CONF['database_type'] = ' ';
$CONF['database_host'] = ' ';
$CONF['database_user'] = ' ';
$CONF['database_password'] = ' ';
$CONF['database_name'] = ' ';
The only entry that isn't obvious is the setup password -- it must be a hashed password. You can get a hashed password from the web-based installation, but for now, fill in the above (with no setup password) and save the file.

Step 4: Fire up the web-based installation tool

Open your web browser and go to http://ADDRESS_TO_SERVER/postfixadmin/setup.php (where ADDRESS_TO_SERVER is the actual IP address or domain of the server hosting Postfixadmin). On this page, enter a setup password in the Setup Password field and fill out the remaining information (Figure A). Figure A

Click the image to enlarge.

Now, click the Add Admin button, and the hashed password will appear above the Create Superadmin line. Copy that hashed password, go back to the setup.inc.php, and copy it into the setup_password field. Resave the file and go back to the web browser, re-enter your information (if necessary), and click Add Admin. The information will save, and the installation will complete (after some time).

Step 5: Log in to the system

Point your browser to http://ADDRESS_TO_SERVER/postfixadmin, and you will be prompted to log in with the admin user you created earlier (email address/password - not the setup password). After a successful authentication, you will see the Postfixadmin home screen (Figure B). Figure B

Click the image to enlarge.

Now you can start administering your Postfix mail server with a handy web-based GUI that can be reached from any web browser. You'll be surprised at just how much you can manage with this tool and how easy it makes the administration of Postfix.

About

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website getjackd.net.

2 comments
Bapster
Bapster

GRANT ALL PRIVILEGES ON `postfix` . * TO 'USER'@'localhost'; I removed the tick marks from the database name and my error was resolved. GRANT ALL PRIVILEGES ON postfix. * TO 'USER'@'localhost'; ======================================================== Although, I am still getting an error when running the setup.php: Everything seems fine... attempting to create/update database structure Updating database: - old version: 654; target version: 740 updating to version 655 (all databases)... DEBUG INFORMATION: Invalid query: Duplicate key name 'domain'

Bapster
Bapster

The following MYSQL command gives me an error: GRANT ALL PRIVILEGES ON `postfix` . * TO 'USER'@'localhost'; ==================================================== for user I am entering POSTFIX, as this is the user I created in the previous MySql command. Here is my setup.php results ======================= Everything seems fine... attempting to create/update database structure Updating database: - old version: 654; target version: 740 updating to version 655 (all databases)... DEBUG INFORMATION: Invalid query: Duplicate key name 'domain'

Editor's Picks