User Tools

Site Tools


mailpiler - Debian Setup

What is mailpiler? Piler is an open source email archiving solution with all the necessary features for your enterprise.

mailpiler v1.1.1
Debian v7.8

This document is improved version of the following content

#become root at first
apt-get install openssl libssl-dev apache2 php5 php5-gd mysql-server php5-mysql libmysqlclient-dev php5-ldap memcached php5-memcache sphinxsearch libtre-dev libzip2 libzip-dev sysstat gcc libwrap0 libwrap0-dev latex2rtf latex2html catdoc libpoppler19 poppler-utils unrtf make unrtf catdoc tnef libtre5
nano /etc/default/sphinxsearch

Edit the section to make sure it says START=“no”

mkdir /var/www/piler
a2enmod rewrite
nano /etc/apache2/sites-enabled/000-default

Modify all lines that are AllowOverride to All at the end. Modify DocumentRoot to location of piler web directory. (/var/www/piler)

service apache2 restart
groupadd piler
useradd -g piler -s /bin/sh -d /var/piler piler
usermod -L piler
cd ~/Downloads
tar xzf piler-1.1.1.tar.gz
cd piler-1.1.1
./configure --localstatedir=/var --with-database=mysql --enable-starttls --enable-tcpwrappers
make install
make postinstall
root (could use default if willing to adjust more mysql permissions)
nano /usr/local/etc/piler.conf # Update the config file according to your needs.
nano /var/www/piler/config-site.php # Update the config file according to your needs

edit site specific information
PILER_HOST (Set to IP address of server)
(My DB info was already accurate.)

Change listening port to 587 at piler.conf file Then forward all incoming requests from 25 to 587 with iptables. After reboot, rules will be lost so you should make it persistent.

iptables -t nat -A PREROUTING -p tcp --dport 25 -j REDIRECT --to-ports 587
# to make piler start daemon a service
update-rc.d rc.piler defaults
# to make piler search daemon a service
update-rc.d rc.searchd defaults
# start the daemons
service rc.piler start
service rc.searchd start

If you want to see how I configured the php settings of mail piler (basically for LDAP/Active Directory) you can check out this page
Mail Piler Web Interface Configuration

Visit your and use the following username and password

[email protected]


Chantal, 2015/08/01 22:21

I do agree with all of the ideas you've offered to your post. They're really convincing and will certainly work. Nonetheless, the posts are very short for newbies. May you please prolong them a bit from next time? Thanks for the post.

Ozan HACIBEKIROGLU, 2015/08/17 06:37

If you mention which section should be prolonged, I will edit the content

Leo, 2015/08/24 20:54

Hello, I found your post very helpful. I had a few issues with the postinstall part, but got it resolved. The one problem I'm having issues with is after running service rc.piler start, it gives me error: starting piler . . . cant connect to mysql server

I can connect to mysql as root and I also edited piler.conf to be mysqlsocket=/var/run/mysqld/mysqld.sock so I don't know what the problem is. Would you kindly help me with this? Thanks

Ozan HACIBEKIROGLU, 2015/08/25 07:12

I assume you installed the version piler 1.1.1, build 904 and MySQL 5.5
Did you run the following commands during piler setup after make install and reply each question correctly?

make postinstall

If you missed the postinstall or if there is an incorrect entry in your conf file then it can complain about the mysql connection. conf file is located under /usr/local/etc/piler.conf Please revise the following piler conf etries if necessary.

mysqlpwd=<piler's mysql password>

Try to connect to piler's mysql database with mysql tools from command line. This can give you an idea. Check if there is a piler database and tables in it.

If it is solved, can you please share how you solved it so that other people can benefit from it.

leo, 2015/08/25 15:44

Hello, I did run the postinstall, but I must have answered something wrong. I also checked those settings on the piler.conf file and they were correct. At this point I had edited some other settings so I decided to start fresh. I have wheezy running on a Hyper-v virtual so deleting and re-creating the machine is not a big deal. This time I followed the instructions and after running make postinstall, here are the questions that appeared and the answers I gave:

This is the postinstall utility for piler It should be run only at the first install. DO NOT run on an existing piler installation!

Continue? [Y/N] [N] y

Please enter the webserver groupname [apache] piler

Please enter mysql hostname [localhost]

Please enter mysql socket path [/var/run/mysqld/mysqld.sock]

Please enter mysql database [piler]

Please enter mysql user name [piler]

Please enter mysql password for piler []

Please enter mysql root password [] mysql connection successful

Please enter the path of sphinx.conf [/etc/sphinxsearch/sphinx.conf]

Please enter smtp relay []

Please enter smtp relay port [25] no crontab for piler


piler user: piler keyfile: /usr/local/etc/piler.key

mysql host: localhost mysql socket: /var/run/mysqld/mysqld.sock mysql database: piler mysql username: piler mysql password: ***

sphinx indexer: /usr/bin/indexer sphinx config file: /etc/sphinxsearch/sphinx.conf

vhost docroot: /var/www/piler www group: piler

smtp relay host: smtp relay port: 25

piler crontab: ### PILERSTART 5,35 * * * * /usr/local/libexec/piler/ 30 2 * * * /usr/local/libexec/piler/ */15 * * * * /usr/bin/indexer –quiet tag1 –rotate */15 * * * * /usr/bin/indexer –quiet note1 –rotate 30 6 * * * /usr/bin/php /usr/local/libexec/piler/generate_stats.php –webui /var/www/piler */5 * * * * /usr/bin/find /var/www/piler/tmp -type f -name i.\* -exec rm -f {} \; ### PILEREND

Correct? [Y/N] [N] Y

Continue and modify system? [Y/N] [N] Y

Creating mysql database… Done. Writing sphinx configuration… Done.

After this, I edited the config-site following your example from and started the daemos without an issue. The problem now is that when I go to the page, it shows: It works! This is the default web page for this server. The web server software is running but no content has been added, yet.

So I must be missing something. Any ideas on what could that be? Thanks


Problem is fixed by giving the www-data group name for webserver group name during postinstall script. See second message below. -Leo

Ozan HACIBEKIROGLU, 2015/08/26 09:45

I think your apache or nginx configuration is missing. I will tell it assuming you have apache installed. Firstly check your /var/www/piler directory with this

[ -d /var/www/piler ] && echo "/var/www/piler directory exists" || echo "/var/www/piler directory NOT exist"

if directory exists, then you should check webserver configuration. I use apache so here is my configuration

[email protected]:/etc/apache2# cd sites-available/
[email protected]:/etc/apache2/sites-available# ls
default  default-ssl
[email protected]:/etc/apache2/sites-available# cat default
<VirtualHost *:80>
        ServerAdmin [email protected]

        DocumentRoot /var/www/piler
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        <Directory /var/www/piler>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride all
                Order allow,deny
                allow from all

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined

You can safely change your “default” config file with the one above. After that restart your webserver with your updated configuration

a2ensite default
service apache2 restart

If you still cannot access to piler's web UI, then check the main config file of apache “/etc/apache2/apache2.conf” and make sure that “Include sites-enabled/” directive is not commented.

Leo, 2015/08/26 17:20

Hello Ozan, thank you so much for following up. I was able to fix the problem. The issue was I didn't know that default webserver group for an apache server was www-data, so I was providing the wrong answers on the postinstall. If I may suggest it, I would modify your original post to show this:

make postinstall
www-data             ***this is the webserver group
root (could use default if willing to adjust more mysql permissions)

It might help some newbies like myself. In the end I had some trouble with mysql, but resetting the root password and adding [email protected] fixed it. Hope this helps someone else. Thanks again for your post and all your help.

Enter your comment. Wiki syntax is allowed:
linux/debian/mailpiler.txt · Last modified: 2015/05/04 05:51 (external edit)