Setelah cukup lama vacuum dr blog, tiba2 pagi ini sedikit saya ingin menuangkan coretan tentang step by step bagaimana membangun sebuah Email Server.
Email Server yang akan digunakan adalah Qmail dengan OS Linux Redhat *saya pake RHEL AS 3.
Diasumsikan untuk mesin Linux fresh installasi, tanpa ada Qmail terinstall sebelumnya.
Tulisan ini saya sadur dari www.qmailrocks.org yang telah saya ringkas sehingga lebih memudahkan terutama bagi para newbie *karena pada intinya saya juga seorang newbie.
Semoga bermanfaat, dan selamat menikmati :
INSTALASI QMAILROCKS
A. Pre Install :
Konfigurasi partisi (minimal) :
* / –> 70MB
* /var –> 10MB
* /home –> 3MB
* free –> 80 s.d 90 MB
Yang harus sudah terinstall :
* Apache Web Server –> version 1.3 atau 2
* PHP –> version 4.0.6 or higher
* Perl –> any version of 5
* GCC
* OpenSSL –> version 0.9.5a or higher
* OpenSSL - devel –> for redhat
* wget
* patch & patchutils
Yang harus uninstall :
* Postfix
* POP Service
* SMTP Service
Firewall : dibuka saja dulu semuanya
B. Download Software :
* mkdir /downloads
* cd /downloads
* wget http://www.qmailrocks.org/download/qmailrocks.tar.gz
* tar zxvf qmailrocks.tar.gz
C. Instalasi :
* /downloads/qmailrocks/scripts/install/qmr_install_linux-s1.script
* /downloads/qmailrocks/scripts/util/qmail_big_patches.script
* cd /usr/src/qmail/qmail-1.03
* make man && make setup check
* ./config-fast artindo.co.id
* make cert
* Contoh configurasi cert :
Country Name (2 letter code) [GB]:US
State or Province Name (full name) [Berkshire]:Georgia
Locality Name (eg, city) [Newbury]:Atlanta
Organization Name (eg, company) [My Company Ltd]:qmailrocks.org
Organizational Unit Name (eg, section) []:mail
Common Name (eg, your name or your server’s hostname) []:mail.qmailrocks.org
Email Address []:postmaster@thisdomain.org
* Jika berhasil, akan otomatis terinstall di /var/qmail/control/servercert.pem, lihat juga di /var/qmail/control/clientcert.pem
* chown -R vpopmail:qmail /var/qmail/control/clientcert.pem /var/qmail/control/servercert.pem
* cd /usr/src/qmail/ucspi-tcp-0.88/
* patch < /downloads/qmailrocks/patches/ucspi-tcp-0.88.errno.patch
* make && make setup check
* cd /package/admin/daemontools-0.76/src
* patch < /downloads/qmailrocks/patches/daemontools-0.76.errno.patch
* cd /package/admin/daemontools-0.76
* package/install
* cd /downloads/qmailrocks/
* tar zxvf ezmlm-0.53-idx-0.41.tar.gz
* cd ezmlm-0.53-idx-0.41
* make && make setup
* cd /downloads/qmailrocks/
* tar zxvf autorespond-2.0.5.tar.gz
* cd autorespond-2.0.5
* make && make install
* cd /downloads/qmailrocks
* tar zxvf vpopmail-5.4.7.tar.gz
* cd vpopmail-5.4.7
* ./configure --enable-logging=p
* make && make install-strip
jika ketemu error spt ini :
If you are using GCC version 3.x, you may get a compilation error similar to this:
In file included from vconvert.c:35:
vmysql.h:53:22: missing terminating " character
vmysql.h:60:35: missing terminating " character
make[2]: *** [vconvert.o] Error 1
If you get this error, you will need to apply a patch to Vpopmail:
* patch < /downloads/qmailrocks/patches/vmysql.patch
Once you've applied the patch, try running "make" and "make install" again and you should be ok.
* make && make install-strip
* cd /downloads/qmailrocks
* tar zxvf vqadmin-2.3.6.tar.gz
* cd vqadmin-2.3.6
* ./configure --enable-cgibindir=/var/www/cgi-bin --enable-htmldir=/var/www/html
* make && make install-strip
* Konfigurasi di httpd.conf
deny from all
Options ExecCGI
AllowOverride AuthConfig
Order deny,allow
* cd /var/www/cgi-bin/vqadmin
* vi .htaccess –> isinya :
AuthType Basic
AuthUserFile /usr/local/apache/.htpasswd
AuthName vQadmin
require valid-user
satisfy any
* chown apache .htaccess (you may need to change the chown to either “nobody”, “apache” or “www” etc., depending on what user your installation of Apache is running as)
* chmod 644 .htaccess
* mkdir /usr/local/apache
* htpasswd -bc /usr/local/apache/.htpasswd admin admin_password
* chmod 644 /usr/local/apache/.htpasswd
* /sbin/service httpd restart
* http://localhost/cgi-bin/vqadmin/vqadmin.cgi
Note: make sure you include “vqadmin.cgi” in the path or you will get a 403 forbidden error!
* cd /downloads/qmailrocks
* tar zxvf maildrop-1.6.3.tar.gz
* cd maildrop-1.6.3
* ./configure –prefix=/usr/local –exec-prefix=/usr/local –enable-maildrop-uid=root –enable-maildrop-gid=vchkpw –enable-maildirquota
* make && make install-strip && make install-man
* cd /downloads/qmailrocks
* tar zxvf qmailadmin-1.2.3.tar.gz
* cd qmailadmin-1.2.3
* ./configure –enable-cgibindir=/var/www/cgi-bin –enable-htmldir=/var/www/html/
note: The paths in the above configure script will need to be custom tailored to your systems configuration
* make && make install-strip
Now browse to http://localhost/cgi-bin/qmailadmin and you should see the login screen. Login with the postmaster account and password for the domain that you created a while back using Vqadmin. Pretty cool, isn’t it? Go ahead and create some additional mailboxes for your domain(s).
If you didn’t get any errors, Qmailadmin should be all set!
note: if it’s late and you’re looking for a place to stop so you can sleep, this is a good place. Sendmail should still be handling mail on the server. After this page it’s Qmail or bust!
* /downloads/qmailrocks/scripts/finalize/linux/finalize_linux.script
* vi /var/qmail/supervise/qmail-pop3d/run
Find “mail.example.com” and change it to your server’s hostname. For example: mail.artindo.co.id
* vi /var/qmail/supervise/qmail-smtpd/run
Find “mail.example.com” and change it to your server’s hostname. For example: mail.artindo.co.id
* qmailctl stop
* echo ‘127.0.0.1:allow,RELAYCLIENT=”"‘ >> /etc/tcp.smtp
* echo ‘192.168.20.:allow,RELAYCLIENT=”"‘ >> /etc/tcp.smtp
* qmailctl cdb
* echo administrator@artindo.co.id > /var/qmail/alias/.qmail-root
* echo administrator@artindo.co.id > /var/qmail/alias/.qmail-postmaster
* echo administrator@artindo.co.id > /var/qmail/alias/.qmail-mailer-daemon
* ln -s /var/qmail/alias/.qmail-root /var/qmail/alias/.qmail-anonymous
* chmod 644 /var/qmail/alias/.qmail*
* Uninstall Sendmail :
* rpm -qa | grep sendmail
If Sendmail is installed as an RPM, you will see an output similar to this:
sendmail-x.x.x.x
sendmail-doc-x.x.x.x
sendmail-devel-x.x.x.x
sendmail-cf-x.x.x.x
If it’s installed as an RPM, you can uninstall Sendmail quite easily by running the followinng commands:
* /etc/rc.d/init.d/sendmail stop (to stop Sendmail)
* rpm -e –nodeps sendmail-x.x.x.x
* rpm -e –nodeps sendmail-doc-x.x.x.x
* rpm -e –nodeps sendmail-devel-x.x.x.x
* rpm -e –nodeps sendmail-cf-x.x.x.x
However, if the RPM query produces no output, you most likely have a source install of Sendmail. In that case…
* /etc/rc.d/init.d/sendmail stop (to stop Sendmail)
* mv /usr/lib/sendmail /usr/lib/sendmail.old
* mv /usr/sbin/sendmail /usr/sbin/sendmail.old
* chmod 0 /usr/lib/sendmail.old /usr/sbin/sendmail.old
* Uninstall Postfix :
* rpm -qa | grep postfix
postfix-x.x-x
* /etc/rc.d/init.d/postfix stop
* rpm -e –nodeps postfix-x.x-x
* ln -s /var/qmail/bin/sendmail /usr/lib/sendmail
* ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail
* /downloads/qmailrocks/scripts/util/qmr_inst_check
If you get a “congratulations” type of message, you’re all set. If you get some errors, just follow the directions to fix the errors and then re-run the script until you get all errors corrected and you get a “congratulations” message.
* qmailctl stop
* qmailctl start
* qmailctl stat
/service/qmail-send: up (pid 29956) 2 seconds
/service/qmail-send/log: up (pid 29960) 2 seconds
/service/qmail-smtpd: up (pid 29963) 2 seconds
/service/qmail-smtpd/log: up (pid 29968) 2 seconds
/service/qmail-pop3d: up (pid 29971) 2 seconds
/service/qmail-pop3d/log: up (pid 29972) 2 seconds
messages in queue: 0
messages in queue but not yet preprocessed: 0
If you, don’t see anything like that or if you see error messages
* Test POP3 service :
* telnet localhost 110
you should see something like this:
Trying 192.168.1.10…
Connected to 192.168.1.10.
Escape character is ‘^]’.
+OK <16658.1054485137@yourserver.com>
user postmaster@mydomain.com (enter your username here. remember to use the full e-mail address)
+OK
pass your_password
+OK
quit
+OK
Connection closed by foreign host.
This is the sign of a successfull POP connection to the server!
* Test kirim email :
* telnet localhost 110
Trying 192.168.1.10…
Connected to 192.168.1.10.
Escape character is ‘^]’.
+OK <16658.1054485137@yourserver.comt>
user postmaster@mydomain.com (again, remember to log in with the full email address of the user)
+OK
pass your_password
+OK
list
+OK
1 323 (there’s your message!)
.
quit
+OK
Connection closed by foreign host.
* Test SMTP service :
* telnet localhost 25
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
220 somewhere.anywhere.com ESMTP
ehlo localhost
250-somewhere.anywhere.com
250-AUTH LOGIN CRAM-MD5 PLAIN
250-AUTH=LOGIN CRAM-MD5 PLAIN
250-STARTTLS
250-PIPELINING
250 8BITMIME
starttls
220 ready for tls
quit
quit
Connection closed by foreign host.
[root@somewhere control]#
* If you happen to get an error that states “454 TLS not available: missing RSA private key (#4.3.0)” after you issue the “starttls” command, you will want to check 2 things:
1) Verify that the cert actually exists at /var/qmail/control/servercert.pem. If it’s not there, go back to step 2 and repeat the cert creation step.
2) Verify that the cert is owned by vpopmail:vchkpw. If it’s not, then make it so like this:
chown vpopmail:qmail /var/qmail/control/servercert.pem
* Instalasi Qmail sukses !!! Lanjutkan dengan instalasi IMAP dan Squirrelmail