Thursday, December 12, 2013

Piler on Debian Wheezy

MailPiler 0.1.24 on Debian Wheezy

I was interested in setting up an email archive server.  We need to be doing this but with budgets as they are these days we need to do it on the cheap.  MailPiler looked promising.  The directions are a little shotty for a non-linux user like me.  So the instructions below are word for word what I did with my final production server.  It took me 5 reimages of the virtual machine before I got to this point!  Like I said, non-linux user.  Hopefully these instructions will help someone else.  I used the official tar.gz, but the latest source is of interest as it includes a few of the things I had to do to get things to work right, so I would suggest you load from the source.

Install Debian Wheezy - no need to install any special packages, those will be included in the install later.

apt-get update
apt-get upgrade
apt-get autoclean
apt-get autoremove

apt-get install openssl  libssl-dev apache2 php5 php5-gd mysql-server phpmyadmin 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

nano /etc/default/sphinxsearch
Edit the section to make sure it says START="no"

a2enmod rewrite
nano /etc/apache2/sites-enabled/ooo-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

Then download piler from the piler download location.

tar zxvf piler-x.y.z.tar.gz
cd piler-x.y.z
./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 mysql section at the end with settings specific to your setup.

nano /var/www/piler/config-site.php
edit site specific information
PILER_HOST (Set to IP address of server)
(My DB info was already accurate.)

sh init.d/rc.piler start
sh init.d/rc.searchd start

If you want to add these scripts to run at boot follow the below instructions.

Copy the scripts to the init.d folder and add the scripts to boot time.
cp init.d/rc.piler /etc/init.d/
cp init.d/rc.searchd /etc/init.d
insserv rc.piler
insserv rc.searchd

Add your domain to the Administration/Domain menu. ->
Adjust the default passwords to make it secure.

Now start sending mail to the server from your email server.  I use Google Apps, so I had to add my server as a forwarder.

LDAP Authentication
nano config-site.php
$config['ENABLE_LDAP_AUTH'] = 1;
$config['LDAP_HOST'] = '***';
// set this if you want to limit the scope of the ldap query
$config['LDAP_BASE_DN'] = '';
// the helper account, see the details below
$config['LDAP_HELPER_DN'] = 'CN=...';
$config['LDAP_HELPER_PASSWORD'] = '******';
$config['LDAP_MAIL_ATTR'] = 'mail';
$config['LDAP_ACCOUNT_OBJECTCLASS'] = 'user';

$config['LDAP_DISTRIBUTIONLIST_ATTR'] = 'member';


  1. Excellent howto, congratulations, only thing

    After sh init.d/rc.piler start

    I get this error message:

    /usr/local/sbin/pilerconf: error while loading shared libraries: cannot open shared object file: No such file or directory

    Resolved with: #ldconfig

    Thank you

  2. What is #ldconfig? Did you get it fixed, or are you asking? If you fixed it, can you elaborate?

  3. Just run ldconfig in the console, so the libraries get updated.