Linux Mail

qmail + vpopmail + mysql 설치

2009.05.12 23:27

HOSTWAY 조회 수:16361

qmail + vpopmail + mysql 설치

이용되는 파일들은 등에서 다운로드한다.

# 각각의 소스의 error.h 파일의 상단에 아래 라인을 추가합니다.

#include "errno.h"

1. sendmail 구동을 종료
[root@localhost root]# /etc/init.d/sendmail stop

2. qmail 설치
[root@localhost root]# tar zxvf qmail-1.03.tar.gz
[root@localhost root]# cd qmail-1.03
[root@localhost root]# mkdir /var/qmail
[root@localhost root]# groupadd nofiles
[root@localhost root]# useradd -g nofiles -d /var/qmail/alias alias
[root@localhost root]# useradd -g nofiles -d /var/qmail qmaild
[root@localhost root]# useradd -g nofiles -d /var/qmail qmaill
[root@localhost root]# useradd -g nofiles -d /var/qmail qmailp
[root@localhost root]# groupadd qmail
[root@localhost root]# useradd -g qmail -d /var/qmail qmailq
[root@localhost root]# useradd -g qmail -d /var/qmail qmailr
[root@localhost root]# useradd -g qmail -d /var/qmail qmails
[root@localhost root]# cp -a /usr/local/mysql/include/mysql /usr/include
[root@localhost root]# cp /usr/local/mysql/lib/mysql/* /usr/lib
[root@localhost root]# mkdir /usr/lib/mysql/
[root@localhost root]# ln -s /usr/lib/libmysqlclient.a /usr/lib/mysql/libmysqlclient.a
[root@localhost root]# make
[root@localhost root]# make setup check
[root@localhost root]# ./config-fast

[root@localhost root]# cd ../
[root@localhost root]# tar xzvf ucspi-tcp-0.88.tar.gz
[root@localhost root]# cd ucspi-tcp-0.88
[root@localhost root]# make
[root@localhost root]# make setup check

[root@localhost root]# cd ../
[root@localhost root]# mkdir -p /package
[root@localhost root]# chmod 1755 /package
[root@localhost root]# tar zxvf daemontools-0.76.tar.gz
[root@localhost root]# mv admin/ /package/
[root@localhost root]# cd /package/admin/daemontools-0.76/
[root@localhost root]# ./package/install

[root@localhost root]# cd ~
[root@localhost root]# tar zxvf autorespond-2.0.2.tar.gz
[root@localhost root]# cd autorespond-2.0.2
[root@localhost root]# make
[root@localhost root]# cp autorespond /usr/local/bin/

[root@localhost root]# vi /var/qmail/rc
    exec env - PATH="/var/qmail/bin:$PATH"
    qmail-start ./Maildir/

[root@localhost root]# chmod a+x /var/qmail/rc
[root@localhost root]# mkdir -p /var/qmail/supervise/qmail-send/log
[root@localhost root]# mkdir -p /var/qmail/supervise/qmail-smtpd/log
[root@localhost root]# chmod +t /var/qmail/supervise/qmail-send
[root@localhost root]# chmod +t /var/qmail/supervise/qmail-smtpd
[root@localhost root]# vi /var/qmail/supervise/qmail-send/run
    exec /var/qmail/rc

[root@localhost root]# vi /var/qmail/supervise/qmail-send/log/run
    exec /usr/local/bin/setuidgid qmaill
    /usr/local/bin/multilog t /var/log/qmail

[root@localhost root]# vi /var/qmail/supervise/qmail-smtpd/run
    Q_UID=`id -u vpopmail`
    Q_GID=`id -g vpopmail`
    exec /usr/local/bin/softlimit -m 8000000
          /usr/local/bin/tcpserver -vRHl 0
          -x /home/vpopmail/etc/tcp.smtp.cdb
          -u $Q_UID -g $Q_GID 0 25 /var/qmail/bin/qmail-smtpd
          /home/vpopmail/bin/vchkpw /bin/true 2>&1

[root@localhost root]# vi /var/qmail/supervise/qmail-smtpd/log/run
    exec /usr/local/bin/setuidgid qmaill
         /usr/local/bin/multilog t /var/log/qmail/smtpd

[root@localhost root]# chmod 755 /var/qmail/supervise/qmail-send/run
[root@localhost root]# chmod 755 /var/qmail/supervise/qmail-send/log/run
[root@localhost root]# chmod 755 /var/qmail/supervise/qmail-smtpd/run
[root@localhost root]# chmod 755 /var/qmail/supervise/qmail-smtpd/log/run
[root@localhost root]# mkdir -p /var/log/qmail/smtpd
[root@localhost root]# chown qmaill /var/log/qmail /var/log/qmail/smtpd
[root@localhost root]# echo > /var/qmail/alias/.qmail-root
[root@localhost root]# echo > /var/qmail/alias/.qmail-postmaster
[root@localhost root]# echo > /var/qmail/alias/.qmail-mailer-daemon
[root@localhost root]# cd /var/qmail/alias/
[root@localhost root]# chmod 644 .qmail-root .qmail-postmaster .qmail-mailer-daemon

[root@localhost root]# vi /etc/init.d/qmail

# For Red Hat chkconfig
# chkconfig: - 80 30
# description: the qmail MTA

export PATH

case "$1" in
    echo "Starting qmail"
     if [ -e /service/qmail-send ] ; then
         if svok /service/qmail-send ; then
            svc -u /service/qmail-send
            echo qmail-send supervise not running
         ln -s /var/qmail/supervise/qmail-send /service/

     if [ -e /service/qmail-smtpd ] ; then
         if svok /service/qmail-smtpd ; then
            svc -u /service/qmail-smtpd
            echo qmail-smtpd supervise not running
         ln -s /var/qmail/supervise/qmail-smtpd /service/
    if [ -d /var/lock/subsys ]; then
      touch /var/lock/subsys/qmail
   killall readproctitle > /dev/null 2>&1
    echo "Stopping qmail..."
    echo "  qmail-smtpd"
    svc -dx /service/qmail-smtpd /service/qmail-smtpd/log
     rm -f /service/qmail-smtpd
    echo "  qmail-send"
    svc -dx /service/qmail-send /service/qmail-send/log
     rm -f /service/qmail-send
    if [ -f /var/lock/subsys/qmail ]; then
      rm /var/lock/subsys/qmail
    svstat /service/qmail-send
    svstat /service/qmail-send/log
    svstat /service/qmail-smtpd
    svstat /service/qmail-smtpd/log
    echo "Flushing timeout table and sending ALRM signal to qmail-send."
    svc -a /service/qmail-send
    echo "Sending HUP signal to qmail-send."
    svc -h /service/qmail-send
    echo "Pausing qmail-send"
    svc -p /service/qmail-send
    echo "Pausing qmail-smtpd"
    svc -p /service/qmail-smtpd
    echo "Continuing qmail-send"
    svc -c /service/qmail-send
    echo "Continuing qmail-smtpd"
    svc -c /service/qmail-smtpd
    echo "Restarting qmail:"
    echo "* Stopping qmail-smtpd."
    svc -d /service/qmail-smtpd
    echo "* Sending qmail-send SIGTERM and restarting."
    svc -t /service/qmail-send
    echo "* Restarting qmail-smtpd."
    svc -u /service/qmail-smtpd
    tcprules /home/vpopmail/etc/tcp.smtp.cdb /home/vpopmail/etc/tcp.smtp.tmp < /home/vpopmail/etc/tcp.smtp
    chmod 644 /home/vpopmail/etc/tcp.smtp.cdb
    echo "Reloaded /home/vpopmail/etc/tcp.smtp."
    cat <<HELP
   stop -- stops mail service (smtp connections refused, nothing goes out)
  start -- starts mail service (smtp connection accepted, mail can go out)
  pause -- temporarily stops mail service (connections accepted, nothing leaves)
   cont -- continues paused mail service
   stat -- displays status of mail service
    cdb -- rebuild the tcpserver cdb file for smtp
restart -- stops and restarts smtp, sends qmail-send a TERM & restarts it
doqueue -- schedules queued messages for immediate delivery
 reload -- sends qmail-send HUP, rereading locals and virtualdomains
  queue -- shows status of queue
   alrm -- same as doqueue
  flush -- same as doqueue
    hup -- same as reload
    echo "Usage: $0 {start|stop|restart|doqueue|flush|reload|stat|pause|cont|cdb|queue|help}"
    exit 1

exit 0

[root@localhost root]# chmod 700 /etc/init.d/qmail
[root@localhost root]# chkconfig --add qmail

3. vpopmail 설치
[root@localhost root]# groupadd vchkpw
[root@localhost root]# useradd -g vchkpw vpopmail
[root@localhost root]# cd ~
[root@localhost root]# tar zxvf vpopmail-5.4.10.tar.gz
[root@localhost root]# cd vpopmail-5.4.10
[root@localhost root]# ./configure --enable-auth-module=mysql --enable-tcprules-prog=/usr/local/bin/tcprules --enable-relay-clear-minutes=15
[root@localhost root]# make
[root@localhost root]# make install-strip
[root@localhost root]# vi ~vpopmail/etc/defaultdomain

[root@localhost root]# vi ~vpopmail/etc/vpopmail.mysql

[root@localhost root]# echo ",RELAYCLIENT=""" > ~vpopmail/etc/tcp.smtp
[root@localhost root]# echo "qmail을설치한서버의아이피:allow,RELAYCLIENT=""" >> ~vpopmail/etc/tcp.smtp
[root@localhost root]# mkdir /var/qmail/supervise/vpop
[root@localhost root]# vi /var/qmail/supervise/vpop/run
    VPOP_UID=`id -u vpopmail`
    VPOP_GID=`id -g vpopmail`

    exec /usr/local/bin/softlimit -m 5000000
         tcpserver -vRHl 0 -u $VPOP_UID -g $VPOP_GID 0 110
         /home/vpopmail/bin/vchkpw /var/qmail/bin/qmail-pop3d Maildir 2>&1

[root@localhost root]# chmod 755 /var/qmail/supervise/vpop/run
[root@localhost root]# mv /usr/lib/sendmail /usr/lib/sendmail.old
[root@localhost root]# mv /usr/sbin/sendmail /usr/sbin/sendmail.old
[root@localhost root]# ln -s /var/qmail/bin/sendmail /usr/lib
[root@localhost root]# ln -s /var/qmail/bin/sendmail /usr/sbin
[root@localhost root]# ln -s /var/qmail/supervise/qmail-send /service/
[root@localhost root]# ln -s /var/qmail/supervise/qmail-smtpd /service/
[root@localhost root]# ln -s /var/qmail/supervise/vpop /service

[root@localhost root]# /etc/init.d/qmail cdb
[root@localhost root]# /etc/init.d/qmail start

예) 기본 도메인에 사용자 추가
[root@localhost root]# cd /home/vpopmail/bin
[root@localhost root]# ./vadduser

예) 새로운 도메인을 추가
[root@localhost root]# ./vadddomain

번호 제목 글쓴이 날짜 조회 수
34 clamav antivirus + milter 구성 HOSTWAY 2009.05.12 42127
33 sendmail로 메일서버 구축하기 sylee 2008.05.15 35478
32 sendmail 기반의 email 계정 생성 및 추가 하기 sylee 2009.06.20 29095
31 메일 발송시 host name lookup failure 에러 sylee 2008.05.20 27919
30 아웃룩에서 발생될 수 있는 에러 메세지 jook 2008.05.21 26611
29 sendmail 설정 tip 호스트웨이 2008.05.19 24476
28 다람쥐메일(squirrelmail) 사용하기 jook 2009.04.09 23642
27 메일 발송시 리턴 에러 메세지들 sylee 2008.12.03 22872
26 php에서 mail(); 함수가 정상적으로 구동중인지 확인 방법 hostway 2008.05.14 22783
25 debian(ubuntu) postfix 메일 서버 설정 HOSTWAY 2009.05.12 22442
24 sendmail + dovecot 메일 서버 구성 HOSTWAY 2009.05.12 18430
» qmail + vpopmail + mysql 설치 HOSTWAY 2009.05.12 16361
22 spamassassin 필터 설치하기 HOSTWAY 2009.05.12 15249
21 Dovecot Time moved backwards error jook 2009.06.29 13622
20 Sendmail Queue에 쌓인 메일 강제 발송 호스트웨이 2012.06.15 13247
19 Sendmail - Spam 발송 계정 및 IP 확인하기 호스트웨이 2012.09.14 11447
18 리눅스 터미널에서 파일 첨부 하기 호스트웨이 2012.08.23 10592
17 리눅스에서 /etc/aliases 를 이용하여 같은메일 여러 사용자가 수신 호스트웨이 2012.07.27 8903
16 dovecot 에러 예제 호스트웨이 2012.03.27 8598
15 Dovecot에서 “Error indexing mbox file (LF not found)” 에러 발생시 해결 방법 호스트웨이 2012.06.29 8436