CÀI ĐẶT MAIL SERVER TRÊN CENTOS – DÙNG POSTFIX ...

1. Chuẩn bị

- Server CentOS

- Hostname: ns.domain.local, IP 192.168.11.8

2. Cài đặt

- Cài đặt các gói cần thiết

[root@ns ~]# yum install postfix dovecot squirrelmail

- Kiểm tra các gói đã cài đặt

- Cấu hình postfix

[root@ns ~]# vi /etc/postfix/main.cf

- Các dòng cần sửa

// sua dong 70myhostname = mail.domain.local // ten may chu mail dam bao da dc phan giai truoc do// sua dong 70, ten domainmydomain = domain.local// sua dong 93 myorigin, bo #myorigin = $mydomain// sua dong 107inet_interfaces = all// sua dong 155, them #// sua dong 156, bo #// sua dong 255, bo # khai bao mangmynetworks = 192.168.11.0/24, 127.0.0.0/8

- Startup dịch vụ postfix

[root@ns ~]# service postfix startStarting postfix: [ OK ]

- Chuyển postfix sang làm MTA mặc định

[root@ns ~]# yum install system-switch-mail[root@ns ~]# system-switch-mail[root@ns ~]# chkconfig sendmail off[root@ns ~]# chkconfig postfix on

- Cấu hình dovecot

[root@ns ~]# vi /etc/dovecot.conf

- Sửa dòng

protocols = imap imaps pop3 pop3s

- Startup dịch vụ dovecot

[root@ns ~]# service dovecot startStarting Dovecot Imap: [ OK ][root@ns ~]# chkconfig dovecot on

- Sửa cấu hình squirrelmail

[root@ns ~]# vi /etc/squirrelmail/config.php

- thay đổi dòng

$domain = ‘domain.local’;

- restart lại apache

[root@ns ~]# service httpd restartStopping httpd: [ OK ]Starting httpd: [ OK ]

- sửa thêm chút apache để vào squirrel mail bằng link mail.domain.local. Add thêm đoạn virtualhost vào cuối file httpd.conf

[root@ns ~]# vi /etc/httpd/conf/httpd.conf

- thêm

<VirtualHost *:80>ServerName mail.domain.localDocumentRoot /usr/share/squirrelmail</VirtualHost>

3. Kiểm tra

- Trên máy client đã trỏ về dns local

- Kiểm tra trên localhost

- Trên squirrelmail

Từ khóa » Cài đặt Mail Server Trên Centos 8