SlideShare ist ein Scribd-Unternehmen logo
1 von 21
Downloaden Sie, um offline zu lesen
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
Có thể tìm thấy trong DVD cài đặt CentOS
2/ Cấu hình:
Mở file /etc/postfix/main.cs, sửa những dòng sau:
## Dòng 75 – Uncomment, đặt hostname
myhostname = mail.athena.edu.vn
## Dòng 83 – Uncomment, đặt tên domain
mydomain = athena.edu.vn
## Dòng 99 - Uncomment
myorigin = $mydomain
## Dòng 116 – Sửa localhost thành all
inet_interfaces = all
## Dòng 164 – thêm $mycomain vào sau
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
## Dòng 250 - Uncomment
mynetworks_style = subnet
## Dòng 264 – Uncomment, thêm đường mạng
mynetworks = 192.168.1.0/24, 127.0.0.0/8
## Dòng 419 – Uncomment
home_mailbox = Maildir/
Nguyễn Duy Đạt - SVTT Page 7
Khởi động lại postfix, kiểm tra port:
Cài telnet:
Tạo user:
Telnet đến server
Nguyễn Duy Đạt - SVTT Page 8
Gử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
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
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings
General
-------
1. Domain : localhost
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 >> 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
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
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 >> 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
quit = Do not change anything
Command >> dovecot
Nguyễn Duy Đạt - SVTT Page 19
Mở 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
Comment các dòing: 14, 15, 16, 17, 18
Để cho phép client đăng nhập bằng http, nhập câu lệnh sau:
# setsebool -P httpd_can_network_connect=1
Khởi động lại các dịch vụ:
# service httpd restart
# service postfix restart
# service dovecot restart
1 #
2 # SquirrelMail is a webmail package written in PHP.
3 #
4
5 Alias /webmail /usr/share/squirrelmail
6
7 <Directory "/usr/share/squirrelmail/plugins/squirrelspell/modules">
8 Allow from all
9 </Directory>
10
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:
14 #<Directory /usr/share/squirrelmail>
15 # RewriteEngine on
16 # RewriteCond %{HTTPS} !=on
17 # RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
18 #</Directory>
19
Nguyễn Duy Đạt - SVTT Page 20
3/ 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
Nguyễn Duy Đạt - SVTT Page 21
Đăng nhập u2 kiểm tra email vừa gửi từ u1:

Weitere ähnliche Inhalte

Was ist angesagt?

Cấu hình network load balancing trên windows server 2008
Cấu hình network load balancing trên windows server 2008Cấu hình network load balancing trên windows server 2008
Cấu hình network load balancing trên windows server 2008laonap166
 
Báo Cáo Thực Tập PowerPoint
Báo Cáo Thực Tập PowerPointBáo Cáo Thực Tập PowerPoint
Báo Cáo Thực Tập PowerPointKhôi Nguyễn
 
Lab 1 xay dung ftp server
Lab 1 xay dung ftp serverLab 1 xay dung ftp server
Lab 1 xay dung ftp serverhoangpuon
 
Dữ liệu file windows 1
Dữ liệu file windows 1Dữ liệu file windows 1
Dữ liệu file windows 1ThienChau8
 
Php03 php trong-laptrinhwebdong
Php03 php trong-laptrinhwebdongPhp03 php trong-laptrinhwebdong
Php03 php trong-laptrinhwebdongconglongit90
 
17 ftp & ssh server
17  ftp & ssh server17  ftp & ssh server
17 ftp & ssh serverCơn Gió
 
Cài đặt exchange 2013 trên windows server 2008 r2
Cài đặt exchange 2013 trên windows server 2008 r2Cài đặt exchange 2013 trên windows server 2008 r2
Cài đặt exchange 2013 trên windows server 2008 r2laonap166
 
On tap-thi lab-mcsa-70-291-de-so-1
On tap-thi lab-mcsa-70-291-de-so-1On tap-thi lab-mcsa-70-291-de-so-1
On tap-thi lab-mcsa-70-291-de-so-1Huy Feng
 
Cài đặt web server (linux)-Pham Hoang Phuc-Athena
Cài đặt web server (linux)-Pham Hoang Phuc-AthenaCài đặt web server (linux)-Pham Hoang Phuc-Athena
Cài đặt web server (linux)-Pham Hoang Phuc-AthenaHoàng Phúc Phạm
 
Triển khai load balancing và failover cho nhiều line adsl bằng kerio winroute
Triển khai load balancing và failover cho nhiều line adsl bằng kerio winrouteTriển khai load balancing và failover cho nhiều line adsl bằng kerio winroute
Triển khai load balancing và failover cho nhiều line adsl bằng kerio winroutelaonap166
 
Lab 2 nâng cấp windows server 2003 lên windows server 2008 .pdf
Lab 2 nâng cấp windows server 2003 lên windows server 2008 .pdfLab 2 nâng cấp windows server 2003 lên windows server 2008 .pdf
Lab 2 nâng cấp windows server 2003 lên windows server 2008 .pdfPham Viet Dung
 
Dhcp nat out ubuntu
Dhcp nat out ubuntuDhcp nat out ubuntu
Dhcp nat out ubuntukarickhuy
 
Slide Báo Cáo Cuối Kỳ
Slide Báo Cáo Cuối KỳSlide Báo Cáo Cuối Kỳ
Slide Báo Cáo Cuối KỳLy ND
 
Fire wall
Fire wallFire wall
Fire wallICTU
 
Cai dat squid proxy trong suot
Cai dat  squid proxy trong suotCai dat  squid proxy trong suot
Cai dat squid proxy trong suotTHT
 
Cấu hình căn bản trên GNS3
Cấu hình căn bản trên GNS3Cấu hình căn bản trên GNS3
Cấu hình căn bản trên GNS3hoangtuvit123
 
Dịch vụ squid server
Dịch vụ squid serverDịch vụ squid server
Dịch vụ squid serverTan Phat Phung
 
Cài đặt exchange server 2013 cùng domain với exchange server 2007
Cài đặt exchange server 2013 cùng domain với exchange server 2007Cài đặt exchange server 2013 cùng domain với exchange server 2007
Cài đặt exchange server 2013 cùng domain với exchange server 2007laonap166
 

Was ist angesagt? (20)

Cấu hình network load balancing trên windows server 2008
Cấu hình network load balancing trên windows server 2008Cấu hình network load balancing trên windows server 2008
Cấu hình network load balancing trên windows server 2008
 
Lab 11 ftp server
Lab 11 ftp server  Lab 11 ftp server
Lab 11 ftp server
 
Báo Cáo Thực Tập PowerPoint
Báo Cáo Thực Tập PowerPointBáo Cáo Thực Tập PowerPoint
Báo Cáo Thực Tập PowerPoint
 
Lab 1 xay dung ftp server
Lab 1 xay dung ftp serverLab 1 xay dung ftp server
Lab 1 xay dung ftp server
 
Dữ liệu file windows 1
Dữ liệu file windows 1Dữ liệu file windows 1
Dữ liệu file windows 1
 
Php03 php trong-laptrinhwebdong
Php03 php trong-laptrinhwebdongPhp03 php trong-laptrinhwebdong
Php03 php trong-laptrinhwebdong
 
17 ftp & ssh server
17  ftp & ssh server17  ftp & ssh server
17 ftp & ssh server
 
Cài đặt exchange 2013 trên windows server 2008 r2
Cài đặt exchange 2013 trên windows server 2008 r2Cài đặt exchange 2013 trên windows server 2008 r2
Cài đặt exchange 2013 trên windows server 2008 r2
 
On tap-thi lab-mcsa-70-291-de-so-1
On tap-thi lab-mcsa-70-291-de-so-1On tap-thi lab-mcsa-70-291-de-so-1
On tap-thi lab-mcsa-70-291-de-so-1
 
Cài đặt web server (linux)-Pham Hoang Phuc-Athena
Cài đặt web server (linux)-Pham Hoang Phuc-AthenaCài đặt web server (linux)-Pham Hoang Phuc-Athena
Cài đặt web server (linux)-Pham Hoang Phuc-Athena
 
Triển khai load balancing và failover cho nhiều line adsl bằng kerio winroute
Triển khai load balancing và failover cho nhiều line adsl bằng kerio winrouteTriển khai load balancing và failover cho nhiều line adsl bằng kerio winroute
Triển khai load balancing và failover cho nhiều line adsl bằng kerio winroute
 
Lab 2 nâng cấp windows server 2003 lên windows server 2008 .pdf
Lab 2 nâng cấp windows server 2003 lên windows server 2008 .pdfLab 2 nâng cấp windows server 2003 lên windows server 2008 .pdf
Lab 2 nâng cấp windows server 2003 lên windows server 2008 .pdf
 
Dhcp nat out ubuntu
Dhcp nat out ubuntuDhcp nat out ubuntu
Dhcp nat out ubuntu
 
Slide Báo Cáo Cuối Kỳ
Slide Báo Cáo Cuối KỳSlide Báo Cáo Cuối Kỳ
Slide Báo Cáo Cuối Kỳ
 
Fire wall
Fire wallFire wall
Fire wall
 
Cai dat squid proxy trong suot
Cai dat  squid proxy trong suotCai dat  squid proxy trong suot
Cai dat squid proxy trong suot
 
Cấu hình căn bản trên GNS3
Cấu hình căn bản trên GNS3Cấu hình căn bản trên GNS3
Cấu hình căn bản trên GNS3
 
Dịch vụ squid server
Dịch vụ squid serverDịch vụ squid server
Dịch vụ squid server
 
Cài đặt exchange server 2013 cùng domain với exchange server 2007
Cài đặt exchange server 2013 cùng domain với exchange server 2007Cài đặt exchange server 2013 cùng domain với exchange server 2007
Cài đặt exchange server 2013 cùng domain với exchange server 2007
 
Mailserver
MailserverMailserver
Mailserver
 

Ähnlich wie Postfix Dovecot CentOS 6.5

bao cao tuan 34
bao cao tuan 34bao cao tuan 34
bao cao tuan 34chanhduy
 
Postfix dovecot
Postfix dovecotPostfix dovecot
Postfix dovecotthienma217
 
Báo Cáo Cuối Kỳ
Báo Cáo Cuối KỳBáo Cáo Cuối Kỳ
Báo Cáo Cuối KỳLy ND
 
Lab 7 windows server 2008 server core
Lab 7 windows server 2008 server core Lab 7 windows server 2008 server core
Lab 7 windows server 2008 server core tinhban269
 
Baocaotuan2 Mail server Linux
Baocaotuan2 Mail server LinuxBaocaotuan2 Mail server Linux
Baocaotuan2 Mail server Linuxmiti2712
 
Part 48 upgrade server 2008 - windows server core - wsc -www.key4_vip.info
Part 48   upgrade server 2008 - windows server core - wsc -www.key4_vip.infoPart 48   upgrade server 2008 - windows server core - wsc -www.key4_vip.info
Part 48 upgrade server 2008 - windows server core - wsc -www.key4_vip.infolaonap166
 
Cài đặt exchange server 2013
Cài đặt exchange server 2013Cài đặt exchange server 2013
Cài đặt exchange server 2013laonap166
 
Báo Cáo Hàng Tuần
Báo Cáo Hàng TuầnBáo Cáo Hàng Tuần
Báo Cáo Hàng TuầnBin Hoo
 
Báo cáo thực tập
Báo cáo thực tậpBáo cáo thực tập
Báo cáo thực tậpNhật Trinh
 
Báo cáo thực tập
Báo cáo thực tậpBáo cáo thực tập
Báo cáo thực tậpNhật Trinh
 
Báo cáo thực tập
Báo cáo thực tậpBáo cáo thực tập
Báo cáo thực tậpNhật Trinh
 
Hướng dẫn cài đặt mail offline mdeamon
Hướng dẫn cài đặt mail offline mdeamonHướng dẫn cài đặt mail offline mdeamon
Hướng dẫn cài đặt mail offline mdeamonlaonap166
 
Linux thietlaphethongmangubunt-45879
Linux thietlaphethongmangubunt-45879Linux thietlaphethongmangubunt-45879
Linux thietlaphethongmangubunt-45879Son Giap
 
Cài đặt và cấu hình kerio winroute
Cài đặt và cấu hình kerio winrouteCài đặt và cấu hình kerio winroute
Cài đặt và cấu hình kerio winrouteNgo Quang Khanh
 
Báo cáo thực tập (hàng tuần)
Báo cáo thực tập (hàng tuần)Báo cáo thực tập (hàng tuần)
Báo cáo thực tập (hàng tuần)Ly1473
 

Ähnlich wie Postfix Dovecot CentOS 6.5 (20)

bao cao tuan 34
bao cao tuan 34bao cao tuan 34
bao cao tuan 34
 
Postfix dovecot
Postfix dovecotPostfix dovecot
Postfix dovecot
 
Tailieu
TailieuTailieu
Tailieu
 
Vps
VpsVps
Vps
 
Báo Cáo Cuối Kỳ
Báo Cáo Cuối KỳBáo Cáo Cuối Kỳ
Báo Cáo Cuối Kỳ
 
Lab 7 windows server 2008 server core
Lab 7 windows server 2008 server core Lab 7 windows server 2008 server core
Lab 7 windows server 2008 server core
 
Baocaotuan2 Mail server Linux
Baocaotuan2 Mail server LinuxBaocaotuan2 Mail server Linux
Baocaotuan2 Mail server Linux
 
Part 48 upgrade server 2008 - windows server core - wsc -www.key4_vip.info
Part 48   upgrade server 2008 - windows server core - wsc -www.key4_vip.infoPart 48   upgrade server 2008 - windows server core - wsc -www.key4_vip.info
Part 48 upgrade server 2008 - windows server core - wsc -www.key4_vip.info
 
TỰ HỌC LPI 2
TỰ HỌC LPI 2TỰ HỌC LPI 2
TỰ HỌC LPI 2
 
Báo cáo tuần đồ án
Báo cáo tuần đồ ánBáo cáo tuần đồ án
Báo cáo tuần đồ án
 
Cài đặt exchange server 2013
Cài đặt exchange server 2013Cài đặt exchange server 2013
Cài đặt exchange server 2013
 
Báo Cáo Hàng Tuần
Báo Cáo Hàng TuầnBáo Cáo Hàng Tuần
Báo Cáo Hàng Tuần
 
Báo cáo thực tập
Báo cáo thực tậpBáo cáo thực tập
Báo cáo thực tập
 
Báo cáo thực tập
Báo cáo thực tậpBáo cáo thực tập
Báo cáo thực tập
 
Báo cáo thực tập
Báo cáo thực tậpBáo cáo thực tập
Báo cáo thực tập
 
Hướng dẫn cài đặt mail offline mdeamon
Hướng dẫn cài đặt mail offline mdeamonHướng dẫn cài đặt mail offline mdeamon
Hướng dẫn cài đặt mail offline mdeamon
 
Linux thietlaphethongmangubunt-45879
Linux thietlaphethongmangubunt-45879Linux thietlaphethongmangubunt-45879
Linux thietlaphethongmangubunt-45879
 
Bai bao cao 3
Bai bao cao 3Bai bao cao 3
Bai bao cao 3
 
Cài đặt và cấu hình kerio winroute
Cài đặt và cấu hình kerio winrouteCài đặt và cấu hình kerio winroute
Cài đặt và cấu hình kerio winroute
 
Báo cáo thực tập (hàng tuần)
Báo cáo thực tập (hàng tuần)Báo cáo thực tập (hàng tuần)
Báo cáo thực tập (hàng tuần)
 

Postfix Dovecot CentOS 6.5

  • 1. 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
  • 2. 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
  • 3. 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.
  • 4. 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
  • 5. 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
  • 6. 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 Có thể tìm thấy trong DVD cài đặt CentOS 2/ Cấu hình: Mở file /etc/postfix/main.cs, sửa những dòng sau: ## Dòng 75 – Uncomment, đặt hostname myhostname = mail.athena.edu.vn ## Dòng 83 – Uncomment, đặt tên domain mydomain = athena.edu.vn ## Dòng 99 - Uncomment myorigin = $mydomain ## Dòng 116 – Sửa localhost thành all inet_interfaces = all ## Dòng 164 – thêm $mycomain vào sau mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain ## Dòng 250 - Uncomment mynetworks_style = subnet ## Dòng 264 – Uncomment, thêm đường mạng mynetworks = 192.168.1.0/24, 127.0.0.0/8 ## Dòng 419 – Uncomment home_mailbox = Maildir/
  • 7. Nguyễn Duy Đạt - SVTT Page 7 Khởi động lại postfix, kiểm tra port: Cài telnet: Tạo user: Telnet đến server
  • 8. Nguyễn Duy Đạt - SVTT Page 8 Gử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
  • 9. 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
  • 10. 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
  • 11. 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
  • 12. 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
  • 13. 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
  • 14. 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
  • 15. 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
  • 16. Nguyễn Duy Đạt - SVTT Page 16 Trong mục Server Settings, nhập “1” → Enter → nhập mail domain → Enter SquirrelMail Configuration : Read: config.php (1.4.0) --------------------------------------------------------- Server Settings General ------- 1. Domain : localhost 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 >> 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
  • 17. 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
  • 18. 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 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 >> 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 quit = Do not change anything Command >> dovecot
  • 19. Nguyễn Duy Đạt - SVTT Page 19 Mở 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 Comment các dòing: 14, 15, 16, 17, 18 Để cho phép client đăng nhập bằng http, nhập câu lệnh sau: # setsebool -P httpd_can_network_connect=1 Khởi động lại các dịch vụ: # service httpd restart # service postfix restart # service dovecot restart 1 # 2 # SquirrelMail is a webmail package written in PHP. 3 # 4 5 Alias /webmail /usr/share/squirrelmail 6 7 <Directory "/usr/share/squirrelmail/plugins/squirrelspell/modules"> 8 Allow from all 9 </Directory> 10 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: 14 #<Directory /usr/share/squirrelmail> 15 # RewriteEngine on 16 # RewriteCond %{HTTPS} !=on 17 # RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 18 #</Directory> 19
  • 20. Nguyễn Duy Đạt - SVTT Page 20 3/ 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
  • 21. Nguyễn Duy Đạt - SVTT Page 21 Đăng nhập u2 kiểm tra email vừa gửi từ u1: