Instalasi Maia Mailguard di Ubuntu 8.04 Server

By admin

Tulisan asli dokumen ini mempergunakan ubuntu 6.06 dibuat oleh bang cecep dapat di lihat di situs ini
Instalasi Maia Mailguard di Ubuntu 6.06 Server (LTS)

Untuk versi 8.04 ada sedikit perbedaan di php dan smarty.
Juga saya tambahkan beberapa clue agar maia dapat langsung berjalan, tanpa harus trouble-shot lagi.

Pastikan postfix sudah terinstall dan berfungsi dengan baik dan benar.
Edit file master.cf pada postfix untuk menerima request dari port 10025.

vi /etc/postfix/master.cf
127.0.0.1:10025 inet n  -       n     -       -  smtpd
-o content_filter=
-o local_recipient_maps=
-o relay_recipient_maps=
-o smtpd_restriction_classes=
-o smtpd_client_restrictions=
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks=127.0.0.0/8
-o strict_rfc821_envelopes=yes
/etc/init.d/postfix restart


Install Pre-Requisites Ubuntu Package for Maia

apt-get install apache2
apt-get install mysql-client mysql-server
apt-get install spamassassin

Get Maia Source

mkdir /opt/sources
cd /opt/sources
wget http://www.maiamailguard.com/files/maia-1.0.1.tar.gz
tar zxvf maia-1.0.1.tar.gz

Create User & Group for Maia

groupadd amavis
useradd -g amavis -d /var/amavisd -s /bin/false -c "AMaViS system user" amavis

Create Database

mysql -u root -p mysql
mysql> CREATE DATABASE maia;

Build Initial Tables and Data

mysql -u root -p maia < /opt/sources/maia-1.0.1/maia-mysql.sql

Grant Access Right

mysql -u root -p maia
mysql> GRANT CREATE, DROP, ALTER, SELECT, INSERT, UPDATE, DELETE ON maia.* TO amavis@localhost IDENTIFIED BY 'passwd';

Install The Maintenance Scripts and Templates
Buat folder yang diperlukan.

mkdir -p /var/amavisd/maia/{scripts,templates}
mkdir /var/amavisd/{tmp,db}

Copy source file ke direktori installasi.

cp /opt/sources/maia-1.0.1/scripts/* /var/amavisd/maia/scripts
cp /opt/sources/maia-1.0.1/templates/* /var/amavisd/maia/templates

Fix files permissions.

chmod 711 /var/amavisd
chmod 711 /var/amavisd/maia
chmod 644 /var/amavisd/maia/templates/*.tpl
chmod 750 /var/amavisd/maia/scripts/*.pl

Change ownerships.

chown -R amavis:amavis /var/amavisd

Copy file konfigurasi.

cp /opt/sources/maia-1.0.1/maia.conf.dist /etc/maia.conf
chown amavis:amavis /etc/maia.conf
chmod 640 /etc/maia.conf

Test Your amavisd-maia and SpamAssassin Configuration

/var/amavisd/maia/scripts/configtest.pl

Periksa output dari perintah di atas. Lihat kolom status, pastikan semuanya statusnya OK. Contoh output:

Application/Module      Version   Status
========================================================================
Perl                 :    5.8.8 : OK
file(1)              :     4.21 : OK
Archive::Tar         :     1.36 : OK
Archive::Zip         :      N/A : NOT INSTALLED (required by Maia Mailguard)
BerkeleyDB           :      N/A : NOT INSTALLED (Maia Mailguard's optional cachi                                                                              ng feature requires this)
Compress::Zlib       :    2.008 : OK
Convert::TNEF        :      N/A : NOT INSTALLED (required by Maia Mailguard)
Convert::UUlib       :      N/A : NOT INSTALLED (required by Maia Mailguard)
Crypt::Blowfish      :      N/A : NOT INSTALLED (Maia Mailguard's optional encry                                                                              ption feature requires this)
Crypt::CBC           :      N/A : NOT INSTALLED (Maia Mailguard's optional encry                                                                              ption feature requires this)
Crypt::OpenSSL::RSA  :      N/A : NOT INSTALLED (SpamAssassin's optional DomainK                                                                              eys plugin requires this)
Data::UUID           :      N/A : NOT INSTALLED (required by Maia Mailguard)
DB_File              :    1.814 : OK
DBD::mysql           :    4.005 : OK
DBD::Pg              :      N/A : NOT INSTALLED (required if you use PostgreSQL                                                                               as your Maia Mailguard database)
DBI                  :    1.601 : OK
Digest::MD5          :     2.36 : OK
Digest::SHA1         :     2.11 : OK
File::Spec           :     3.12 : OK
HTML::Parser         :     3.56 : OK
HTTP::Date           :     1.47 : OK
IO::Stringy          :      N/A : NOT INSTALLED (required by Maia Mailguard)
IO::Zlib             :     1.04 : OK
IP::Country          :      N/A : NOT INSTALLED (SpamAssassin's optional RelayCo                                                                              untry plugin requires this)
LWP::UserAgent       :    2.036 : OK
Mail::Address        :      N/A : NOT INSTALLED (SpamAssassin's optional DomainK                                                                              eys plugin requires this)
Mail::DomainKeys     :      N/A : NOT INSTALLED (SpamAssassin's optional DomainK                                                                              eys plugin requires this)
Mail::Internet       :      N/A : NOT INSTALLED (required by Maia Mailguard)
Mail::SpamAssassin   :    3.2.4 : OK
Mail::SPF::Query     :      N/A : NOT INSTALLED (SpamAssassin's optional SPF plu                                                                              gin requires this)
MIME::Base64         :     3.07 : OK
MIME::Parser         :      N/A : NOT INSTALLED (required by Maia Mailguard)
MIME::QuotedPrint    :     3.07 : OK
Net::CIDR::Lite      :      N/A : NOT INSTALLED (SpamAssassin's optional SPF plu                                                                              gin requires this)
Net::DNS             :     0.63 : OK
Net::Server          :      N/A : NOT INSTALLED (required by Maia Mailguard)
Net::SMTP            :     2.29 : OK
Pod::Usage           :     1.33 : OK
Template             :      N/A : NOT INSTALLED (required by Maia Mailguard)
Time::HiRes          :     1.86 : OK
Unix::Syslog         :      N/A : NOT INSTALLED (required by Maia Mailguard)
URI                  :     1.35 : OK

Database DSN test    : PASSED

Beberapa paket yang perlu diinstall untuk melengkapi test diatas.

apt-get install 
libcompress-zlib-perl 
libio-zlib-perl 
libarchive-tar-perl 
libarchive-zip-perl 
libberkeleydb-perl 
libconvert-binhex-perl 
libio-stringy-perl 
libnet-perl 
libtimedate-perl 
libmailtools-perl 
libmime-perl 
libconvert-tnef-perl 
libconvert-uulib-perl 
libio-multiplex-perl 
libnet-server-perl 
libunix-syslog-perl 
libtemplate-perl 
libcrypt-blowfish-perl 
libcrypt-cbc-perl 
libwww-perl 
libossp-uuid-perl 
libdbd-pg-perl 
file

Jalankan kembali test script diatas. Catat bagian yang statusnya masih NOT INSTALLED atau UPGRADE RECOMMENDED.

/var/amavisd/maia/scripts/configtest.pl

Jika masih ada bagian yang failed, kita perlu install modul perl secara manual dari CPAN. Untuk itu kita perlu install beberapa paket ubuntu agar installasi dari CPAN bisa berjalan dengan baik.

apt-get install gcc g++ make autoconf ncftp lynx unzip libssl-dev

Setelah semuanya terinstall, install modul perl yang diperlukan. Lihat modul yang statusnya masih NOT INSTALLED atau UPGRADE RECOMMENDED.

perl -MCPAN -e 'install Crypt::OpenSSL::RSA'
perl -MCPAN -e 'install IP::Country'
perl -MCPAN -e 'install Mail::DomainKeys'
perl -MCPAN -e 'install Mail::SPF::Query'

Load your SpamAssassin rules

/var/amavisd/maia/scripts/load-sa-rules.pl

Script ini berfungsi untuk weight spamassassin ke mysql, jalankan script ini setiap kali menambah rule spamassassin.
Misal seperti panduan berikut memperkaya rule spamassassin.

Install the PHP scripts

cp -Rp /opt/sources/maia-1.0.1/php /var/www/maia
chown -R root:root /var/www/maia
chown -R www-data:www-data /var/www/maia/themes

Install the Smarty Template Engine

apt-get install smarty

Maia mencari smarty di ${phplibdir}/Smarty. Sedangkan default installasi ubuntu menginstall smarty di /usr/share/php/smarty Solusi utk masalah ini adalah dengan membuat softlink.

ln -s /usr/share/php/smarty /usr/share/php/Smarty

Configure Maia Mailguard: Database and Authentication
Lihat point no 8 di http://www.maiamailguard.com/maia/wiki/Install.

Tetapi karena kebutuhan instalasi default, di tutorial ini sudah cukup dengan konfigurasi default dari file config.php.dist

cd /var/www/maia/
cp config.php.dist config.php
cd -

Test your PHP and database configuration
Browse ke http://localhost/maia/admin/configtest.php, ubah alamat url dengan alamat server anda.
Periksa apakah ada beberapa bagian yang masih FAILED.

Untuk melengkapi test diatas, kita perlu melakukan installasi modul PHP.

apt-get install php5-mysql  php-pear php5-gd php5-mcrypt php5-imap php5-ldap php5-pgsql

Setelah installasi selesai, restart apache.

/etc/init.d/apache2 restart

Juga beberapa modul dari PEAR.

pear install Mail_Mime
pear install DB
pear install DB_Pager
pear install Log
pear install Net_SMTP
pear install Net_IMAP
pear install Net_POP3
pear install Auth_SASL

Test instalasi Maia
Untuk melakukan test maia silakan browsing ke http://localhost/maia.
Sesuaikan dengan alamat server anda.

Pada pertama kali login, maia akan meminta login.
Untuk membuat login user pertama kali dengan cara browsing ke http://localhost/maia/internal-init.php

Pastikan memasukkan alamat email user yang benar dan pengiriman email.

Dan untuk alamat template di isi dengan alamat full path lokasi file newuser.tpl

Pastikan tidak ada pesan error, pada saat pengiriman password ke email user.

Setelah email diterima, maka user tadi dapat diangkat menjadi super-administrator dengan mendaptarkannya ke http://localhost/maia/login.php?super=register

Install Amavisd-Maia
Install Pre-Requisites Ubuntu Package for amavisd-maia

apt-get install nomarch gzip bzip2 lzop lha arj unrar zoo pax cpio cabextract

Copy Sources File

cp amavisd-maia /usr/local/sbin/
chown root /usr/local/sbin/amavisd-maia
chmod 755 /usr/local/sbin/amavisd-maia

Generate your site’s encryption key (optional)

/var/amavisd/maia/scripts/generate-key.pl > /var/amavisd/blowfish.key

Configure amavisd-maia

cp /opt/sources/maia-1.0.1/amavisd.conf.dist /etc/amavisd.conf

Kemudian edit, sesuai kebutuhan.

vi /etc/amavisd.conf

Pastikan koneksi amavis dengan mysql sudah benar user dan passwordnya.

Install & Configure ClamAV

apt-get install clamav clamav-daemon clamav-freshclam

Edit konfigurasi ClamAV
Ada beberapa file yang perlu di edit, agar clamav bisa digunakan oleh Maia Mailguard.
Ganti user clamav menjadi amavis.

vi /etc/clamav/clamd.conf
vi /etc/clamav/freshclam.conf
vi /etc/logrotate.d/clamav-daemon
vi /etc/logrotate.d/clamav-freshclam

Fix Ownership

chown -R amavis:amavis /var/run/clamav
chown -R amavis:amavis /var/lib/clamav
chown -R amavis:amavis /var/log/clamav

1 Comment

  • At 2009.01.15 19:13, dirikoe said:

    mas mo nanya nehh.. saya install maia sesuai petunjuk diatas. pas saya browsing ke http://localhost/maia/ selalu error. dan saya ke http://localhost/maia/admin/configtest.php ada beberapa masalah seperti dibawah ini.

    PEAR::DB FAILED: Could not connect to database. Check the mysql://amavis:passwd@tcp(localhost:3306)/maia setting in config.php.
    PEAR::DB_Pager OK: 0.7
    PEAR::Net_Socket OK: 1.0.9
    PEAR::Net_SMTP OK: 1.3.2
    PEAR::Auth_SASL OK: 1.0.2
    PEAR::Net_IMAP SKIPPED: A bug exists in Net_IMAP 1.0.3 when run under PHP 5, see https://secure.renaissoft.com/maia/ticket/266 for more details.
    PEAR::Net_POP3 OK: 1.3.6
    PEAR::Log OK: 1.11.3
    IMAP library OK: 2004
    LDAP library OK
    MCrypt library OK: 2.5.7 with Blowfish and CBC
    BC math library OK
    gd graphics library OK: 2.0 or higher

    trus saya coba install
    root@webmail:~# pear install DB ada masalah di sini
    PHP Warning: Module ‘mysql’ already loaded in Unknown on line 0
    Ignoring installed package pear/DB
    Nothing to install

    mohon pencerahannya..

    terimakasih

    (Required)
    (Required, will not be published)