Server Admin

본문 바로가기
사이트 내 전체검색


RedHat Linux >> Server Administration for Redhat Linux
[목차]
제3장 Mail 서버 - Sendmail/IMAP

    9. Sendmail 소스로 설치하기

 

1. 기존 RPM 패키지 지우기

[root@w3 down]# rpm -qa|grep sendmail

sendmail-doc-8.11.0-8

sendmail-cf-8.11.0-8

sendmail-8.11.0-8

[root@w3 down]# rpm -e sendmail-doc

[root@w3 down]# rpm -e sendmail-cf

[root@w3 down]# rpm -e sendmail   

error: removing these packages would break dependencies:

        smtpdaemon is needed by fetchmail-5.5.0-3

        smtpdaemon is needed by mutt-1.2.5i-3

[root@w3 down]#

[root@w3 down]# rpm -e fetchmail

error: removing these packages would break dependencies:

        fetchmail = 5.5.0 is needed by fetchmailconf-5.5.0-3

[root@w3 down]# rpm -e fetchmailconf

[root@w3 down]# rpm -e fetchmail

[root@w3 down]# rpm -e mutt     

[root@w3 down]# rpm -e sendmail

[root@w3 down]#

관련 페키지를 모두 지웁니다.

 

2. 소스로 설치하기

[root@w3 down]# tar xvfz sendmail.8.12.2.tar.gz

[root@w3 down]# cd sendmail-8.12.2/

[root@w3 sendmail-8.12.2]#

 

[root@w3 sendmail-8.12.2]# less INSTALL

설치방법을 확인할 수 있다.

[root@w3 sendmail-8.12.2]# sh Build

 

[root@w3 sendmail-8.12.2]# cd cf/cf

[root@w3 cf]# cp generic-linux.mc sendmail.mc

[root@w3 cf]# vi sendmail.mc

divert(0)dnl

VERSIONID(`$Id: generic-linux.mc,v 8.1 1999/09/24 22:48:05 gshapiro Exp $')

OSTYPE(linux)dnl

DOMAIN(generic)dnl

FEATURE(local_procmail, /usr/bin/procmail)dnl

FEATURE(access_db)dnl

FEATURE(virtusertable, hash /etc/mail/virtusertable)dnl

MAILER(local)dnl

MAILER(smtp)dnl

~

[root@w3 cf]# sh Build sendmail.cf

Using M4=/usr/bin/m4

rm -f sendmail.cf

/usr/bin/m4 ../m4/cf.m4 sendmail.mc > sendmail.cf || ( rm -f sendmail.cf && exit 1 )

chmod 444 sendmail.cf

[root@w3 cf]# mkdir /etc/mail

[root@w3 cf]# sh Build install-cf

Using M4=/usr/bin/m4

../../devtools/bin/install.sh -c -o root -g bin -m 0444 sendmail.cf /etc/mail/sendmail.cf

../../devtools/bin/install.sh -c -o root -g bin -m 0444 submit.cf /etc/mail/submit.cf

[root@w3 cf]# cd ../../

[root@w3 sendmail-8.12.2]# ls /usr/man/

man5  man8  whatis

[root@w3 sendmail-8.12.2]#

man1 디렉토리가 없다면 만들어준다.

[root@w3 sendmail-8.12.2]# mkdir /usr/man/man1

[root@w3 sendmail-8.12.2]# adduser smmsp

[root@w3 sendmail-8.12.2]# sh Build install

 

3. 환경설정하기

[root@w3 sendmail-8.12.2]# cd /etc/mail

[root@w3 mail]# ls

helpfile  sendmail.cf  statistics  submit.cf

[root@w3 mail]#

[root@w3 mail]# vi access

localhost.localdomain           RELAY

localhost                       RELAY

127.0.0.1                       RELAY

210.91.192                      RELAY

leelab.co.kr                    RELAY

[root@w3 mail]# makemap hash access < access  

[root@w3 mail]# ls

access  access.db  helpfile  sendmail.cf  statistics submit.cf

 

[root@w3 mail]# touch virtusertable

[root@w3 mail]# makemap hash virtusertable < virtusertable

[root@w3 mail]# vi local-host-names

leelab.co.kr

www.leelab.co.kr

 

[root@w3 mail]# touch relay-domains

[root@w3 mail]# vi aliases

# Basic system aliases -- these MUST be present.

MAILER-DAEMON:  postmaster

postmaster:     root

 

# General redirections for pseudo accounts.

bin:            root

daemon:         root

games:          root

ingres:         root

nobody:         root

system:         root

toor:           root

uucp:           root

 

# Well-known aliases.

manager:        root

dumper:         root

operator:       root

 

# trap decode to catch security attacks

decode:         root

 

# Person who should get root's mail

#root:          marc

root:           jklee

webmaster:              jklee

 

아래 디렉토리들의 퍼미션을 다시 설정하자.

-r-xr-sr-x      root   smmsp    ... /usr/sbin/sendmail

drwxrwx---      smmsp  smmsp    ... /var/spool/clientmqueue

drwx------      root   root     ... /var/spool/mqueue

-r--r--r--      root   root     ... /etc/mail/sendmail.cf

-r--r--r--      root   root     ... /etc/mail/submit.cf

 [root@w3 mail]# ll /usr/sbin/sendmail

-r-xr-sr-x    1 root     smmsp      565303  1월 18 10:27 /usr/sbin/sendmail

 [root@w3 mail]# cd /var/spool

[root@w3 spool]# ll

합계 64

drwxr-xr-x    2 root     root         4096  1월 11 15:49 anacron

drwx------    3 daemon   daemon       4096  1월 12 00:04 at

drwxr-xr-x    2 root     root         4096  1월 18 10:19 clientmqueue

drwx------    2 root     root         4096  8월 25  2000 cron

drwxr-xr-x    4 root     root         4096  1월 12 00:19 fax

drwxr-xr-x    2 root     root         4096  6월  2  2000 lpd

drwxrwxr-x    2 root     mail         4096  1월 18 04:02 mail

drwxrwxr-x    9 news     news         4096  1월 12 00:12 news

drwxr-xr-x    2 root     root         4096  8월 11  2000 rwho

drwxrwxrwt    2 root     root         4096  8월 15  2000 samba

drwxrwxr-x    5 news     news         4096  1월 13 04:02 slrnpull

drwxr-x---    2 squid    squid        4096  7월 29  2000 squid

drwxr-xr-x    2 uucp     uucp         4096  7월 13  2000 uucp

drwxr-xr-x    2 uucp     uucp         4096  7월 13  2000 uucppublic

drwxrwxrwt    2 root     root         4096  8월  3  2000 vbox

drwxr-xr-x    4 root     root         4096  1월 12 00:19 voice

 

[root@www spool]# chown -R smmsp.smmsp clientmqueue

[root@ise spool]# chmod 770 clientmqueue/

[root@www spool]# mkdir mqueue

[root@www spool]# chmod 700 mqueue

[root@w3 spool]# ll

합계 68

drwxr-xr-x    2 root     root         4096  1월 11 15:49 anacron

drwx------    3 daemon   daemon       4096  1월 12 00:04 at

drwxrwx---    2 smmsp    smmsp        4096  1월 18 10:19 clientmqueue

drwx------    2 root     root         4096  8월 25  2000 cron

drwxr-xr-x    4 root     root         4096  1월 12 00:19 fax

drwxr-xr-x    2 root     root         4096  6월  2  2000 lpd

drwxrwxr-x    2 root     mail         4096  1월 18 04:02 mail

drwx------    2 root     root         4096  1월 18 10:41 mqueue

drwxrwxr-x    9 news     news         4096  1월 12 00:12 news

drwxr-xr-x    2 root     root         4096  8월 11  2000 rwho

drwxrwxrwt    2 root     root         4096  8월 15  2000 samba

drwxrwxr-x    5 news     news         4096  1월 13 04:02 slrnpull

drwxr-x---    2 squid    squid        4096  7월 29  2000 squid

drwxr-xr-x    2 uucp     uucp         4096  7월 13  2000 uucp

drwxr-xr-x    2 uucp     uucp         4096  7월 13  2000 uucppublic

drwxrwxrwt    2 root     root         4096  8월  3  2000 vbox

drwxr-xr-x    4 root     root         4096  1월 12 00:19 voice

[root@w3 spool]#

 

4. 실행하기

[root@w3 spool]# sendmail -bi

/etc/mail/aliases: 16 aliases, longest 20 bytes, 205 bytes total

 

[root@w3 spool]# sendmail -L sm-mta -bd -q1h

[root@w3 spool]# ps ax|grep sendmail

 5077 ?        S      0:00 sendmail: accepting connections

 5083 pts/0    S      0:00 grep sendmail

[root@w3 spool]#

 

5. 테스트하기

[root@w3 spool]# mail 다른곳의메일주소

Subject: test

test

[Ctrl+D]

Cc: 엔터

[root@w3 mail]#

다른곳의 메일을 확인한다.

메일이 도착한 것을 확인하였으면, 다른곳에서 새로 설치한 메일서버로 메일을 보낸다.

그리고 아래와 같이 확인한다.

 

[root@w3 mail]# su - 아이디(jklee라고 가정)

[root@w3 jklee]#

[jklee@w3 jklee]$ mail

Mail version 8.1 6/6/93.  Type ? for help.

"/var/spool/mail/jklee": 1 message 1 new

>N  1 leejinkwan@kunsan.ac  Fri Jan 18 10:52  29/1552  "test"

& 엔터 (메일내용을 볼 때)

& d (지울 때)

& q (종료할 때)

[jklee@w3 jklee]$

[목차]

개인정보취급방침 서비스이용약관 모바일 버전으로 보기 상단으로

TEL. 063-469-4551 FAX. 063-469-4560 전북 군산시 대학로 558
군산대학교 컴퓨터정보공학과

Copyright © www.leelab.co.kr. All rights reserved.