From iRedMail
Jump to: navigation, search



  • This installation guide is used to install iRedAdmin-Pro-MySQL-1.0 on FreeBSD 7.x, 8.x.
  • iRedAdmin-Pro is official web-based admin panel for iRedMail. There're two editions:
    • iRedAdmin-Pro-LDAP: works with OpenLDAP backend.
    • iRedAdmin-Pro-MySQL: works with MySQL backend.
  • Release Notes of iRedAdmin-Pro-MySQL-1.0

System requirements

  • iRedMail-0.6.0 and newer versions. Note: addition update is required. We will cover it below.
  • Packages:
    • Apache, 2.2+. Web server.
      • mod_wsgi 2.1+. Apache module used to host Python application which supports the Python WSGI interface.
    • Python 2.4+, core programming language. Warning: Python 3.x is not supported yet.
    •, 0.32+. A python-powered web framework.
      • MySQLdb. A thread-compatible interface to the popular MySQL database server that provides the Python database API.

Update iRedMail

Addition update is required to use iRedAdmin-Pro-MySQL, please follow links to apply them.

  • [This step is required for iRedMail-0.6.1 and earlier versions] Update MySQL database vmail. Required by iRedAdmin-Pro.
$ mysql -u root -p
mysql> USE vmail;

mysql> ALTER TABLE mailbox ADD COLUMN enablesmtpsecured TINYINT(1) NOT NULL DEFAULT '1';
mysql> ALTER TABLE admin ADD COLUMN name VARCHAR(255) DEFAULT '' COLLATE utf8_general_ci;
mysql> ALTER TABLE alias ADD COLUMN name VARCHAR(255) DEFAULT '' COLLATE utf8_general_ci;
mysql> ALTER TABLE domain ADD COLUMN defaultuseraliases TEXT NOT NULL DEFAULT '';
mysql> ALTER TABLE domain ADD COLUMN defaultpasswordscheme VARCHAR(10) NOT NULL DEFAULT '';

Add new system account: iredadmin

We will make iRedAdmin run with Apache web server, but as non-apache, low privilege user: iredadmin.

# pw useradd -s /sbin/nologin -d /home/iredadmin -n iredadmin

Install necessary packages

Install several devel binary packages, used for building python modules.

# bash
# for p in www/mod_wsgi www/webpy databases/py-dbutils devel/py-Jinja2 databases/py-MySQLdb net/py-netifaces; do cd /usr/ports/${p} && make install clean; done

Download iRedAdmin and configure Apache web server

  • Get iRedAdmin:
    • If you purchased iRedAdmin-Pro-MySQL, you should already have it. If not, please mail to support@ to get a download link.
    • If you didn't purchase iRedAdmin-Pro-MySQL, download iRedAdmin open source edition from download page.
  • Copy iRedAdmin to /usr/local/www/, set correct file permissions, and create symbol link.
# tar xjf iRedAdmin-x.y.z.tar.bz2 -C /usr/local/www/
# cd /usr/local/www/
# chown -R iredadmin:iredadmin iRedAdmin-x.y.z
# chmod -R 0755 iRedAdmin-x.y.z
# ln -s iRedAdmin-x.y.z iredadmin
  • Add apache configure file: /usr/local/etc/apache22/Includes/iredadmin.conf.
File: /usr/local/etc/apache22/Includes/iredadmin.conf
# Note: Uncomment below two lines if you want to make iRedAdmin accessable via HTTP.
#WSGIScriptAlias /iredadmin /usr/local/www/iredadmin/
#Alias /iredadmin/static /usr/local/www/iredadmin/static/

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

AddType text/html .py

<Directory /usr/local/www/iredadmin/>
    Order deny,allow
    Allow from all
  • Edit /usr/local/etc/apache22/extra/httpd-ssl.conf, make iredadmin accessable via HTTPS. Add below lines before </VirtualHost>:
File: /usr/local/etc/apache22/extra/httpd-ssl.conf
WSGIScriptAlias /iredadmin /usr/local/www/iredadmin/
Alias /iredadmin/static /usr/local/www/iredadmin/static/
  • Restart apache to enable mod_wsgi:
# /usr/local/etc/rc.d/apache22 restart

Create necessary MySQL database and grant privileges

Create MySQL database: iredadmin. Used to store sessions, admin operation log, etc.

# mysql -uroot -p
mysql> CREATE DATABASE iredadmin DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
mysql> USE iredadmin;
mysql> SOURCE /usr/local/www/iredadmin/docs/samples/iredadmin.sql;
  • Grant privileges to iredadmin user and set password for it.
    • WARNING: Here we use 'secret_passwd' as password of iredadmin user, please replace it with your own password.
# mysql -uroot -p
mysql> GRANT SELECT,INSERT,UPDATE,DELETE ON iredadmin.* TO iredadmin@localhost IDENTIFIED BY 'secret_passwd';

Configure iRedAdmin

  • Copy example config file, and make it not world-writeable.
# cd /usr/local/www/iredadmin/
# cp settings.ini.mysql.sample settings.ini
# chown iredadmin:iredadmin settings.ini
# chmod 0600 settings.ini
  • Edit settings.ini and set correct values.
    • NOTE: For more inforamtion, please open settings.ini, it's self-documented.
File: settings.ini
# General settings ...

# Database "iredadmin". required by iRedAdmin.

# Database "vmail", stored all mail accounts.

# Database "policyd". Required for policyd integration.

# Database "amavisd". Required for Amavisd-New integration. includes spam quarantining/releasing.
  • Restart apache web server.
# /usr/local/etc/rc.d/apache22 restart


If iRedAdmin doesn't work as expected, you can set debug = True in settings.ini to turn on debug mode, restart apache web server, use your favourite web browser to access it again, create a new forum topic and paste error message in forum topic.

File: settings.ini
debug = True
Personal tools