Tải bản đầy đủ (.docx) (14 trang)

Cấu hình mail server postfix, dovecot, squirrelmail CentOS

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (375.4 KB, 14 trang )

_ Chuẩn bị:
_Mail server:
+ Hệ điều hành : CentOS
+ Địa chỉ IP : 192.168.0.160/24
+ Hostname : mail.yakult.local
_ DNS server:
+ Địa chỉ IP: 192.168.30.179/24
+ Hostname : SRV-DC
+ DNS : 192.168.30.179
_ Client :
+ Địa chỉ IP: 10.10.10.60/24
+ DNS : 192.168.30.179
_Trên mail server:
#yum remove sendmail
_ Edit file /etc/hosts:
#vi /etc/hosts

_ Edit file /etc/selinux/config:
#vi /etc/selinux/config


#reboot

_ Cài đặt postfix:
#yum install postfix
_ Edit file /etc/postfix/main.cf:
#vi /etc/postfix/main.cf
75 myhostname = mail.duycv.local
83 mydomain = duycv.local
99 myorigin = $mydomain
113 inet_interfaces = all


116 #inet_interfaces = localhost
164 #mydestination = $myhostname, localhost.$mydomain, localhost
165 mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
264 mynetworks = 0.0.0.0/0
419 home_mailbox = Maildir/
680 message_size_limit = 10485760 (10Mb) (thêm dòng)

_ Cài đặt Dovecot
#yum install dovecot
_ Edit file /etc/dovecot/dovecot.conf :
# vi /etc/dovecot/dovecot.conf
+ Dòng 24: protocols = imap pop3 lmt
_ Edit file /etc/dovecot/conf.d/10-mail.conf :
#vi /etc/dovecot/conf.d/10-mail.conf
+ Dòng 24: mail_location = maildir:~/Maildir
_ Edit file /etc/dovecot/conf.d/10-auth.conf :


#vi /etc/dovecot/conf.d/10-auth.conf
+ Dòng 10: disable_plaintext_auth = no
+ Dòng 100: auth_mechanisms = plain login
_ Edit file /etc/dovecot/conf.d/10-master.conf:
#vi /etc/dovecot/conf.d/10-master.conf
95 # Postfix smtp-auth
96 unix_listener /var/spool/postfix/private/auth {
97 mode = 0666
98 user = postfix
99 group = postfix
100 }
_ Cấu hình SSL:

_ Di chuyển vào thư mục /etc/pki/tls/certs:
#cd /etc/pki/tls/certs
#make server.key -> setup pass key
#openssl rsa -in server.key -out server.key -> nhập pass key
#make server.csr


#openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 365
_Edit file /etc/postfix/main.cf:
#vi /etc/postfix/main.cf
_ Thêm vào cuối file những dòng sau:
smtpd_use_tls = yes
smtpd_tls_cert_file = /etc/pki/tls/certs/server.crt
smtpd_tls_key_file = /etc/pki/tls/certs/server.key
smtpd_tls_session_cache_database = btree:/etc/postfix/smtpd_scache
_ Edit file /etc/postfix/master.cf :
#vi /etc/postfix/master.cf
26 smtps

inet n

-

n

-

-

27 -o syslog_name=postfix/smtps

28 -o smtpd_tls_wrappermode=yes
_ Edit file /etc/dovecot/conf.d/10-ssl.conf
#vi /etc/dovecot/conf.d/10-ssl.conf:
8 ssl = yes
14 ssl_cert = 15 ssl_key = _ Start/ Restart dịch vụ postfix:
# systemctl restart postfix
# systemctl enable postfix
_Start dịch vụ Dovecot :
#systemctl restart dovecot
#systemctl enable dovecot

smtpd


_ Mở port firewall:
#firewall-cmd --permanent --add-port={25,80,110,143,443,465,587,993,995}/tcp
#firewall-cmd –reload

_ Chú ý: Nếu lỗi
#systemctl disable firewalld
#reboot
#systemctl stop firewalld

_ Sử dụng app mail thunderbird kết nối đến mail server:





_ Cài đặt Squirrelmail :
_ Cài đặt Repel Repository :
Squirrelmail webmail client khơng có sẵn trên các repository của CentOS. Vì vậy chúng
ta cần enable EPEL repository :
# yum install epel-release
# yum install squirrelmail
_ Di chuyển đến thư mục /usr/share/squirrelmail/config/:
# cd /usr/share/squirrelmail/config/
_ Chạy lệnh để cấu hình Squirrelmail :
# ./conf.pl
_ Bảng lựa chọn sẽ hiển thị:
+ Chọn 1 : Organization Preferences

_ Bảng wizard kế tiếp sẽ hiển thị :
+ Chọn 1: Organization Name


+ Đặt tên tổ chức và enter: [SquirrelMail]: duycv

_ Tương tự, thiết lập tiếp các thông tin khác như Title, Logo, nhà cung cấp tên miền
ở bảng bên dưới. Một khi đã hoàn thành, bấm nút “ S “ để lưu lại thay đổi, và bấm
“ R “ để trở về menu chính :
_ Đổi logo trong /usr/share/squirrelmail/images/

_ Tiếp theo, bấm “ 2 “ , để setup cho mail server các thông số như domain name,
mail agent…


_ Chọn “ 1 “, nhập vào domain name của bạn ( VD : duycv.local ), và bấm Enter :



_ Chọn “ 3 “ để chuyển từ Sendmail sang SMTP :


_ Chọn “ 2 “ SMTP:

_ Xong nhấn “ S “ tiếp theo là “ Q “ để save và exit bảng cấu hình Squirrelmail.


_ Edit file /etc/httpd/conf/httpd.conf :
# vi /etc/httpd/conf/httpd.conf
+ tại cuối file, thêm vào những dòng này :
Alias /webmail /usr/share/squirrelmail
<Directory /usr/share/squirrelmail>
Options Indexes FollowSymLinks
RewriteEngine On
AllowOverride All
DirectoryIndex index.php
Order allow,deny
Allow from all
</Directory>
_ Restart lại Apache Server :
# systemctl restart httpd
_ Truy cập Webmail :
+ Vào trình duyệt gõ http://ip-address/webmail hoặc http://domain-name/webmail :





×