CÀI ĐẶT POSTFIX/DOVECOT TRÊN CENTOS 6.5 Mô hình bài lab: Yêu cầu: Cài đặt DNS cho server để phân giải địa chỉ IP cho client Cài đặt Postfix/Dovecot trên server và cấu hình user trên cli
Trang 1CÀI ĐẶT POSTFIX/DOVECOT TRÊN CENTOS 6.5
Mô hình bài lab:
Yêu cầu:
Cài đặt DNS cho server để phân giải địa chỉ IP cho client
Cài đặt Postfix/Dovecot trên server và cấu hình user trên client để client có thể gửi/nhận Email
Cài đặt Squirrelmail trên server để client có thể gửi/nhận Email qua trình duyệt web
Trang 32/ Cấu hình DNS:
Tạo file /etc/named.conf như sau:
Tạo file /var/named/named.root bằng cách download trên mạng như sau:
Trang 4Tạo file /var/named/athena.edu.vn.db:
Tạo file /var/named/1.168.192.in-addr.arpa.db:
Sửa file /etc/resolv.conf:
Restart named daemon
Trang 6III/Cấu hình Postfix:
1/ Cài đặt:
Gói cài đặt Postfix: postfix-2.6.6-2.2.el6_1.i686.rpm
Có thể tìm thấy trong DVD cài đặt CentOS
## Dòng 164 – thêm $mycomain vào sau
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
Trang 7Khởi động lại postfix, kiểm tra port:
Cài telnet:
Tạo user:
Telnet đến server
Trang 8Gửi E-mail từ u1 qua u2:
Kiểm tra maillog, ta thấy quá trình gửi/nhận mail của 2 user
Trang 9IV/Cấu hình Dovecot
1/ Cài đặt:
Gói cài đặt Dovecot: dovecot-2.0.9-7.el6.i686.rpm
Có thể tìm thấy trong DVD cài đặt CentOS
2/ Cấu hình:
Mở file /etc/dovecot/dovecot.conf, sửa những dòng sau:
Mở file /etc/dovecot/conf.d/10-auth.conf, sửa những dòng sau:
Mở file /etc/dovecot/conf.d/10-mail.conf, sửa những dòng sau:
## Dòng 97 – Sửa “plain” thành “plain login”
auth_mechanisms = plain login
## Dòng 24 – Uncomment
mail_location = maildir:~/Maildir
Trang 10Mở file /etc/dovecot/conf.d/10-master.conf, sửa những dòng sau:
Khởi động lại Dovecot, Postfix:
# service dovecot restart
# service postfix restart
Trang 113/ Kiểm tra tại Client:
Tại Client, tạo 2 user u1và u2,
Log on U1 ,khởi động Outlook
Expres cấu hình Mail client
B1 Nhập tên người dùng
B2 Nhập account mail
Trang 12B3 Nhập địa chỉ của Incoming mail
server và Outgoing mail server
B4 Nhập user account và password
đã tạo tại server
B5.Nhấn Finish
Trang 13B6 Tạo 1 email gửi qua cho u2
B7 Đăng nhập u2, cấu hình tương
tự như u1, kiểm tra mail đã nhận
thành công
Trang 14V/ Cấu hình Squirrelmail:
1/Cài đặt
Cài đặt online
# yum install epel squirrelmail -y
Cài đặt bằng gói: Download và cài đặt các gói sau:
Trang 15Bảng cấu hình của Squirrelmail xuất hiện, nhập “2” → Enter để cài đặt cho server
SquirrelMail Configuration : Read: config.php (1.4.0)
D Set pre-defined settings for specific IMAP servers
C Turn color off
S Save data
Q Quit
Command >> 2
Trang 16Trong mục Server Settings, nhập “1” → Enter → nhập mail domain → Enter
SquirrelMail Configuration : Read: config.php (1.4.0)
A Update IMAP Settings : localhost:143 (uw)
B Change Sendmail Config : /usr/sbin/sendmail
R Return to Main Menu
C Turn color off
S Save data
Q Quit
Command >> 1
The domain name is the suffix at the end of all email addresses If
for example, your email address is jdoe@example.com, then your domain
would be example.com
[localhost]: athena.edu.vn
Trang 17Nhập “3” → Enter và đổi từ Sendmail sang SMTP
Nhập “2” → Enter để chuyển từ Sendmail sang SMTP
SquirrelMail Configuration : Read: config.php (1.4.0)
A Update IMAP Settings : localhost:143 (uw)
B Change Sendmail Config : /usr/sbin/sendmail
R Return to Main Menu
C Turn color off
S Save data
Q Quit
Command >> 3
You now need to choose the method that you will use for sending
messages in SquirrelMail You can either connect to an SMTP server
or use sendmail directly
1 Sendmail
2 SMTP
Trang 18Tại menu chính, nhập “d” → Enter để chọn IMAP server
Nhập “dovecot” → Enter để chọn dovecot làm IMAP server
SquirrelMail Configuration : Read: config.php (1.4.0)
D Set pre-defined settings for specific IMAP servers
C Turn color off
S Save data
Q Quit
Command >> d
Please select your IMAP server:
bincimap = Binc IMAP server
courier = Courier IMAP server
cyrus = Cyrus IMAP server
dovecot = Dovecot Secure IMAP server
exchange = Microsoft Exchange IMAP server
hmailserver = hMailServer
macosx = Mac OS X Mailserver
mercury32 = Mercury/32
uw = University of Washington's IMAP server
gmail = IMAP access to Google mail (Gmail) accounts
Trang 19Mở file /etc/httpd/conf.d/squirrelmail.conf và sửa lại như sau:
Dòng 8: sửa Deny from all thành Allow from all
11 # this section makes squirrelmail use https connections only, for this you
12 # need to have mod_ssl installed If you want to use unsecure http
13 # connections, just remove this section:
Trang 203/ Kiểm tra tại client:
Để truy cập vào web mail, ta truy cập với địa chỉ:
http://<ipaddress>/webmail hoặc http://<domain-name>/webmail
Nhập username và password tại màn hình đăng nhập
Tại giao diện account, nhấn Compose để tạo và gứi một email mới sang u2@athena.edu.vn
Trang 21Đăng nhập u2 kiểm tra email vừa gửi từ u1: