Centos에서 POSTFIX설치하기
소개
Centos6이후부터는 기본SMTP가 Sendmail에서 postfix로 변경되었습니다.
| [](http://wiki.igoni.kr/uploads/images/gallery/2026-03/0ec43fa8-4b9e-4356-ae61-db3af0f4b8c9.png) |
| perplexity에서 생성한 AI이미지 |
작업절차
- Sendmail 패키지 삭제
shell $> yum erase sendmail -y - Postfix 패키지 설치
shell $> yum install postfix -y - Postfix 설정 ```shell vi /etc/postfix/main.cf
mydomain = localhost (발송 호스트네임 기재) mynetworks_style = host (로컬에서만 발송가능 설정) mynetworks = 127.0.0.1, 192.168.0/24 (발송할 대역기재) smtpd_sasl_auth_enable = yes (인증라이브러리 연동) inet_interfaces = $myhostname (open relay차단, 설정 해제시 all 으로 변경) postfix,인증라이브러리 연동
<div><div><div class="box"><div class="code"><div class="linenoswrapper"><div> </div></div></div></div></div></div>```shell $> vi /usr/lib/sasl2/smtpd.conf pwcheck_method: saslauthd chkconfig postfix on chkconfig saslauthd on /etc/init.d/postfix start /etc/init.d/saslauthd start4. 기본 Trouble Shooting
1. 디렉토리 구조 1. postfix 파일 디렉토리 : /var/spool/postfix 2. incoming : 모든 메시지 3. active : 배달 준비 중인 메시지 4. deferred : 재전송 시도하는 메시지 5. corrupt : 배달할 수 없는 메시지 2. 데이터 관리 1. 메일 발송 로그는 sendmail 과 동일하게 /var/log/maillog에 기재됨 2. 메일 데이터는 /var/spool/mail/계정명 3. Queue관리```shell [root@localhost /]# mailq –> Queue에 쌓인 메일 확인 [root@localhost /]# postfix flush –> Queue 전체 지우기 [root@localhost /]# postsuper -d ALL deferred –> Queue메일 중 Deferred(지연발송메일) 만 삭제 ``` <div><div><div class="box"><div class="code"><div class="linenoswrapper"><div> </div></div></div></div></div> 1. 가상 도메인 세팅 ```shell $> vi /etc/postfix/main.cf virtual_alias_domain = test.com example.com (등록할 호스트명 기재) ``` 2. Alias 설정 ```shell $> vi /etc/postfix/main.cf virtual_alias_maps = hash:/etc/postfix/virtual ``` <div><div><div class="box"><div class="code"><div class="linenoswrapper"><div> </div></div></div></div></div></div>```shell $> vi /etc/postfix/virtual postmaster@example.com postmaster info@example.com joe sales@example.com jane (메일주소) (실계정명) ``` <div><div class="box"><div class="code"><div class="linenoswrapper"><div> </div></div></div></div></div> 3. 적용 ```shell [root@localhost /]# postmap /etc/postfix/virtual ``` </div>
작성일: 2026년 7월 15일
,
마지막 업데이트: 2026년 7월 15일