wilson's story

postfix 메일 서버 구축 본문

Linux

postfix 메일 서버 구축

wilson 2007. 11. 22. 17:10
반응형
1. 설치
yum -y install postfix

2. 설정 파일의 편집
vi /etc/postfix/main.cf

# 호스트명을 설정
myhostname = mail.junix.pe.kr
# 도메인을 설정
mydomain = junix.pe.kr
# 송신자 메일 주소 도메인
myorigin = $mydomain
# 기다려야 할 모든 네트워크 인터페이스를 지정
inet_interfaces = all
# 메일을 로컬로 수신하는 도메인명을 지정(도메인 전체의 메일 서버)
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
# 신뢰 받은 네트워크를CIDR (network/mask) 표기로 지정(로컬 네트워크)
mynetworks = 192.168.0.0/24, 127.0.0.0/8
# 중계를 허가하는 도메인을 지정
relay_domains = $mydestination
# 메일 박스(Maildir)를 각 유저의 홈 디렉토리에 배치
home_mailbox = Maildir/
# 호스트의 접속에 관한 거부(SPAM거부 설정)
smtpd_client_restrictions = permit_mynetworks,
                            reject_rbl_client relays.ordb.org,
                            permit

3. 시작
/etc/rc.d/init.d/sendmail stop
chkconfig --del sendmail
chkconfig sendmail off
chkconfig --list sendmail
alternatives --config mta
chkconfig postfix on
chkconfig --list postfix


dovecot란 POP(수신) 서버 기능을 제공하는 프로그램이다.
POP 서버의 반대되는 것이 SMTP(송신) 서버 구축이다.

1. 설치
yum -y install dovecot

2. 설정 파일의 편집
vi /etc/dovecot.conf

프로토콜을 지정
protocols = imap imaps pop3 pop3s
imap_listen = *
pop3_listen = *
imaps_listen = *
pop3s_listen = *
default_mail_env = maildir:~/Maildir
valid_chroot_dirs = /home

3. 시작
/etc/rc.d/init.d/dovecot start
chkconfig dovecot on
chkconfig --list dovecot

4. 다람쥐 웹메일 설치 및 설정
yum -y install squirrelmail
 
5. 디렉토리 및 파일에 대한 소유권 수정
chown apache.apache -R /usr/share/squirrelmail
chown apache.apache /etc/squirrelmail/config.php
chown apache.apache -R /var/lib/squirrelmail/
chown apache.apache -R /var/spool/squirrelmail/

6.환경설정
# /usr/share/squirrelmail/config/conf.pl 실행
6-1.Server Settings 설정
   1을 입력, Domaiin을 junix.pe.kr 로 설정
   A입력하고 4를 입력, IMAP Server를 mail.junix.pe.kr 로  설정
   8을 입력, Server Software를 other로 설정
   s를 입력해 저장하고 r을 입력해 Main Menu로 돌아간다.
6-2. Language 설정
   1을 입력, Default Language를 ko_KR로 설정
   2를 입력, Default Charset을 euc-kr로 설정
   s를 입력해 저장하고 r을 입력해 Main Menu로 돌아간다.
   s를 입력해 다시 한번 저장하고 q를 입력해 종료

7. 웹서버 설정
 #  vi /etc/httpd.conf/httpd.conf
맨 윗줄에
Alias /webmail/ /usr/share/squirrelmail/
추가 후

service httpd restart 하여 웹서버 재시작
service sendmail restart 하여 메일 서버 재시작

8. 테스트
http://www.junix.pe.kr/webmail/ 에 접속하여 soojung으로 로그인하여 테스트한다.
soojung 골뱅이 junix.pe.kr -> junix 골뱅이 naver.com 정상 여부 확인
junix 골뱅이 naver.com -> soojung 골뱅이 junix.pe.kr 정상 여부 확인
반응형