RHEL / CentOS / Redhat :: Mailpiler with Sphinx and MariaDB (mySQL)

Mailpiler Mailpiler provides a secure and safe solution for email archiving RHEL/CentOS. Preparing the box Install EPEL Repository

Important

MariaDB segfaults with the latest version ( 0.1.24) of mailpiler, please use the stock MySQL or Percona XtraDB guides.

If you have followed this guide and have the segfault issue, please see this guide on how to fix your mailpiler install.

Notes

Guide is based on a guide by : Jan Carel Putter posted to the mailinglist

Prepare the node

Enable OpenVZ containers (Proxmox V2.2 and later)

Remove useless packages from the system to create a minimal install

Update

Install Common Utilities

Install Repositories

We will use MariaDB as a drop-in replacement for mysql.

Add the MariaDB repository to replace MySQL

add the repository

Import the GP key

Install MariaDB

Secure MariaDB

Enter current password for root (enter for none):
Set root password? Y
Remove anonymous users? [Y
Disallow root login remotely? [Y
Remove test database and access to it? [Y
Reload privilege tables now? [Y

Start MariaDB at boot

Restart MariaDB

Install required packages

Setup MySQL

Configure your root password for MySQL

Download and install xlhtml

Install Sphinx

Create a user for piler

Download and Install Mailpiler
cd /tmp
wget https://bitbucket.org/jsuto/piler/downloads/piler-0.1.24.tar.gz
tar xfvz piler-0.1.24.tar.gz
cd piler-0.1.24
./configure –localstatedir=/var –enable-starttls –enable-tcpwrappers –with-database=mysql
make && make install
make postinstall

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 path of your documentroot [/var/www/localhost] /var/www/html/mailpiler
Please enter the webserver groupname [apache]
Please enter mysql hostname [localhost]
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/sphinx.conf] /etc/sphinx/sphinx.conf
Please enter smtp relay [] smtp.example.com
Please enter smtp relay port [25]

Register the liberary

Setup Apache Virtual Host

Start Apache2

Configure Mailpiler SQL Settings

Initialise search indexes

Setup Mailpiler startup script

Change init script to work with chkconfig (file: /tmp/piler-0.1.23/init.d/mailpiler )
Add the following just below the shebang

Copy the init script in the correct location

Make it executable

Add the service to chkconfig and set it to startup at boot

Setup Sphinx init script (file: /tmp/piler-0.1.23/init.d/rc.searchd )
Mailpiler supplies it own init script that starts sphinx however since we install sphinx from a rpm the binary executable for sphinx is located at /usr/bin/ and not /usr/local/bin as stated in the init script.
Add the following just below the shebang

Correct the path

Install the init script

Configure Mailpiler Settings (file: /var/www/html/mailpiler/config-site.php )
Set your website url/domain

This is important as mailpiler uses this url to redirect requests. This will always match your virtual host server name.

You can now access http://mailarchiver.exameple.com Default credentials Username: admin@local Password: pilerrocks

28 replies
  1. Joshua
    Joshua says:

    Great Guide. However I ran into a small hitch. When i do the service mysqld start && chkconfig mysqld on part, I get “Unrecognized service”. I am quite new to this so I am sure it’s something I overlooked. Can you please let me know if that is the case? Thanks

    Reply
  2. Joshua
    Joshua says:

    Hi Again, Thanks for fixing the guide, was able to move forward. Now I am at the sed -i “s|/usr/bin/|/usr/local/|g /tmp/piler-0.1.23/init.d/rc.searchd part. When I input that, i get a > to enter text, is that supposed to be happening, could you please let me know what needs to be done in this part? Thanks again

    Reply
  3. Vicky
    Vicky says:

    Dear Admin,

    I have configured everything as per the document but i get below error when i pass command indexer -all.
    But i have mentioned proper user name, DB and password in the sphinx.conf file.
    Even when i try to modify any user in mysql i get same error.

    sh-4.1$ indexer –all
    Sphinx 2.0.9-id64-release (rel20-r4115)
    Copyright (c) 2001-2013, Andrew Aksyonoff
    Copyright (c) 2008-2013, Sphinx Technologies Inc (http://sphinxsearch.com)

    using config file ‘/etc/sphinx/sphinx.conf’…
    indexing index ‘main1’…
    ERROR: index ‘main1’: sql_connect: Access denied for user ‘piler’@’localhost’ (using password: YES) (DSN=mysql://piler:***@localhost:3306/piler).
    total 0 docs, 0 bytes
    total 0.004 sec, 0 bytes/sec, 0.00 docs/sec

    Regards
    Vicky

    Reply
  4. Vicky
    Vicky says:

    Hi Admin,

    I have installed everything successfully but now im getting
    starting piler . . .
    /etc/init.d/mailpiler: line 7: 25218 Segmentation fault (core dumped) /usr/local/sbin/piler -d

    when im trying to start piler service.

    Regards
    Vicky

    Reply
  5. Manickam
    Manickam says:

    Hi I have configured the mailpiler followed by above methods, when start the service its say starting but when look the mailpiler status its say “piler is not running.”

    Could you please any one help me out

    THanks
    Manickam

    Reply
  6. Manickam
    Manickam says:

    Thanks admin, Now i fixed the problem, now every think running is ok

    Can you help me how do i archive from mail server i am using zimbra and using alwasy_bcc to

    archive@backup.mailarchive.local. Now mails accepting the postfix keeping with local mailbox its not upadting to maipiler or mydb

    could you please help me out some one.

    Thanks
    Manickam

    Reply
  7. Ronald
    Ronald says:

    Hi Justo,

    Thanks for your cookbook. However, I run into the following problem:
    Executing the line:
    ./configure -localstatedir=/var -enable-starttls -enable-tcpwrappers -with-database=mysql
    results in:
    can’t find either tcpd.h or libwrap

    Am I missing something? And maybe something to add in your cookbook is to do a ‘yum install gcc’ because the default install of CentOS does not include gcc.

    Any help appreciated.

    Grtz,
    Ronald

    Reply
  8. Ronald
    Ronald says:

    Hi Admin,

    Amost got it up and running, but I get:
    /etc/init.d/mailpiler: line 9: 13027 Segmentation fault /usr/local/sbin/piler -d
    I have used the following components:
    xlhtml-0.5.1-sj-mod.tar.gz (instead of xlhtml-0.5-sj-mod.tar.gz)
    sphinx-2.1.3-1.rhel6.x86_64.rpm (instead of sphinx-2.0.9-1.rhel6.x86_64.rpm)
    piler-0.1.24.tar.gz (instead of piler-0.1.23.tar.gz)

    Can you shed a light please? Really looking forward to evaluate more.

    TIA and BR,

    Ronald

    Reply
  9. RTop
    RTop says:

    Dear Admin,

    I have installed and configured everything according to the document, have updated the permissions on /var/lib/sphinx and have updated the sphinx.conf file with proper uid, pwd and db.
    However, if I run indexer –all , I get:
    ERROR: index ‘test1’: sql_query: Table ‘piler.documents’ doesn’t exist (DSN=mysql://piler:***@localhost:3306/piler)
    when I list the tables from table piler, I get:
    MariaDB [piler]> show tables
    -> ;
    +—————–+
    | Tables_in_piler |
    +—————–+
    | archiving_rule |
    | attachment |
    | audit |
    | counter |
    | counter_stats |
    | domain |
    | domain_user |
    | email |
    | email_groups |
    | folder |
    | folder_extra |
    | folder_message |
    | folder_user |
    | google |
    | google_imap |
    | group |
    | group_email |
    | group_user |
    | metadata |
    | note |
    | option |
    | rcpt |
    | remote |
    | retention_rule |
    | search |
    | sph_counter |
    | sph_index |
    | tag |
    | user |
    | user_settings |
    | v_attachment |
    | v_messages |
    +—————–+
    32 rows in set (0.00 sec)

    I am missing the documents table. In which step should this have been created? I guess in the make postinstall, but I get no errors there.

    Any help highly appriciated!

    Grtz,
    RTop

    Reply
  10. denny
    denny says:

    from admin@local I know 2 emails come in, but I cannot  see it from auditor@local or  the user account, what can I do?

    btw, I set up with .ova. it seems everything is ok. but user account can’t see the emails comed in

    Reply
  11. daniel
    daniel says:

    hi guys. I can not start piler
    service mailpiler start
    ERROR: / usr / local / sbin / pilerconf: error while loading libraries: lib.so: can not open shared object file: No such file or directory

    thanks for help me…

    Reply
  12. Murtaza Makati
    Murtaza Makati says:

    Dear Admin,

    Hope you are doing fine. I have two questions. 1st one is that on webui I got CPU usage is RED color but on system when I check its on 0 load average. Please see attached snapshot for reference.

    Another problem I am facing is that in webui it is showing piler: Error. Please see ‘piler.jpg’ for reference.

    https://www.dropbox.com/sh/cn7ux9n3n9s8ktb/fMBJzezIIO
    (Both JPG file can be seen on this link)

    Regards,
    Murtaza

    Reply
  13. peace
    peace says:

    Hi Ronald,
    Were you able to fix the issue? i am also stucked with the same message.
    Appreciate if you help me to move forward.
    Thanks to admin for the post as well.

    Thanks
    peace

    Reply
  14. peace
    peace says:

    Dear admin,

    I am getting following error while running:

    ./configure -localstatedir=/var -enable-starttls -enable-tcpwrappers -with-database=mysql

    Appreciate  your help if you help me to move ahead.

    checking tcpd.h usability… no
    checking tcpd.h presence… no
    checking for tcpd.h… no
    checking for hosts_access in -lwrap… no
    can’t find either tcpd.h or libwrap

     

    Thanks,

    Peace

    Reply
  15. Darryl
    Darryl says:

    running this command

    ./configure –localstatedir=/var –enable-starttls –enable-tcpwrappers –with-database=mysql

    gives an error ‘configure: error: invalid variable name: ‘-localstatedir’

    so I (stupidly in hindsight) added a second dash like so

    configure -–localstatedir=/var -–enable-starttls -–enable-tcpwrappers -–with-database=mysql

    only when adding this comment did I notice that your webpage is using the long dash and not the short.  deleting the existing long dash and replacing with two shorts allowed the command to execute correctly

     

    Reply
  16. suresh prabhakaran
    suresh prabhakaran says:

    i have been created new user successfully and but when i logged on that user.. in my dashboard show smtp error , piller error..

    i neaded to know why we are given smtp relay as smtp.example.com

     

    Reply
  17. das
    das says:

    HI

    I was able to install ,later login and rectified issue with piler=ok.

    And able to receive mail on behave of a user in the centos machine since i can see the maillog with stored .

     

    My question is where can I see thosemails in webgui ,those are not displaying .

     

     

     

     

    Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *