การติดตั้ง Mail-Server


การติดตั้ง Mail-Server

sendmail เป็นโปรแกรมที่ใช้ในการทำ mailserver โดยการตรวจสอบว่ามีหรือไม่โดยใช้คำสั่ง

[root@one root]# rpm -q sendmail
sendmail-8.11.6-15
[root@one root]#

แสดงว่า มีการติดตั้งไว้แล้ว ( ในตอนที่เราลง RedHat จะลงให้อยู่แล้ว

ให้ใส่ CD แผ่นที่ 1 ใน เครื่อง Server และที่เครื่องลูกที่เราทำงาน ไปที่หน้าต่างของโปรแกรม putty

[root@one root]# mount /mnt/cdrom/
[root@one root]# cd /mnt/cdrom/RedHat/RPMS/
[root@one RPMS]# rpm -Uvh m4-1.4.1-7.i386.rpm
Preparing... ########################################### [100%]
1:m4 ########################################### [100%]
[root@one RPMS]#

ให้ใส่ CD แผ่นที่ 2 ใน เครื่อง Server และที่เครื่องลูกที่เราทำงาน ไปที่หน้าต่างของโปรแกรม putty

[root@one root]# mount /mnt/cdrom/
[root@one root]# cd /mnt/cdrom/RedHat/RPMS/
[root@one RPMS]# rpm -Uvh sendmail-cf-8.11.6-15.i386.rpm
Preparing... ########################################### [100%]
1:sendmail-cf ########################################### [100%]
[root@one RPMS]# rpm -Uvh imap-2001a-10.i386.rpm
Preparing... ########################################### [100%]
1:imap ########################################### [100%]
[root@one RPMS]# cd ; eject
[root@one root]#

การลงโปรแกรมสำหรับ mail server ก็มีแค่นี้ จากนั้นเป็นการ config โดยการแก้ไขแฟ้ม sendmail.cf

[root@one root]# vi /etc/mail/sendmail.mc

ให้แก้ดังตัวอย่างเพียงแค่บรรทัดเดียว คือบรรทัด DAEMON_OPTIONS ให้เพิ่มคำว่า dnl เข้าไปข้างหน้าแล้วบันทึก

dnl to accept email over the network.
dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')
dnl NOTE: binding both IPv4 and IPv6 daemon to the same port requires

ต่อไปใช้คำสั่ง

[root@one root]# m4 /etc/mail/sendmail.mc > /etc/sendmail.cf

เพื่อสร้างไฟล์ sendmail.cf ใหม่จากนั้นให้เพิ่มบรรทัดในแฟ้ม access
โดย vi /etc/mail/access แล้วเพิ่มสองบรรทัดล่างเข้าไป ดังนี้

# Check the /usr/share/doc/sendmail/README.cf file for a description
# of the format of this file. (search for access_db in that file)
# The /usr/share/doc/sendmail/README.cf is part of the sendmail-doc
# package.
#
# by default we allow relaying from localhost...
localhost.localdomain RELAY
localhost RELAY
127.0.0.1 RELAY
192.168.1 RELAY <=== เพิ่มเข้าไป
abcdef.com RELAY <=== เพิ่มเข้าไป

จากนั้นใช้คำสั่ง

[root@one root]# cd /etc/mail/
[root@one mail]# makemap hash /etc/mail/access.db < /etc/mail/access
[root@one mail]#

แก้ไขแฟ้ม local-host-names โดยเพิ่มชื่อ domain ของเราเข้าไปดังนี้

# local-host-names - include all aliases for your machine here.
abcdef.com

ตามที่ได้กล่าวมาเป็นการทำ SMTP Server ส่วนการทำ Pop Server ให้แก้แฟ้ม ipop3 โดยแก้ disable =yes เป็น no โดย vi /etc/xinetd.d/ipop3 ดังนี้

# default: off
# description: The POP3 service allows remote users to access their mail \
# using an POP3 client such as Netscape Communicator, mutt, \
# or fetchmail.
service pop3
{
socket_type = stream
wait = no
user = root
server = /usr/sbin/ipop3d
log_on_success += HOST DURATION
log_on_failure += HOST
disable = no
}

จากนั้นสั่ง run xinetd อีกครั้งหนึ่ง

[root@one mail]# /etc/init.d/xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
[root@one mail]#

เป็นการจบการติดตั้ง mail server

|BACK|. : : By Mr.Sontaya
Hosted by www.Geocities.ws

1