메일서버 구축하기(RHEL 4, Sendmail, Dovecot, RPM 버전)
1. Sendmail 설치
# rpm -qa|grep sendmail
sendmail-8.13.1-2
# rpm -Uvh sendmail-cf-8.13.1-2.i386.rpm
위 sendmail-cf-8.13.1-2은 Sendmail 설정에 필요한 패키지이므로 설치가 되어 있지 않다면 설치한다.(RHEL 4의 네 번째 CD에 있음)
2. dovecot 설치
sendmail은 단순히 메일을 보내는 기능 밖에 없으므로 메일박스를 지원하는 dovecot를 설치한다. (RHEL 4의 네 번째 CD에 있음)
# rpm -Uvh dovecot-0.99.11-2.EL4.1.i386.rpm
3. sasl 설치
sendmail 및 dovecot 인증을 위한 패키지이다. 대부분 깔려있으나 설치되어 있지 않으면 설치한다. (RHEL 4의 두 번째, 세 번째 CD에 있음)
# rpm -Uvh cyrus-sasl-2.1.19-5.EL4
# rpm -Uvh cyrus-sasl-ntlm-2.1.19-5.EL4
# rpm -Uvh cyrus-sasl-md5-2.1.19-5.EL4
# rpm -Uvh cyrus-sasl-sql-2.1.19-5.EL4
# rpm -Uvh cyrus-sasl-gssapi-2.1.19-5.EL4
# /etc/init.d/saslauthd start
서비스 실행
4. 환경설정
가. sendmail 설정
기본적으로 sendmamil에서는 로컬에서만 메일을 발송하도록 설정되어 있다.
아래처럼 수정하여 외부 서버에서도 릴레이가 되도록 하자.
# vi /etc/mail/sendmail.mc
define(`confAUTH_MECHANISMS’, `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN’)dnl
# cd /etc/mail
# m4 sendmail.mc > sendmail.cf
sendmail.mc 로부터 sendmail.cf 파일을 생성한다.
# vi /etc/mail/access
# of the format of this file. (search for access_db in that file)
# The /usr/share/doc/sendmail/README.cf is part of the sendmail-doc
# package.
#
# by default we allow relaying from localhost…
localhost.localdomain RELAY
localhost RELAY
127.0.0.1 RELAY
192.168.0. RELAY
# vi /etc/mail/local-host-names
localhost
naver.com
daum.net
# cd /etc/mail
# make
자동으로 .db 파일들을 생성해 준다.
# /etc/init.d/sendmail restart
sendmail 재시작
나. dovecot 설정
# vi /etc/dovecot.conf
pop3_listen = *
default_mail_env = mbox:~/mail/:INBOX=/var/mail/%u
# /etc/init.d/dovecot restart
dovecot 재시작
5. 테스트
포트가 정상적으로 열려있는지 확인
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN
# netstat -nat | grep 110
tcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN
pop3 서비스의 인증이 제대로 작동하는 지 확인
Trying 127.0.0.1…
Connected to localhost.localdomain (127.0.0.1).
Escape character is ‘^]’.
+OK dovecot ready.
user 사용자계정
+OK
pass 비밀번호
+OK Logged in.
list
+OK 0 messages:
저 블로그에 이웃공개로 링크 퍼갈께요 ^^