Saturday, January 23, 2010

How to Install Postfix Admin in RHEL/CentOS 5

SkyHi @ Saturday, January 23, 2010

Postfix Admin is a web based interface used to manage mailboxes, virtual domains and aliases. This article will show you how to install Postfix Admin to simplify management of mailboxes, domains and aliases.

Installing Postfix Admin

yum install
1. Install the Postfix Admin requirements using the command below.
yum install mysql-server php-mysql php-imap
tar postfixadmin
2. Download the latest stable version of Postfix Admin in .tar.gz format here. Assuming you got the file postfixadmin- and it is located on your Desktop, type in the commands below to extract and to put it into its proper directory.
cd /usr/share
tar -xvzf ~/Desktop/postfixadmin-
mv postfixadmin- postfixadmin

NoteThe PostfixAdmin archive has to be extracted directly into the /usr/share directory to enable Linux to apply the proper SELinux Context into the files.

Edit postfixadmin.conf
3. Edit the file /usr/share/postfixadmin/ and update the following lines below.
$CONF['configured'] = true;
$CONF['postfix_admin_url'] = '/postfixadmin';
$CONF['database_type'] = 'mysqli';
$CONF['database_host'] = 'localhost';
$CONF['database_user'] = 'postfix';
$CONF['database_password'] = 'your_password';
$CONF['database_name'] = 'postfix';
$CONF['domain_path'] = 'YES';
$CONF['domain_in_mailbox'] = 'NO';
$CONF['encrypt'] = 'cleartext';
$CONF['emailcheck_resolve_domain] = 'NO';

Creating the Postfix Admin Database

Service Configuration
1. Start the mysqld service. Learn how to start and stop services here.
Create Postfix Admin db
2. Launch the MySQL command line tool using the command below.
mysql -u root -p
The default root password of MySQL is a blank password. Next, create a new MySQL database for Postfix Admin using the commands below.
mysql> CREATE DATABASE postfix;
mysql> CREATE USER postfix@localhost IDENTIFIED BY 'your_password';
mysql> GRANT ALL PRIVILEGES ON postfix.* TO postfix;

Configuring the Postfix Admin Web Application

Edit postfixadmin.conf
1. Create the file /etc/httpd/conf.d/postfixadmin.conf containing the line below.
Alias /postfixadmin /usr/share/postfixadmin
Service Configuration
2. Start or restart the httpd service. Learn how to start and stop services here.
Postfix Admin Setup
3. Go to the Postfix Admin setup page at http://localhost/postfixadmin/setup.php and fill in the setup password. Next, click the Generate password hash.
Postfix Admin Setup
4. Get the generated setup password hash and put it into the file /usr/share/postfixadmin/ Next, fill in the Setup password, Admin and Password and Password (again). Finally, click Add Admin to create a new admin account.
Postfix Admin Login
5. Go to the Postfix Admin login page at http://localhost/postfixadmin/ and login using your newly created admin account.
Postfix Admin Main
6. Congratulations, it works.
NoteIf you encounter any problems, check the log file at /var/log/httpd/error_log.