System Requirements.

  • Apache 2.2+. Web server. Already shipped within RHEL/CentOS 5.x.
  • mod_wsgi 2.1+. Apache module used to host Python application which supports the Python WSGI interface.
  • Python 2.4+, core programming language. Already shipped within RHEL/CentOS 5.x.
  • Webpy 0.32+. A python-powered web framework.
  • MySQL-python. A thread-compatible interface to the popular MySQL database server that provides the Python database API.
  • Python-LDAP 2.37+. An object-oriented API to access LDAP directory servers from Python programs.

Add new system account: iredadmin.

We will make iRedAdmin run with Apache web server, but as non-apache, low privilege user: iredadmin.
# ---- Add new user: iredadmin ----
# pw useradd -s /sbin/nologin -d /home/iredadmin -n iredadmin

Configure OpenLDAP.

Make sure OpenLDAP includes amavisd schema file.

# ---- Copy amavisd schema file into OpenLDAP directory ----
# cp -f /usr/local/share/doc/amavisd-new/LDAP.schema /usr/local/etc/openldap/schema/amavisd-new.schema

# ---- Add below line in /usr/local/etc/openldap/slapd.conf before line ----
# ---- 'include /usr/local/etc/openldap/schema/iredmail.schema' if not present ----

include /usr/local/etc/openldap/schema/amavisd-new.schema

Restart OpenLDAP service.

# /etc/init.d/slapd restart

Install required packages.

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

# ---- Run below command in bash shell ----
# for i in www/mod_wsgi www/webpy devel/py-Jinja2 databases/py-MySQLdb net/py-ldap2 net/py-netifaces; do cd /usr/ports/${i} && make install clean; done

Download iRedAdmin and configure Apache web server.

  • Download iRedAdmin 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.
  • #
    # Note: Uncomment below two lines if you want to make iRedAdmin accessable via HTTP.
    #
    #WSGIScriptAlias /iredadmin /usr/local/www/iredadmin/iredadmin.py/
    #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
    </Directory>
  • Edit /usr/local/etc/apache22/extra/httpd-ssl.conf, make iredadmin accessable via HTTPS. Add below lines before </VirtualHost>:
  • WSGIScriptAlias /iredadmin /usr/local/www/iredadmin/iredadmin.py/
    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.
  • # 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';
    mysql> FLUSH PRIVILEGES;
    

Configure iRedAdmin.

  • Copy example config file.
  • # cd /usr/local/www/iredadmin/
    # cp settings.ini.sample settings.ini
    
  • Edit settings.ini and set several variables.
  • NOTE: For more inforamtion, please read settings.ini, it's self-documented.
    NOTE: You should ensure both bind dn and bind_pw are correct with below command, you can find bind dn and password in your iRedMail installation directory, e.g. /root/iRedMail-0.5.1/iRedMail.tips, usually, it's cn=vmailadmin,dc=xxx,dc=xxx.
    # ldapsearch -x -D 'YOUR_BIND_DN' -W
    WARNING: Bind password is plain text here, not encryped/hashed one.
    [general]
    admin = user@domain.ltd
    debug = False
    lang = en_US
    backend = ldap
    storage_base_directory = /var/vmail/vmail01
    
    [iredadmin]
    dbn = mysql
    host = localhost
    port = 3306
    db = iredadmin
    user = iredadmin
    passwd = secret_passwd
    
    [ldap]
    uri = ldap://127.0.0.1:389
    suffix = dc=iredmail,dc=org
    basedn = o=domains,dc=iredmail,dc=org
    domainadmin_dn = o=domainAdmins,dc=iredmail,dc=org
    bind_dn = cn=vmailadmin,dc=iredmail,dc=org
    bind_pw = passwd
    
  • Make settings.ini not world-writeable and restart apache web server.
  • # chmod 0600 settings.ini
    # /usr/local/etc/rc.d/apache22 restart
    

Open your web browser to access iRedAdmin.

httpS://your_server_ip_address/iredadmin/

Make sure you use HTTPS:// instead of HTTP://.

Troubleshooting & Debug

If iRedAdmin doesn't work as expected, you can simplily set 'debug = True' in settings.ini, 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.