콘텐츠로 이동






Centos에서 POSTFIX설치하기

소개

Centos6이후부터는 기본SMTP가 Sendmail에서 postfix로 변경되었습니다.

작업절차

  1. Sendmail 패키지 삭제 (설치되어 있는 경우)

    $> yum erase sendmail -y
    

  2. Postfix 패키지 설치

    $> yum install postfix -y
    

  3. Postfix 설정

    $> 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,인증라이브러리 연동
    
    $> vi /usr/lib/sasl2/smtpd.conf
    pwcheck_method: saslauthd
    chkconfig postfix on
    chkconfig saslauthd on
    /etc/init.d/postfix start
    /etc/init.d/saslauthd start
    

  4. 기본 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관리
      $> mailq –> Queue에 쌓인 메일 확인
      $> postfix flush –> Queue 전체 지우기
      $> postsuper -d ALL deferred –> Queue메일  Deferred(지연발송메일)  삭제
      
    4. 가상 도메인 세팅
      $> vi /etc/postfix/main.cf
      virtual_alias_domain = test.com example.com (등록할 호스트명 기재)
      
    5. Alias 설정
      $> vi /etc/postfix/main.cf
      virtual_alias_maps = hash:/etc/postfix/virtual
      
      $> vi /etc/postfix/virtual
      postmaster@example.com postmaster
      info@example.com joe
      sales@example.com jane
      (메일주소) (실계정명)
      
    6. 적용
      $> postmap /etc/postfix/virtual
      



back
perplexity에서 생성한 AI이미지



작성일: 2026년 7월 15일 ,  마지막 업데이트: 2026년 7월 20일