Articles Comments

{ Berbagi, Menulis, Dan Mengajar } Ilmu… » Free-BSD » installing Qmail on FreeBSD in 5 Minutes

installing Qmail on FreeBSD in 5 Minutes

FreeBSD Qmail Server…
asalamualaikum wr wb
This is a quick installation of Qmail on FreeBSD Operating System …
————————
Do like this,
follow the step by step,
less than 5 minutes we can build a mail server….
Good Luck …!!!
wasalam wr wb
—————————
# cd /usr/ports/mail/qmail
# make enable-qmail WITH_QMAILQUEUE_PATCH=yes WITH_BIG_TODO_PATCH=yes
# make clean
# cd /usr/ports/sysutils/ucspi-tcp
# make all install clean

# cd /usr/ports/security/checkpassword
# make all install clean
# echo “OPTIONAL_MANPATH /var/qmail/man” >> /etc/manpath.config
# makewhatis
# echo “127.0.0.1:allow,RELAYCLIENT=\”\”” > /etc/tcp.smtp

# echo “192.168.0.:allow,RELAYCLIENT=\”\”” >> /etc/tcp.smtp
# echo :allow >> /etc/tcp.smtp
# /usr/local/bin/tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp

EDIT dot.cshrc

Find the following line in dot.cshrc:

set mail = (/var/mail/$USER)

and modify the file as follows:

#set mail = (/var/mail/$USER)
setenv MAIL ~/Mailbox
setenv MAILDIR ~/Maildir
setenv MAILTMP ~/Maildir/tmp/tmpfile
alias mail '/var/qmail/bin/maildir2mbox;/var/qmail/bin/qail'
alias pine '/var/qmail/bin/maildir2mbox;/var/qmail/bin/pinq'
alias elm '/var/qmail/bin/maildir2mbox;/var/qmail/bin/elq'

EDIT dot.shrc

Append the following lines to the end of dot.shrc

MAIL=~/Mailbox
MAILDIR=~/Maildir
MAILTMP=~/Maildir/tmp/tmpfile
export MAIL MAILDIR MAILTMP
alias mail='/var/qmail/bin/maildir2mbox;/var/qmail/bin/qail'
alias pine='/var/qmail/bin/maildir2mbox;/var/qmail/bin/pinq'
alias elm='/var/qmail/bin/maildir2mbox;/var/qmail/bin/elq'

EDIT dot.qmail

Create the file dot.qmail and add this line:

./Maildir/

* Maildir

Execute the following command to make the Maildir directory:

# /var/qmail/bin/maildirmake /usr/share/skel/Maildir

* Create Maildir and .qmail

Execute the following commands for each existing user:

# cp -R /usr/share/skel/Maildir ~USERSNAME/
# chown -R USERSNAME ~USERSNAME/Maildir
# cp /usr/share/skel/dot.qmail ~USERSNAME/.qmail
# chown USERSNAME ~USERSNAME/.qmail

# qmail options
qmail_smtp_enable="YES"
qmail_pop_enable="YES"
qmail_enable="YES"

Create /var/qmail/rc:

#!/bin/sh

#
# This script starts and stops the qmail mail functions.
#

# Suck in the configuration variables.
if [ -r /etc/defaults/rc.conf ]; then
. /etc/defaults/rc.conf
source_rc_confs
elif [ -r /etc/rc.conf ]; then
. /etc/rc.conf
fi

case "$1" in
start)
case ${qmail_smtp_enable} in
[Yy][Ee][Ss])
# Start the qmail smtp daemon
/usr/local/bin/tcpserver -H -R -c 255 -x /etc/tcp.smtp.cdb \
-u 82 -g 81 0 25 /var/qmail/bin/qmail-smtpd &
echo -n " qmail-smtp"
;;
esac

case ${qmail_pop_enable} in
[Yy][Ee][Ss])
# Start the qmail pop daemon
/usr/local/bin/tcpserver -H -R -c 255 0 110 \
/var/qmail/bin/qmail-popup HOSTNAME.DOMAIN \
/usr/local/bin/checkpassword /var/qmail/bin/qmail-pop3d \
Maildir &
echo -n " qmail-pop"
;;
esac

case ${qmail_enable} in
[Yy][Ee][Ss])
# Start qmail
exec env - PATH="/var/qmail/bin:$PATH" \
qmail-start ./Maildir splogger qmail &
echo -n " qmail"
;;
esac
;;
stop)
# Stop the smtp daemon
smtppid=`ps -axw | grep tcpserver | grep smtp | grep -v grep | awk '{ print $1 }'`
if [ "$smtppid" != "" ]; then
kill $smtppid
echo -n " qmail-smtp"
fi

# Stop the pop daemon
poppid=`ps -axw | grep tcpserver | grep popup | grep -v grep | awk '{ print $1 }'`
if [ "$poppid" != "" ]; then
kill $poppid
echo -n " qmail-pop"
fi

# Stop qmail
qmailpid=`ps -axw | grep qmail-send | grep -v grep | awk '{ print $1 }'`
if [ "$qmailpid" != "" ]; then
kill $qmailpid
echo -n " qmail"
fi
;;
*)
echo "Usage: `basename $0` {start|stop}" >&2
;;
esac

exit 0

chmod 750 /var/qmail/rc
# echo HOSTNAME.DOMAIN > /var/qmail/control/me
# echo HOSTNAME.DOMAIN > /var/qmail/control/rcpthosts
# echo DOMAIN >> /var/qmail/control/rcpthosts
# echo HOSTNAME.DOMAIN > /var/qmail/control/locals
# echo DOMAIN >> /var/qmail/control/locals
# echo HOSTNAME > /var/qmail/control/defaulthost
# echo DOMAIN > /var/qmail/control/defaultdomain
# echo DOMAIN > /var/qmail/control/plusdomain
# echo EMAILADDRESS > /var/qmail/alias/.qmail-root
# killall sendmail
# rm /var/run/sendmail.pid
# /usr/local/etc/rc.d/qmail.sh start
# ps -ax | grep tcpserver
# ps -ax | grep qmail
.:GoodLuck:.

Filed under: Free-BSD

Leave a Reply

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>