Install/iRedAdmin-Pro/DBMail-MySQL/RHEL

From iRedMail
Revision as of 08:27, 16 September 2011 by ZhangHuangbin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Summary

  • This installation guide is used to install iRedAdmin-Pro-DBMail-MySQL on:
    • Red Hat Enterprise Linux 5.x, 6.x
    • CentOS 5.x, 6.x
    • Scientific Linux 5.x, 6.x
  • iRedAdmin-Pro is official web-based admin panel for iRedMail. There're three editions:
    • iRedAdmin-Pro-LDAP: works with OpenLDAP backend. Uses Dovecot as POP3/IMAP/Managesieve server.
    • iRedAdmin-Pro-MySQL: works with MySQL backend. Uses Dovecot as POP3/IMAP/Managesieve server.
    • iRedAdmin-Pro-DBMail-MySQL: works with MySQL backend. Uses DBMail as POP3/IMAP/Managesieve server, stores mail accounts and mail messages in MySQL database.

System requirements

  • Install the latest iRedMail and DBMail by following this tutorial: Integrate DBMail in iRedMail (MySQL backend)
  • DBMail:
    • DBMail-3.x serial: 3.0.0-rc3 or newer versions.
    • DBMail-2.x serial: 2.2.17 or newer versions.
  • 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.
    • Web.py, 0.32+. A python-powered web framework.
      • MySQLdb. A thread-compatible interface to the popular MySQL database server that provides the Python database API.

Add new system account: iredadmin

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

Terminal:
# useradd -s /sbin/nologin -m -d /home/iredadmin iredadmin

Install necessary packages

Note: You can skip this step if you have iRedAdmin open source edition during iRedMail installation.

  • Make sure you have iRedMail yum repository configured: /etc/yum.repos.d/iRedMail.repo.
File: /etc/yum.repos.d/iRedMail.repo
[iRedMail]
name=iRedMail
baseurl=http://iredmail.org/yum/rpms/5/
enabled=1
gpgcheck=0
priority=1

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

  • Install necessary packages.
Terminal:
# ---- 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 iRedAdmin and configure Apache web server

  • Get iRedAdmin:
    • If you purchased iRedAdmin-Pro-DBMail-MySQL, you should already have it. If not, please mail to support@ iredmail.org to get a download link.
    • If you didn't purchase iRedAdmin-Pro-DBMail-MySQL, download iRedAdmin open source edition from download page.
  • Copy iRedAdmin to /var/www/, set correct file permissions, and create symbol link.
Terminal:
# tar xjf iRedAdmin-x.y.z.tar.bz2 -C /var/www/
# cd /var/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: /etc/httpd/conf.d/iredadmin.conf.
File: /etc/httpd/conf.d/iredadmin.conf
#
# Note: Uncomment below two lines if you want to make iRedAdmin accessable via HTTP.
#
#WSGIScriptAlias /iredadmin /var/www/iredadmin/iredadmin.py/
#Alias /iredadmin/static /var/www/iredadmin/static/

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

AddType text/html .py

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

Create necessary MySQL database and grant privileges

  • Create MySQL database: iredadmin. Used to store sessions, admin operation logs, etc.
Terminal:
# mysql -uroot -p
mysql> CREATE DATABASE iredadmin DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
mysql> USE iredadmin;
mysql> SOURCE /var/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.

Terminal:
# mysql -uroot -p
mysql> GRANT SELECT,INSERT,UPDATE,DELETE ON iredadmin.* TO iredadmin@localhost IDENTIFIED BY 'secret_passwd';
mysql> FLUSH PRIVILEGES;
  • Create addition columns for DBMail database: dbmail.
Terminal:
# mysql -uroot -p
mysql> USE dbmail;
mysql> SOURCE /var/www/iredadmin/docs/samples/dbmail_additions.mysql;

Note: It will create some addition MySQL tables, and add extra columns for existing dbmail tables.

Create a global domain admin

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

  • Admin username: postmaster@example.com
  • Password: mypasswd
Terminal:
# ---- Encrypt password 'mypasswd' in MD5 ----
# openssl passwd -1 'mypasswd'
$1$Af1GkO6C$A8tu/zX1P6E4t4Mb0TpYk0

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

Configure iRedAdmin

  • Copy example config file, and set correct file permission.
Terminal:
# cd /var/www/iredadmin/
# cp settings.ini.mysql.sample settings.ini
# chown iredadmin:iredadmin settings.ini
# chmod 0600 settings.ini
  • Edit settings.ini and set several variables.
    • NOTE: Please open settings.ini for more detail, it's self-documented.
File: settings.ini
[general]
# General settings ...

[iredadmin]
# Database "iredadmin". required by iRedAdmin.

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

[policyd]
# Database "policyd".
# Required for policyd integration.

[amavisd]
# Database "amavisd".
# Required for Amavisd-New integration. includes spam quarantining/releasing.
  • Restart apache web server.
Terminal:
# /etc/init.d/httpd restart

Troubleshooting

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
[general]
debug = True
Personal tools