Install/iRedAdmin-Pro/MySQL/Debian

From iRedMail

(Difference between revisions)
Jump to: navigation, search
(Create necessary MySQL database and grant privileges)
(Configure iRedAdmin)
Line 96: Line 96:
= Configure iRedAdmin =
= Configure iRedAdmin =
 +
 +
* Copy example config file, and make it not world-writeable.
 +
{{cmd|<pre>
 +
$ cd /usr/share/apache2/iredadmin/
 +
$ cp settings.ini.sample settings.ini
 +
# chown iredadmin:iredadmin settings.ini
 +
# chmod 0600 settings.ini
 +
</pre>}}
 +
 +
* Edit settings.ini and set correct values.
 +
** '''NOTE''': For more inforamtion, please open '''settings.ini''', it's self-documented.
 +
{{cfg|settings.ini|<pre>
 +
[general]
 +
# General settings ...
 +
 +
[iredadmin]
 +
# Database "iredadmin". required by iRedAdmin.
 +
 +
[vmaildb]
 +
# Database "vmail", stored all mail accounts.
 +
 +
[policyd]
 +
# Database "policyd". Required for policyd integration.
 +
 +
[amavisd]
 +
# Database "amavisd". Required for Amavisd-New integration. includes spam quarantining/releasing.
 +
</pre>}}
 +
= Troubleshooting =
= Troubleshooting =

Revision as of 03:37, 29 January 2011

Contents

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. 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 -m -s /sbin/nologin -d /home/iredadmin iredadmin

Install necessary packages

  • Install binary packages as dependences, used for building python modules.
Terminal:
$ sudo apt-get install gcc python-setuptools python-dev \
                        libldap2-dev libmysqlclient15-dev \
                        libsasl2-dev libssl-dev \
                        libapache2-mod-wsgi \
                        python-mysqldb
  • Install required python modules.
Terminal:
$ sudo easy_install web.py Jinja2 netifaces DBUtils

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@ iredmail.org 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/share/apache2/, set correct file permissions, and create symbol link.
Terminal:
$ sudo tar xjf iRedAdmin-x.y.z.tar.bz2 -C /usr/share/apache2/
$ cd /usr/share/apache2/
$ sudo chown -R iredadmin:iredadmin iRedAdmin-x.y.z
$ sudo chmod -R 0755 iRedAdmin-x.y.z
$ sudo ln -s iRedAdmin-x.y.z iredadmin
  • Add apache configure file: /etc/apache2/conf.d/iredadmin.conf.
File: /etc/apache2/conf.d/iredadmin.conf
#
# Note: Uncomment below two lines if you want to make iRedAdmin accessable via HTTP.
#
#WSGIScriptAlias /iredadmin /usr/share/apache2/iredadmin/iredadmin.py/
#Alias /iredadmin/static /usr/share/apache2/iredadmin/static/

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

AddType text/html .py

<Directory /usr/share/apache2/iredadmin/>
    Order deny,allow
    Allow from all
</Directory>
  • Edit /etc/apache2/sites-enabled/default-ssl, make iredadmin accessable via HTTPS. Add below lines before </VirtualHost>:
File: /etc/apache2/sites-enabled/default-ssl
WSGIScriptAlias /iredadmin /usr/share/apache2/iredadmin/iredadmin.py/
Alias /iredadmin/static /usr/share/apache2/iredadmin/static/
  • Enable mod_wsgi module and restart apache to make it work:
Terminal:
$ sudo a2enmod *wsgi
$ sudo /etc/init.d/apache2 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 /usr/share/apache2/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;

Configure iRedAdmin

  • Copy example config file, and make it not world-writeable.
Terminal:
$ cd /usr/share/apache2/iredadmin/
$ cp settings.ini.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]
# General settings ...

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

[vmaildb]
# Database "vmail", stored all mail accounts.

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

[amavisd]
# Database "amavisd". Required for Amavisd-New integration. includes spam quarantining/releasing.

Troubleshooting

Personal tools