Nguyễn Duy Đạt - SVTT Page 1 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 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
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Nguyễn Duy Đạt - SVTT Page 1
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 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
Nguyễn Duy Đạt - SVTT Page 2
I/ Cấu hình Hostname:
Sửa file /etc/hosts:
# vi /etc/hosts
Sửa file /etc/sysconfig/network
# vi /etc/sysconfig/network
Restart hệ thống: init 6
Kiểm tra Hostname:
II/ Cấu hình DNS:
1/ Cài đặt DNS:
Dùng câu lệnh: rpm –ivh <tên gói> để cài đặt các gói sau:
bind-9.8.2-0.17.rc1.el6_4.6.i686.rpm
bind-libs-9.8.2-0.17.rc1.el6_4.6.i686.rpm
bind-utils-9.8.2-0.17.rc1.el6_4.6.i686.rpm
Ta có thể tìm các gới trên trong DVD cài đặt CentOS
Nguyễn Duy Đạt - SVTT Page 3
2/ 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:
Chú ý: Server phải kết nối đến internet.
Nguyễn Duy Đạt - SVTT Page 4
Tạ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
Nguyễn Duy Đạt - SVTT Page 5
Tắt Firewall:
Chọn Firewall
Configuration
Nhấn Space Bar để
disable Firewall → OK
Chọn Yes
Chọn Quit để thoát
setup
Nguyễn Duy Đạt - SVTT Page 6
III/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
Kiểm tra maillog, ta thấy quá trình gửi/nhận mail của 2 user
Nguyễn Duy Đạt - SVTT Page 9
IV/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 20 – Uncomment
protocols = imap pop3 lmtp
## Dòng 26 – Uncomment, bỏ “,::”
listen = *
## Dòng 9 – Uncomment, sửa “yes” thành “no”
disable_plaintext_auth = no
## Dòng 97 – Sửa “plain” thành “plain login”
auth_mechanisms = plain login
## Dòng 24 – Uncomment
mail_location = maildir:~/Maildir
Nguyễn Duy Đạt - SVTT Page 10
Mở 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
## Dòng 19 – Uncomment
port = 143
## Dòng 22 – Uncomment
port = 993
## Dòng 40 – Uncomment
port = 110
## Dòng 43 – Uncomment
port = 995
## Dòng 82 – Uncomment
mode = 0600
## Dòng 83 – Uncomment, sửa lại thành:
user = postfix
## Dòng 84 – Uncomment, sửa lại thành:
group = postfix
Nguyễn Duy Đạt - SVTT Page 11
3/ 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
Nguyễn Duy Đạt - SVTT Page 12
B3. 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
Nguyễn Duy Đạt - SVTT Page 13
B6. 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
Nguyễn Duy Đạt - SVTT Page 14
V/ 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:
epel-release-6-8.noarch.rpm
php-common-5.3.3-27.el6_5.i686.rpm
php-cli-5.3.3-27.el6_5.i686.rpm
php-5.3.3-27.el6_5.i686.rpm
php-mbstring-5.3.3-27.el6_5.i686.rpm
php-pear-1.9.4-4.el6.noarch.rpm
php-pear-DB-1.7.13-3.el6.noarch.rpm
squirrelmail-1.4.22-4.el6.noarch.rpm
2/Cấu hình:
Di chuyển đến /usr/share/squirrelmail/config/ rồi chạy file conf.pl
# cd /usr/share/squirrelmail/config/ # ./conf.pl
Nguyễn Duy Đạt - SVTT Page 15
Bả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) --------------------------------------------------------- Main Menu -- 1. Organization Preferences 2. Server Settings 3. Folder Defaults 4. General Options
5. Themes 6. Address Books 7. Message of the Day (MOTD) 8. Plugins 9. Database 10. Languages D. Set pre-defined settings for specific IMAP servers C Turn color off S Save data Q Quit Command >> 2
Nguyễn Duy Đạt - SVTT Page 16
Trong mục Server Settings, nhập “1” → Enter → nhập mail domain → Enter
The domain name is the suffix at the end of all email addresses. If
for example, your email address is [email protected], then your domain
would be example.com.
[localhost]: athena.edu.vn
Nguyễn Duy Đạt - SVTT Page 17
Nhập “3” → Enter và đổi từ Sendmail sang SMTP
Nhập “2” → Enter để chuyển từ Sendmail sang SMTP
Nhập “s” → Enter để lưu lại, sau đó “q” → Enter để trở về menu chính
SquirrelMail Configuration : Read: config.php (1.4.0) --------------------------------------------------------- Server Settings General ------- 1. Domain : athena.edu.vn
2. Invert Time : false 3. Sendmail or SMTP : Sendmail 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 Your choice [1/2] [1]: 2
Nguyễn Duy Đạt - SVTT Page 18
Tại menu chính, nhập “d” → Enter để chọn IMAP server
Nhập “dovecot” → Enter để chọn dovecot làm IMAP server
Nhập “s” → Enter để lưu cấu hình, sau đó nhập “q” → Enter để thoát menu cấu hình