To running DBMailAdmin, you must match below requirements:

  • A working DBMail mail server, running on Red Hat Enterprise Linux, CentOS or Scientific Linux 5.x or 6.x.
  • DBMail, version 2.x or 3.x. Stores mail accounts and messages in MySQL database.
  • Apache web server, version 2.2.0 or later.
    • mod_wsgi, Apache WSGI module, version 2.1 or later. WSGI module is used to host Python application which supports the Python WSGI interface.
  • Python, version 2.4 or later. Core programming language of DBMailAdmin. Warning: Python 3.x is not supported.
    • Web.py, version 0.32 or later. A python-powered web framework.
    • MySQLdb. A thread-compatible interface to the popular MySQL database server that provides the Python database API.

Note: After setting up by following this tutorial, you can access DBMailAdmin with URL: httpS://your_server/dbmailadmin/.

We will make DBMailAdmin run under Apache web server, as a seperated, low privilege user: dbmailadmin.

Execute below command to add this system account:

# useradd -m -s /sbin/nologin -d /home/dbmailadmin dbmailadmin

We have all required packages ready in iRedMail yum repositories. Make sure you have iRedMail yum repository configured: /etc/yum.repos.d/iRedMail.repo.

Note: If you're running RHEL/CentOS/Scientific Linux 5.x, please replace 6 by 5 in baseurl=.

[iRedMail]
name=iRedMail
baseurl=http://iredmail.org/yum/rpms/6/
enabled=1
gpgcheck=0
priority=999

Execute below commands to install required packages:

# ---- For i386 ----
# yum install python-webpy python-jinja2 MySQL-python mod_wsgi

# ---- For x86_64 ----
# yum install MySQL-python.x86_64 python-webpy.noarch python-jinja2.x86_64 mod_wsgi.x86_64

Download DBMailAdmin:

  • If you purchased DBMailAdmin, you should already have it. If not, please mail to support@ iredmail.org to get a download link.
  • If you didn't purchase DBMailAdmin, download DBMailAdmin trial edition from download page.

Upload DBMailAdmin to your DBMail server, we assume you uploaded it to /root/DBMailAdmin-x.y.z.tar.bz2. Replace x.y.z by the actual version number here.

Execute below commands to extract DBMailAdmin to directory /var/www/, set correct file permissions, and create symbol link.

# tar xjf DBMailAdmin-x.y.z.tar.bz2 -C /var/www/
# cd /var/www/
# chown -R dbmailadmin:dbmailadmin DBMailAdmin-x.y.z
# chmod -R 0555 DBMailAdmin-x.y.z
# ln -s DBMailAdmin-x.y.z dbmailadmin

Copy example config file, and set correct file permission.

# cd /var/www/dbmailadmin/
# cp settings.ini.dbmail_mysql.sample settings.ini
# chown dbmailadmin:dbmailadmin settings.ini
# chmod 0400 settings.ini

Edit settings.ini and set necessary variables.

NOTE: Please open settings.ini for more detail, it's self-documented.

# File: settings.ini
[general]
# General settings ...

[dbmailadmin]
# Database "dbmailadmin". required by DBMailAdmin.

[dbmail]
# Database "dbmail", stored all mail accounts and mail messages.

Create new Apache configure file /etc/httpd/conf.d/dbmailadmin.conf with below content.

#
# Note: Uncomment below two lines if you want to make DBMailAdmin accessible via HTTP.
#
#WSGIScriptAlias /dbmailadmin /var/www/dbmailadmin/dbmailadmin.py/
#Alias /dbmailadmin/static /var/www/dbmailadmin/static/

WSGISocketPrefix /var/run/wsgi
WSGIDaemonProcess dbmailadmin user=dbmailadmin threads=15
WSGIProcessGroup dbmailadmin

AddType text/html .py

<Directory /var/www/dbmailadmin/>
    Order allow,deny
    Allow from all
</Directory>

Edit /etc/httpd/conf.d/ssl.conf, make DBMailAdmin accessible via HTTPS. Add below lines before </VirtualHost>:

WSGIScriptAlias /dbmailadmin /var/www/dbmailadmin/dbmailadmin.py/
Alias /dbmailadmin/static /var/www/dbmailadmin/static/

Restart apache to enable module mod_wsgi:

# /etc/init.d/httpd restart

We will create a new MySQL database "dbmailadmin" to store sessions, admin operation log for DBMailAdmin.

# mysql -uroot -p
mysql> CREATE DATABASE dbmailadmin DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
mysql> USE dbmailadmin;
mysql> SOURCE /var/www/dbmailadmin/docs/samples/dbmailadmin.sql;

Execute below MySQL commands to create a new MySQL user, set password, and grant necessary privileges to this new user.

Note: Here we use 'plain_password' as password of MySQL user "dbmailadmin", please replace it by your own password.

# mysql -uroot -p
mysql> GRANT SELECT,INSERT,UPDATE,DELETE ON dbmailadmin.* TO dbmailadmin@localhost IDENTIFIED BY 'plain_password';
mysql> FLUSH PRIVILEGES;

Create addition columns in DBMail database: dbmail.

Note: It will create several new tables to store domain administrator accounts, create two new columns on table "dbmail.dbmail_users" to store user name and mail domain name.

# mysql -uroot -p
mysql> USE dbmail;
mysql> SOURCE /var/www/dbmailadmin/docs/samples/dbmail_addition.mysql;

Update MySQL records for existing mail accounts, fill new column "dbmail_users.domain" with domain name.

# mysql -uroot -p
mysql> USE dbmail;
mysql> UPDATE dbmail_users SET domain = SUBSTRING_INDEX(userid, '@', -1) WHERE domain = '' AND user_idnr > 3;

We will create a global domain admin here, you can login to DBMailAdmin with this account later.

  • Admin username: postmaster@example.com
  • Password: mypasswd

Get a encrypted password with OpenSSL:

# openssl passwd -1 'mypasswd'
$1$Af1GkO6C$A8tu/zX1P6E4t4Mb0TpYk0

Create a global domain admin with password generated above:

# mysql -uroot -p
mysql> USE dbmail;
mysql> INSERT INTO dbmail_admins (username, password) VALUES ('postmaster@example.com', '$1$Af1GkO6C$A8tu/zX1P6E4t4Mb0TpYk0');
mysql> INSERT INTO dbmail_domain_admins (username, domain) VALUES ('postmaster@example.com', 'ALL');

You can now access DBMailAdmin with admin account created above to manage your mail accounts.

https://your_server/dbmailadmin/

Please post all issues, feedbacks, feature requests, suggestions in our online support forum, it's more responsible than you expected: http://www.iredmail.org/forum/ (Forum: DBMailAdmin support).