Qmail on Centos 5

qmail

Hi its been a long time i never update my blog,the first intention for creating this blog is for my own personal notes which regard to my daily work and interest,so this small little will be shared among my friends and hopefully all of us can learn something towards betterment of our knowledge.finally this tutorial i would like to dedicated to my friend Mr Dasari Chandrasekhar

so for now i would like to share my experience installing qmail in RedHat Based os,as im writing this blog im using Centos 5

requirement

o qmail, http://www.ehost.com.my/qmail/netqmail-1.06.tar.gz

o ucspi-tcp, http://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz

o daemontools, http://cr.yp.to/daemontools/daemontools-0.76.tar.gz

mv netqmail-1.06.tar.gz ucspi-tcp-0.88.tar.gz daemontools-0.76.tar.gz /usr/local/src

cd /usr/local/src

mkdir package

mv daemontools-0.76.tar.gz /package

#There should now be directories called /usr/local/src/netqmail-1.06,/usr/local/src/ucspi-tcp-0.88, and /package/admin/daemontools-0.76.

##Create directories##

mkdir /var/qmail

mkdir /etc/qmail

ln -s /etc/qmail /var/qmail/control

##Create users and groups

cd /usr/local/src/netqmail-1.06

cp INSTALL.ids IDS

#and edit IDS file that match with your operating system,im using linux and this is how my IDS file look

groupadd nofiles

useradd -g nofiles -d /var/qmail/alias alias

useradd -g nofiles -d /var/qmail qmaild

useradd -g nofiles -d /var/qmail qmaill

useradd -g nofiles -d /var/qmail qmailp

groupadd qmail

useradd -g qmail -d /var/qmail qmailq

useradd -g qmail -d /var/qmail qmailr

useradd -g qmail -d /var/qmail qmails

#Then to run it, either use chmod to make it executable or run it with

sh:

#first method

chmod 700 IDS

./IDS

#second method

/bin/sh IDS

#check gid was properly assigned in /etc/group,this gid have to be the same with user qmailq,qmailr and qmails

#gid qmail in your /etc/group should be like this

qmail:x:503:

#and user qmailq,qmailr and qmails in your /etc/passwd should be like this

alias:x:502:502::/var/qmail

/alias:/bin/true

qmaild:x:503:502::/var/qmail:/bin/true

qmaill:x:504:502::/var/qmail:/bin/true

qmailp:x:505:502::/var/qmail:/bin/true

qmailq:x:506:503::/var/qmail:/bin/true

qmailr:x:507:503::/var/qmail:/bin/true

qmails:x:508:503::/var/qmail:/bin/true#tips – doesnt really matter what gid assigned for group qmail,as long user qmailq,qmailr and qmails is part of qmail group it should be fine

#building the qmail begin here

cd /usr/local/src/netqmail-1.06

make setup check

.#make setup check process will be done less than 2 minute.for your info im using celeron 1ghz with 256mb of ram.the processing time could be vary.everything is depends on your system

#After the build is complete, you’ll need to do your post installation

#configuration. A couple of scripts are provided to make this job a lot

#easier.

#If your DNS is configured properly, this script should be all you need

#at this point:

./config

#If, for some reason, config can’t find your hostname in DNS, you’ll

#have to run the config-fast script:

./config-fast the.full.hostname

#For example, if your domain is example.com and the hostname of your

#computer is dolphin, your config-fast line would look like this:

./config-fast dolphin.example.com

#you should get this output

[root@localhost netqmail-1.06]# ./config-fast pakcik.mooo.com

Your fully qualified host name is pakcik.mooo.com.

Putting pakcik.mooo.com into control/me…

Putting mooo.com into control/defaultdomain…

Putting mooo.com into control/plusdomain…

Putting pakcik.mooo.com into control/locals…

Putting pakcik.mooo.com into control/rcpthosts…

Now qmail will refuse to accept SMTP messages except to pakcik.mooo.com.

Make sure to change rcpthosts if you add hosts to locals or virtualdomains!

[root@localhost netqmail-1.06]#

#Install ucspi-tcp

cd /usr/local/src/ucspi-tcp-0.88

patch < /usr/local/src/netqmail-1.06/other-patches/ucspi-tcp-0.88.errno.patch

make

make setup check

#That’s it. ucspi-tcp is installed.

#Install daemontools

cd /usr/local/src/package

tar zxvf daemontools-0.76.tar.gz

cd admin

cd daemontools-0.76

cd src

patch < /usr/local/src/netqmail-1.06/other-patches/daemontools-0.76.errno.patch

cd ..

package/install

#verify svscan process is running in your system

ps -ef | grep svscan

[root@localhost src]# ps -ef | grep svscan

root 8742 1 0 13:44 ? 00:00:00 /bin/sh /command/svscanboot

root 8744 8742 0 13:44 ? 00:00:00 svscan /service

root 8842 8755 0 13:51 pts/2 00:00:00 grep svscan

#save this file as rc into /var/qmail/rc

———–start-here———————————–

#!/bin/sh

# Using stdout for logging

# Using control/defaultdelivery from qmail-local to deliver messages by default

exec env – PATH=”/var/qmail/bin:$PATH” \

qmail-start “`cat /var/qmail/control/defaultdelivery`”

——————-end-here——————————-

chmod 755 /var/qmail/rc

mkdir /var/log/qmail

echo ./Mailbox >/var/qmail/control/defaultdelivery

##The qmailctl script##

#copy the script from here http://mambang.org/uploads/uploaders/qmailctl.txt and save it in /var/qmail/bin/qmailctl

chmod 755 /var/qmail/bin/qmailctl

ln -s /var/qmail/bin/qmailctl /usr/bin

#The supervise scripts#

Now create the supervise directories for the qmail services:

mkdir -p /var/qmail/supervise/qmail-send/log

mkdir -p /var/qmail/supervise/qmail-smtpd/log

#Create the /var/qmail/supervise/qmail-send/run file:

#!/bin/sh

exec /var/qmail/rc

Create the /var/qmail/supervise/qmail-send/log/run file:

#!/bin/sh

exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t /var/log/qmail

Create the /var/qmail/supervise/qmail-smtpd/run file:

———————-start-here—————————–

#!/bin/sh

QMAILDUID=`id -u qmaild`

NOFILESGID=`id -g qmaild`

MAXSMTPD=`cat /var/qmail/control/concurrencyincoming`

LOCAL=`head -1 /var/qmail/control/me`

if [ -z “$QMAILDUID” -o -z “$NOFILESGID” -o -z “$MAXSMTPD” -o -z “$LOCAL” ]; then

echo QMAILDUID, NOFILESGID, MAXSMTPD, or LOCAL is unset in

echo /var/qmail/supervise/qmail-smtpd/run

exit 1

fi

if [ ! -f /var/qmail/control/rcpthosts ]; then

echo “No /var/qmail/control/rcpthosts!”

echo “Refusing to start SMTP listener because it’ll create an open relay”

exit 1

fi

exec /usr/local/bin/softlimit -m 2000000 \

/usr/local/bin/tcpserver -v -R -l “$LOCAL” -x /etc/tcp.smtp.cdb -c “$MAXSMTPD” \

-u “$QMAILDUID” -g “$NOFILESGID” 0 smtp /var/qmail/bin/qmail-smtpd 2>&1

——————end-here————————————————–

Create the concurrencyincoming control file:

echo 20 > /var/qmail/control/concurrencyincoming

chmod 644 /var/qmail/control/concurrencyincoming

#Create the /var/qmail/supervise/qmail-smtpd/log/run file:

—————————–start-here—————————

#!/bin/sh

exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t /var/log/qmail/smtpd

———————–end-here—————————————

#Make the run files executable:

chmod 755 /var/qmail/supervise/qmail-send/run

chmod 755 /var/qmail/supervise/qmail-send/log/run

chmod 755 /var/qmail/supervise/qmail-smtpd/run

chmod 755 /var/qmail/supervise/qmail-smtpd/log/run

#Then set up the log directories:

mkdir -p /var/log/qmail/smtpd

chown qmaill /var/log/qmail /var/log/qmail/smtpd

#Finally, link the supervise directories into /service:

ln -s /var/qmail/supervise/qmail-send /var/qmail/supervise/qmail-smtpd /service

so by now you should be able to start your qmail by using this command:
qmailctl start
thanks all for today
Explore posts in the same categories: centos, install

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s


%d blogger menyukai ini: