CentOS 5.x에서 sendmail 설치 방법은 무엇인가요?
💡 요약 정리
- CentOS 5.8 (64bit) 환경에서 sendmail과 dovecot을 설치할 수 있습니다.
- sendmail은 메일 송신, dovecot은 POP3/IMAP 수신 서비스를 담당합니다.
- 설정 파일(
dovecot.conf,sendmail.mc,virtusertable등)을 수정한 후, 데몬을 시작해야 합니다.
1. 설치 환경
- CentOS 5.8 x86 (64bit)
2. sendmail, dovecot 설치
rpm -qa | grep sendmail명령어로 sendmail 설치 여부를 확인합니다. sendmail이 없다면 설치합니다.- POP3 사용을 위해 dovecot(=imap 패키지)을 함께 설치합니다.
[root@localhost /root]# rpm -qa | grep sendmail
[root@localhost /root]#
[root@localhost /root]# yum install sendmail-*
Loaded plugins: fastestmirror
Determining fastest mirrors
* base: ftp.daum.net
* extras: ftp.daum.net
* updates: ftp.daum.net
...
Install 5 Package(s)
Upgrade 0 Package(s)
Is this ok [y/N]: y
Downloading Packages:
(1/5): sendmail-devel-8.13.8-8.1.el5_7.i386.rpm | 128 kB 00:00
(2/5): sendmail-devel-8.13.8-8.1.el5_7.x86_64.rpm | 133 kB 00:00
(3/5): sendmail-cf-8.13.8-8.1.el5_7.x86_64.rpm | 306 kB 00:00
(4/5): sendmail-8.13.8-8.1.el5_7.x86_64.rpm | 637 kB 00:00
(5/5): sendmail-doc-8.13.8-8.1.el5_7.x86_64.rpm | 665 kB 00:00
...
Complete!
[root@localhost /root]#
[root@localhost /root]# rpm -qa | grep dovecot
[root@localhost /root]# yum install dovecot
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.daum.net
* extras: ftp.daum.net
* updates: ftp.daum.net
...
Install 1 Package(s)
Upgrade 0 Package(s)
Is this ok [y/N]: y
Downloading Packages:
dovecot-1.0.7-7.el5_7.1.x86_64.rpm | 1.7 MB 00:00
...
Complete!
[root@localhost /root]#
3. dovecot 설정
① /etc/dovecot.conf 파일을 다음과 같이 수정합니다.
# Base directory where to store runtime data.
#base_dir = /var/run/dovecot/
# Protocols we want to be serving: imap imaps pop3 pop3s
protocols = imap imaps pop3 pop3s -- 주석 제거
...
# IP or host address where to listen in for connections
listen = [::] ---> 주석 제거
② 설정 후 dovecot 데몬을 실행하고 포트를 확인합니다.
[root@localhost /root]# /etc/rc.d/init.d/dovecot start
Dovecot Imap (을)를 시작 중: [ OK ]
[root@localhost /root]# netstat -nlpt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:993 0.0.0.0:* LISTEN 364/dovecot
tcp 0 0 0.0.0.0:995 0.0.0.0:* LISTEN 364/dovecot
tcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN 364/dovecot
tcp 0 0 0.0.0.0:143 0.0.0.0:* LISTEN 364/dovecot
4. sendmail 설정
① /etc/mail/sendmail.mc 파일의 52라인과 116라인을 각각 다음과 같이 수정합니다.
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
...
DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl
5. 도메인 설정
① /etc/mail/local-host-names 파일에 사용할 도메인을 추가합니다.
# local-host-names - include all aliases for your machine here.
test.com
② /etc/mail/virtusertable 에 메일 주소와 계정 정보를 추가합니다.
test@test.com kky
③ hash 정보 적용을 위해 makemap 명령어를 실행합니다.
[root@localhost /root]# makemap hash /etc/mail/virtusertable.db < /etc/mail/virtusertable
6. sendmail 시작
[root@localhost /etc/mail]# /etc/rc.d/init.d/sendmail start
sendmail (을)를 시작합니다: [ OK ]
sm-client를 시작합니다: [ OK ]
[root@localhost /etc/mail]# netstat -nlpt
...
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 1529/sendmail