[CentOS 5.X 기준] Qmail 설치 netqmail-1.05

CentOS 5.X 기준

[변경 내역]

Date Status By Whom
2015-01-01  Modify  
리눅스에서 메일서버를 구축한다고 했을때 대부분 고려하는것이 sendmail 또는 qmail일 것입니다.

●sendmail : Unix기반 환경에서 오랜기간 사용해 온 대표적인 SMTP 프로그램으로 가장 많이(?) 사용중인 프로그램이다. 
    RPM으로 쉽게 설치할 수 있고, 오랜기간에 거쳐 인터넷상에 많은 자료가 있어 문제해결에 쉽다. 그러나 메일에 대한 
    안정성, 보안의 취약성, 사용자를 추가하기 위해 서버에 계정을 만들어야 하며, 멀티프로세스를 지원하는 qmail에 
    비해 단일 프로세스로 구동되기 때문에 성능상의 이슈등의 단점이 있다. 이중에서 보안상의 취약성은 가장 큰 단점이 
    되고 있다.
●qmail : sendmail의 단점이 곧 qmail의 장점이 될 것이다. 보안성, 신뢰성, 속도, 효율성이 높은 MTA프로그램이다.
    (Sendmail에 비해…).
간단히 qmail의 특징과 장점을 보면 다음과 같다.
    ○보안성 : Sendmail이 처음 만들어졌을때는 높은 보안을 요구하지 않았다, 즉 보안을 고려하지 않은 상태에서 
     만들어진 프로그램이다. 메일이 대중화되면서 보안이 대두되었고, Sendmail은 보안에 취약할 수 밖에 없었다. 
     qmail은 높은 보안을 위해 설계되었다. 그렇기 때문에 보안에 강하다.
    ○신뢰성 : 수신된 메일에 대해서 손실이 없음을 보장한다. 시스템이 다운되더라도 메일을 잃어버리는 경우가 없다.
    ○성능 : qmail은 기본적으로 20건을 동시에 메일을 전송할 수 있다. 그러므로 많은 메일을 동시에 전송해야 하는 
     경우 탁월한 성능을 발휘한다.
    ○효율성 : qmail 다른 어떠한 기능을 가진 MTA보다 작게 설계되었다. 그러므로 낮은 시스템에서도 성능을 발휘 
     할 수 있다.

[설치할  프로그램]
●vpopmai : 가상도메인/유저를 쉽게 관리하는 통합 관리도구로 qmailadmin과 같이 사용하여 모든 관리를 웹으로 편리하게 
    할 수 있는 프로그램.
●qmail-ldap : LDAP와 qmail의 연동을 위한 패키지로 문서와 qmail이 어떻게 메시지를 처리하는지 이해 하는데 도움이 
    되는 그림(big qmail picture)을 제공.
●qmail-scanner : qmail용 메일 바이러스 검사기로 대부분의 유료 바이러스 검사기와 연동하여 사용할 수 있다.
netqmail + vpopmail + patch설치(date-localtime.path + smtpauth.path,…. ) 로 설치하기

netqmail + vpopmail + patch설치(date-localtime.path + smtpauth.path,…. ) 로 설치하기

설치에 필요한 프로그램을은 다음과 같습니다.

Program Ver. Home page Download URL
ucspi-tcp 0.88 http://cr.yp.to/ucspi-tcp.html http://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz
daemontools 0.76 http://cr.yp.to/daemontools.html http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
netqmail 1.05 http://www.qmail.org/top.html http://www.qmail.org/netqmail-1.05.tar.gz
vpopmail 5.4.32 http://www.inter7.com/index.php?page=vpopmail http://nchc.dl.sourceforge.net/sourceforge/vpopmail/vpopmail-5.4.32.tar.gz
   

Qmail 설치
1. Qmail 설치 전 gcc 컴파일러 설치(필수사항)

[root@localhost ~]# gcc --version
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-54)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

1.1 미설치시
[root@localhost ~]# gcc --version
-bash: gcc: command not found

1.1.1 gcc 설치
[root@localhost ~]# yum install gcc
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: centos.mirror.cdnetworks.com
 * extras: centos.mirror.cdnetworks.com
 * updates: ftp.daum.net
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package gcc.i386 0:4.1.2-54.el5 set to be updated
--> Processing Dependency: cpp = 4.1.2-54.el5 for package: gcc
--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc
--> Running transaction check
---> Package cpp.i386 0:4.1.2-54.el5 set to be updated
---> Package glibc-devel.i386 0:2.5-118.el5_10.2 set to be updated
--> Processing Dependency: glibc-headers = 2.5-118.el5_10.2 for package: glibc-devel
--> Processing Dependency: glibc-headers for package: glibc-devel
--> Running transaction check
---> Package glibc-headers.i386 0:2.5-118.el5_10.2 set to be updated
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers
--> Processing Dependency: kernel-headers for package: glibc-headers
--> Running transaction check
---> Package kernel-headers.i386 0:2.6.18-371.9.1.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package              Arch       Version                    Repository     Size
================================================================================
Installing:
 gcc                  i386       4.1.2-54.el5               base          5.2 M
Installing for dependencies:
 cpp                  i386       4.1.2-54.el5               base          2.7 M
 glibc-devel          i386       2.5-118.el5_10.2           updates       2.1 M
 glibc-headers        i386       2.5-118.el5_10.2           updates       611 k
 kernel-headers       i386       2.6.18-371.9.1.el5         updates       1.5 M

Transaction Summary
================================================================================
Install       5 Package(s)
Upgrade       0 Package(s)

Total download size: 12 M
Is this ok [y/N]: y
Downloading Packages:
(1/5): glibc-headers-2.5-118.el5_10.2.i386.rpm           | 611 kB     00:01
(2/5): kernel-headers-2.6.18-371.9.1.el5.i386.rpm        | 1.5 MB     00:02
(3/5): glibc-devel-2.5-118.el5_10.2.i386.rpm             | 2.1 MB     00:02
(4/5): cpp-4.1.2-54.el5.i386.rpm                         | 2.7 MB     00:04
(5/5): gcc-4.1.2-54.el5.i386.rpm                         | 5.2 MB     00:06
--------------------------------------------------------------------------------
Total                                           672 kB/s |  12 MB     00:18
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : kernel-headers                                           1/5
  Installing     : cpp                                                      2/5
  Installing     : glibc-headers                                            3/5
  Installing     : glibc-devel                                              4/5
  Installing     : gcc                                                      5/5

Installed:
  gcc.i386 0:4.1.2-54.el5

Dependency Installed:
  cpp.i386 0:4.1.2-54.el5
  glibc-devel.i386 0:2.5-118.el5_10.2
  glibc-headers.i386 0:2.5-118.el5_10.2
  kernel-headers.i386 0:2.6.18-371.9.1.el5

Complete!

2. sendmail 중지 : sendmail, dovecot, saslauthd 서비스 중지
[root@localhost ~]# service sendmail stop
Shutting down sm-client: [ OK ]
Shutting down sendmail: [ OK ]
[root@localhost ~]# service dovecot stop
Stopping Dovecot Imap: [ OK ]
[root@localhost ~]# service saslauthd stop
Stopping saslauthd: [ OK ]
//부팅시 자동으로 시작되지 않게 설정
[root@localhost ~]# chkconfig --del sendmail
[root@localhost ~]# chkconfig --del saslauthd

3. OS 업데이트
[root@localhost ~]# yum update

4. 폴더 생성 후 해당 폴더로 이동 및 다운로드
[root@localhost ~]# mkdir /usr/local/src/qmail
[root@localhost ~]# cd /usr/local/src/qmail
[root@localhost qmail]# wget http://www.qmail.org/netqmail-1.05.tar.gz
[root@localhost qmail]# wget http://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz
[root@localhost qmail]# wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
[root@localhost qmail]# wget http://www.alib.jp/files/qmail-date-localtime.patch
[root@localhost qmail]# wget http://www.lug.or.kr/files/centos_book/qmail/netqmail-1.05-tls-smtpauth-20070417.patch

5. netqmail-1.05.tar.gz 파일 압축 해제
[root@localhost qmail]# tar -zxvf netqmail-1.05.tar.gz

6. ucspi-tcp-0.88.tar.gz 압축해제
[root@localhost qmail]# cd /usr/local/src/qmail
[root@localhost qmail]# tar -zxvf ucspi-tcp-0.88.tar.gz
[root@localhost qmail]# cd ucspi-tcp-0.88

7. ucspi-tcp-0.88 설치
[root@localhost ucspi-tcp-0.88]# patch -p1 < /usr/local/src/qmail/netqmail-1.05/other-patches/ucspi-tcp-0.88.errno.patch
patching file error.h
[root@localhost ucspi-tcp-0.88]# patch -p1 < /usr/local/src/qmail/netqmail-1.05/other-patches/ucspi-tcp-0.88.a_record.patch
patching file rblsmtpd.c
[root@localhost ucspi-tcp-0.88]# patch -p1 < /usr/local/src/qmail/netqmail-1.05/other-patches/ucspi-tcp-0.88.nodefaultrbl.patch
patching file rblsmtpd.c
Hunk #1 succeeded at 193 (offset 38 lines).
Hunk #3 succeeded at 227 (offset 38 lines).
[root@localhost ucspi-tcp-0.88]# make && make setup check
./load auto-str unix.a byte.a
./auto-str auto_home `head -1 conf-home` > auto_home.c
./compile auto_home.c
./load install hier.o auto_home.o unix.a byte.a
./compile instcheck.c
./load instcheck hier.o auto_home.o unix.a byte.a
./install
./instcheck

7.1 sudo make && make setup check 에러시
collect2: ld returned 1 exit status
make: *** [tcpserver] 오류 1

vi error.h

#include <errno.h>  <- 추가후 저장
#ifndef ERROR_H
#define ERROR_H

8.qmail 폴더로 돌아와서 /package 디렉토리 생성후 daemontools 압축해제

[root@localhost ucspi-tcp-0.88]# cd ..
[root@localhost qmail]# mkdir -p /package
[root@localhost qmail]# chmod 1755 /package/
[root@localhost qmail]# tar -zxvf daemontools-0.76.tar.gz -C /package/
/package/admin/daemontools-0.76 폴더로 이동후 패키지 설치
[root@localhost qmail]# cd /package/admin/daemontools-0.76/
[root@localhost daemontools-0.76]# patch -p1 < /usr/local/src/qmail/netqmail-1.05/other-patches/daemontools-0.76.errno.patch
patching file src/error.h
[root@localhost daemontools-0.76]# package/install

8.1. Reboot 후 pstree 명령어로 svscanboot,readproctitle,svscan 데몬이 정상적으로 올라왔는지 확인
svscanboot
8.2 위와 같이 나오지 않을 경우

먼저 ps aux | grep svscan으로 하여 프로세스에 올라와 있는지 확인합니다.

올라오지 않았을 경우 다음과 같이 작업해 주시면 됩니다.

Centos 5.X 이하
[root@localhost]# echo “SV:345:respawn:/command/svscanboot” >> /etc/inittab
[root@localhost]# pkill -1 init

Centos 6.X 이상 (추가)
[root@localhost]# vi /etc/init/svscan.conf
start on runlevel [2345]
stop on runlevel [S016]
respawn
exec /command/svscanboot
[root@localhost]# initctl start svscan

9. netqmail 폴더에서 아래와 같이 작업 [7]번사항이 보여야 정상

[root@localhost daemontools-0.76]# cd /usr/local/src/qmail/netqmail-1.05
[root@localhost netqmail-1.05]# mkdir /var/qmail
[root@localhost netqmail-1.05]# ./collate.sh
You should see 7 lines of text below. If you see anything
else, then something might be wrong.
[1] Extracting qmail-1.03...
tar: Read 1024 bytes from -
[2] Patching qmail-1.03 into netqmail-1.05. Look for errors below:
24
[4] The previous line should say 24 if you used GNU patch.
[5] Renaming qmail-1.03 to netqmail-1.05...
[6] Continue installing qmail using the instructions found at:
[7] http://www.lifewithqmail.org/lwq.html#installation 

10. qmail을 위한 그룹과 계정 생성 (홈 디렉터리가 존재한다는 경고는 무시)
[root@localhost netqmail-1.05]# groupadd nofiles
[root@localhost netqmail-1.05]# useradd -g nofiles -d /var/qmail/alias alias
[root@localhost netqmail-1.05]# useradd -M -g nofiles -d /var/qmail qmaild
[root@localhost netqmail-1.05]# useradd -M -g nofiles -d /var/qmail qmaill
[root@localhost netqmail-1.05]# useradd -M -g nofiles -d /var/qmail qmailp
[root@localhost netqmail-1.05]# groupadd qmail
[root@localhost netqmail-1.05]# useradd -M -g qmail -d /var/qmail qmailq
[root@localhost netqmail-1.05]# useradd -M -g qmail -d /var/qmail qmailr
[root@localhost netqmail-1.05]# useradd -M -g qmail -d /var/qmail qmails
[root@localhost netqmail-1.05]# chgrp qmail /var/qmail
//유저가 생성된 것을 확인
[root@localhost netqmail-1.05]# tail /etc/passwd
xfs:x:43:43:X Font Server:/etc/X11/fs:/sbin/nologin
gdm:x:42:42::/var/gdm:/sbin/nologin
sabayon:x:86:86:Sabayon user:/home/sabayon:/sbin/nologin
alias:x:500:500::/var/qmail/alias:/bin/bash
qmaild:x:501:500::/var/qmail:/bin/bash
qmaill:x:502:500::/var/qmail:/bin/bash
qmailp:x:503:500::/var/qmail:/bin/bash
qmailq:x:504:501::/var/qmail:/bin/bash
qmailr:x:505:501::/var/qmail:/bin/bash
qmails:x:506:501::/var/qmail:/bin/bash 

11. netqmail-1.05/netqmail-1.05 폴더로 이동후 패치작업 수행
[root@localhost netqmail-1.05]# cd /usr/local/src/qmail/netqmail-1.05/netqmail-1.05
[root@localhost netqmail-1.05]# patch -p1 < /usr/local/src/qmail/qmail-date-localtime.patch
patching file date822fmt.c
[root@localhost netqmail-1.05]# patch -p0 < /usr/local/src/qmail/netqmail-1.05-tls-smtpauth-20070417.patch
patching file ./base64.c
patching file ./base64.h
patching file ./case_startb.c
patching file ./conf-cc
patching file ./dns.c
patching file ./FILES.auth
patching file ./hier.c
patching file ./install_auth.sh
patching file ./ipalloc.h
patching file ./Makefile
patching file ./Makefile-cert.mk
patching file ./qmail-control.9
patching file ./qmail-remote.8
patching file ./qmail-remote.c
patching file ./qmail-smtpd.8
patching file ./qmail-smtpd.c
patching file ./README.auth
patching file ./ssl_timeoutio.c
patching file ./ssl_timeoutio.h
patching file ./TARGETS
patching file ./tls.c
patching file ./tls.h
patching file ./update_tmprsadh.sh
//make로 컴파일
[root@localhost netqmail-1.05]# make
qmail-remote.c:494: error: ‘NID_commonName’ undeclared (first use in this function)
qmail-remote.c:496: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
qmail-remote.c:496: error: ‘s’ undeclared (first use in this function)
qmail-remote.c:496: error: invalid type argument of ‘->’
qmail-remote.c: In function ‘main’:
qmail-remote.c:673: warning: return type of ‘main’ is not ‘int’
make: *** [qmail-remote.o] Error 1
//위와같은 오류가 나올 경우 openssl-devel 설치 
[root@localhost netqmail-1.05]# yum -y install openssl-devel
[root@localhost netqmail-1.05]# make clean
[root@localhost netqmail-1.05]# make
[root@localhost netqmail-1.05]# make setup check
[root@localhost netqmail-1.05]# make cert
Generating a 1024 bit RSA private key
................++++++
..............++++++
writing new private key to '/var/qmail/control/servercert.pem'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:KR
State or Province Name (full name) [Berkshire]:SEOUL
Locality Name (eg, city) [Newbury]: JONGRO
Organization Name (eg, company) [My Company Ltd]:MYCOMPANY
Organizational Unit Name (eg, section) []:Section
Common Name (eg, your name or your server's hostname) []:192.168.70.130
Email Address []:linux@192.168.70.130
[root@localhost netqmail-1.05]# make tmprsadh
echo "Creating new temporary RSA and DH parameters"
Creating new temporary RSA and DH parameters
./update_tmprsadh
Generating RSA private key, 512 bit long modulus
.++++++++++++
...++++++++++++
e is 65537 (0x10001)
Generating DH parameters, 512 bit long safe prime, generator 2
This is going to take a long time
..........................................................++*++*++*++*++*++*
Generating DH parameters, 1024 bit long safe prime, generator 2
This is going to take a long time

12. ./config-fast 다음에는 메일서버의 호스트네임 세팅 (도메인/테스트는 IP)
[root@localhost netqmail-1.05]# ./config-fast mydomain.co.kr
Your fully qualified host name is 192.168.70.130
Putting 192.168.70.130 into control/me...
Putting 168.0.44 into control/defaultdomain...
Putting 0.44 into control/plusdomain...
Putting 192.168.70.130 into control/locals...
Putting 192.168.70.130 into control/rcpthosts...
Now qmail will refuse to accept SMTP messages except to 192.168.70.130.
Make sure to change rcpthosts if you add hosts to locals or virtualdomains!

13. qmail 구동에 필요한 파일을 만들고 권한을 생성한다
[root@localhost netqmail-1.05]# vi /var/qmail/rc

#//방법1
#!/bin/sh
# Using splogger to send the log through syslog.
# Using qmail-local to deliver messages to ~/Maildir/ by default.
exec env - PATH="/var/qmail/bin:$PATH" \
qmail-start ./Maildir/ splogger qmail

#//방법2
#!/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'"

[root@localhost netqmail-1.05]# chmod 755 /var/qmail/rc
[root@localhost netqmail-1.05]# mkdir -p /var/qmail/supervise/qmail-send/log
[root@localhost netqmail-1.05]# mkdir -p /var/qmail/supervise/qmail-smtpd/log
[root@localhost netqmail-1.05]# chmod +t /var/qmail/supervise/qmail-send
[root@localhost netqmail-1.05]# chmod +t /var/qmail/supervise/qmail-smtpd
[root@localhost netqmail-1.05]# vi /var/qmail/supervise/qmail-send/run
#!/bin/sh
exec /var/qmail/rc

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

[root@localhost netqmail-1.05]# vi /var/qmail/supervise/qmail-smtpd/run
#//방법1
#!/bin/sh
Q_UID='id -u qmaild'
Q_GID='id -g qmaild'
exec /usr/local/bin/softlimit -m 7340032 \
/usr/local/bin/tcpserver -vHRl 0 -x /etc/tcp.smtp.cdb \
-u $Q_UID -g $Q_GID 0 25 /var/qmail/bin/qmail-smtpd 2>&1


#//방법2
#!/bin/sh
QMAILDUID='id -u vpopmail'
NOFILESGID='id -g vpopmail'
MAXSMTPD='cat /var/qmail/control/concurrencyincoming'
QMAILQUEUE="/var/qmail/bin/simscan"
export QMAILQUEUE

rbldns="-r bl.spamcop.net"
rbldns="-r spamlist.or.kr"
rbldns="-r dnsbl.sorbs.net"
rbldns="-r blackholes.mail-abuse.org"
rbldns="-r cbl.abuseat.org"
rbldns="-r dnsbl.njabl.org"
rbldns="-r list.dsbl.org"
rbldns="-r multi.surbl.org"
rbldns="-r opm.blitzed.org"
rbldns="-r relays.mail-abuse.org"
rbldns="-r sbl-xbl.spamhaus.org"
rbldns="-r zen.spamhaus.org"

exec /usr/local/bin/softlimit -m 100000000 \
    /usr/local/bin/tcpserver -v -H -R -l 0 \
    -x /home/vpopmail/etc/tcp.smtp.cdb -c "$MAXSMTPD" \
    -u "$QMAILDUID" -g "$NOFILESGID" 0 smtp \
    /usr/local/bin/rblsmtpd -t 30 -b $rbldns \
    /var/qmail/bin/qmail-smtpd \
    /home/vpopmail/bin/vchkpw /bin/true 2>&1

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

14. supervise 실행퍼미션 부여
[root@localhost qmail-send]# chmod 755 /var/qmail/supervise/qmail-send/run
[root@localhost qmail-send]# chmod 755 /var/qmail/supervise/qmail-send/log/run
[root@localhost qmail-send]# chmod 755 /var/qmail/supervise/qmail-smtpd/run
[root@localhost qmail-send]# chmod 755 /var/qmail/supervise/qmail-smtpd/log/run

15. 로그파일을 저장하기 위한 디렉토리 생성 qmail 소유자로 지정
[root@localhost qmail-send]# mkdir -p /var/log/qmail/smtpd
[root@localhost qmail-send]# chown qmaill /var/log/qmail /var/log/qmail/smtpd

16. 릴레이 클라이언트로 허용할 아이피 주소를 설정하기 위한 tcp.smtp 파일 생성
[root@localhost netqmail-1.05]# vi /etc/tcp.smtp
127.0.0.1:allow,RELAYCLIENT=""

17. qmail 시작 파일을 생성후 서비스 등록
[root@localhost netqmail-1.05]# tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp (데이터베이스 생성)
//Qmail 시작스크립트 작성
[root@localhost netqmail-1.05]# wget http://auctionpro.co.kr/wp-content/uploads/2016/01/qmail-start.txt
[root@localhost netqmail-1.05]# mv qmail-start.txt /etc/rc.d/init.d/qmail
[root@localhost netqmail-1.05]# chmod 755 /etc/rc.d/init.d/qmail
//chkconfig 등록
[root@localhost netqmail-1.05]# chkconfig --add qmail
[root@localhost netqmail-1.05]# chkconfig --level 35 qmail on
[root@www netqmail-1.05]# chkconfig --list|grep qmail
//백업파일, 링크, 별칭 생성
[root@localhost netqmail-1.05]# mv /usr/lib/sendmail /usr/lib/sendmail.backup
[root@localhost netqmail-1.05]# mv /usr/sbin/sendmail /usr/sbin/sendmail.backup
[root@localhost netqmail-1.05]# ln -s /var/qmail/bin/sendmail /usr/lib
[root@localhost netqmail-1.05]# ln -s /var/qmail/bin/sendmail /usr/sbin
[root@localhost netqmail-1.05]# echo master > /var/qmail/alias/.qmail-root
[root@localhost netqmail-1.05]# echo master > /var/qmail/alias/.qmail-postmaster
[root@localhost netqmail-1.05]# echo master > /var/qmail/alias/.qmail-mailer-daemon
[root@localhost netqmail-1.05]# chmod 644 /var/qmail/alias/.qmail*

18. qmail 서비스 시작
[root@localhost qmail-smtpd]# service qmail start
Starting qmail

19. pstree 명령어로 다음과 같이 svscanboot의 하위프로세스가 정상적으로 뜨는지 확인
svscanboot_02
20. qmail start stop 테스트
[root@localhost netqmail-1.05]# /etc/rc.d/init.d/qmail stop
Stopping qmail...
qmail-smtpd
qmail-send
[root@localhost netqmail-1.05]# /etc/rc.d/init.d/qmail start
Starting qmail
[root@localhost netqmail-1.05]# /etc/rc.d/init.d/qmail cdb
Reloaded /etc/tcp.smtp.
[root@localhost netqmail-1.05]# /etc/rc.d/init.d/qmail restart
Restarting qmail:
* Stopping qmail-smtpd.
* Sending qmail-send SIGTERM and restarting.
* Restarting qmail-smtpd.

21. Maildir 디렉토리 자동생성법
[root@localhost netqmail-1.05]# /var/qmail/bin/maildirmake /etc/skel/Maildir
[root@localhost netqmail-1.05]# ls -l /etc/skel/
합계 8
drwx------ 5 root root 4096  6월 23 05:53 Maildir

[root@localhost netqmail-1.05]# ls -l /etc/skel/Maildir/
합계 24
drwx------ 2 root root 4096  6월 23 05:53 cur
drwx------ 2 root root 4096  6월 23 05:53 new
drwx------ 2 root root 4096  6월 23 05:53 tmp

22. 계정 생성시 디렉토리 생성여부 테스트
[root@localhost netqmail-1.05]# useradd vhost
[root@localhost netqmail-1.05]# passwd vhost
Changing password for user vhost.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@localhost netqmail-1.05]# cd ~vhost/
[root@localhost vhost]# ls -l
합계 8
drwx------ 5 vhost vhost 4096  6월 23 05:55 Maildir

[root@localhost vhost]# ls -l /home/vhost/Maildir/
합계 24
drwx------ 2 vhost vhost 4096  6월 23 05:55 cur
drwx------ 2 vhost vhost 4096  6월 23 05:55 new
drwx------ 2 vhost vhost 4096  6월 23 05:55 tmp

23. Dovecot 설정 및 ps 확인
[root@localhost webmail]# yum -y install dovecot
[root@localhost webmail]# service dovecot restart
[root@localhost webmail]# vi /etc/dovecot.conf
mail_location = maildir:~/Maildir (212 째 줄)
[root@localhost webmail]# service dovecot restart
[root@localhost webmail]# ps aux | grep dovecot
root      3703  0.0  0.1   1984   468 ?        Ss   06:02   0:00 /usr/sbin/dovecot
root      3704  0.0  0.5   7884  1440 ?        S    06:02   0:00 dovecot-auth
dovecot   3706  0.0  0.5   5032  1508 ?        S    06:02   0:00 pop3-login
dovecot   3707  0.0  0.5   5032  1512 ?        S    06:02   0:00 pop3-login
dovecot   3708  0.0  0.5   5032  1508 ?        S    06:02   0:00 pop3-login
dovecot   3709  0.0  0.5   5036  1516 ?        S    06:02   0:00 imap-login
dovecot   3710  0.0  0.5   5036  1512 ?        S    06:02   0:00 imap-login
dovecot   3711  0.0  0.5   5036  1512 ?        S    06:02   0:00 imap-login
root      3713  0.0  0.3   5308   768 pts/0    R+   06:02   0:00 grep dovecot
[root@localhost webmail]# ps aux|grep pop3
dovecot   3706  0.0  0.5   5032  1508 ?        S    06:02   0:00 pop3-login
dovecot   3707  0.0  0.5   5032  1512 ?        S    06:02   0:00 pop3-login
dovecot   3708  0.0  0.5   5032  1508 ?        S    06:02   0:00 pop3-login
root      3715  0.0  0.2   5308   764 pts/0    R+   06:02   0:00 grep pop3
[root@localhost webmail]# ps aux|grep imap
dovecot   3709  0.0  0.5   5036  1516 ?        S    06:02   0:00 imap-login
dovecot   3710  0.0  0.5   5036  1512 ?        S    06:02   0:00 imap-login
dovecot   3711  0.0  0.5   5036  1512 ?        S    06:02   0:00 imap-login
root      3719  0.0  0.2   5308   764 pts/0    R+   06:03   0:00 grep ima