Postfix結合squirrelmail郵件服務器實現web界面的簡單的配置
1.改主機名
[root@localhost named]# vim /etc/sysconfig/network
[root@localhost named]# vim /etc/hosts(去刪掉原來的主機名)
[root@localhost named]# hostname
localhost.localdomain
[root@localhost named]# hostname mail.163.com(使改的主機名立即生效)
2.因爲用到了dns的解析,所以要把dns安裝用到的軟件包都安裝上去。
包括:bind .... Bind-chroot 和ca.. 然後做改變的東西就如下
[root@localhost etc]# cp -p named.caching-nameserver.conf named.conf
[root@localhost etc]# vim named.conf
[root@localhost etc]# vim named.rfc1912.zones (去添加163.com.zone)
[root@localhost etc]# cd ../var/named/
去複製個zone,從命名163.com.zone,並vim編輯
[root@localhost named]# service named start
啓動 named: [確定]
[root@localhost named]# chkconfig named on
[root@localhost named]# vim /etc/resolv.conf (改網關指向)
[root@localhost named]# service named start
[root@localhost named]# nslookup mail.163.com
Server: 192.168.30.120
Address: 192.168.30.120#53
Name: mail.163.com
Address: 192.168.30.120
3.Postfix的配置:
[root@localhost Server]# rpm -ivh postfix-2.3.3-2.1.el5_2.i386.rpm
[root@mail ~]# rpm -ql postfix |less
[root@localhost named]# service sendmail stop(把sendmail停掉)
[root@localhost named]# chkconfig sendmail off
[root@localhost named]# service postfix start
[root@localhost named]# netstat -tupln |grep 25
[root@localhost Server]# vim /etc/postfix/main.cf
[root@localhost named]# useradd user1
[root@localhost named]# passwd user1
1.驗證本地域才能夠發送郵件成功
查看日誌連接進入了延遲隊列
本地域發送成功
4.編輯配置文件要改變的東西
69 myhostname = mail.163.com
77 mydomain = 163.com
107 inet_interfaces = all(監聽的地址)
155 mydestination = $myhostname, localhost.$mydomain, localhost , $mydomain(定義本地域)
配置完成以後查看日誌,可以看到已經發送成功
5.如何實現postfix的中繼
此處爲telnet 登錄,是外網的地址,因爲默認不中繼外網的,只中繼本地域的
改配置文件然後重啓:可以看到已經中繼成功
255行 mynetworks = 192.168.30.0/24, 127.0.0.0/8
6.安全認證:
需要安裝sasl的軟件
[root@mail Server]# yum install -y cyrus-sasl-2.1.22-5.el5.i386.rpm
[root@mail Server]# chkconfig --list |grep sasl
saslauthd 0:關閉 1:關閉 2:關閉 3:關閉 4:關閉 5:關閉 6:關閉
[root@mail Server]# service saslauthd start
[root@mail Server]# chkconfig saslauthd on
[root@mail Server]# man 5 postconf
[root@mail ~]# vim /etc/postfix/main.cf
添加下面的內容
從外網telnet上可以看到中繼被拒絕
[root@mail ~]# echo -n "[email protected]" |openssl base64
dXNlcjFAMTYzLmNvbQ==
[root@mail ~]# echo -n "123" |openssl base64
MTIz
輸入賬號密碼發現已經可以中繼了
7.實現:http發郵件
要安裝squirrelmail-1.4.8-5.el5_3.7.noarch.rpm
安裝這個還有依賴的關係:http的和php的所以用yum安裝比較好
[root@mail Server]# yum install squirrelmail-1.4.8-5.el5_3.7.noarch.rpm
[root@mail Server]# service httpd start
[root@mail Server]# chkconfig httpd on
要想http能訪問到郵件目錄,需要在apache的主目錄下建立軟連接
[root@mail sasl2]# cd /var/www/html/
[root@mail html]# ln -s /usr/share/squirrelmail/ mail
[root@mail html]# cd mail
[root@mail mail]# ll
[root@mail mail]# cd config/
[root@mail config]# ./conf.pl
進去做一下簡單的設置
改變語言 [en_US]: zh_CN
改變字符集 [iso-8859-1]: GB2312
改變服務器的域名 [localhost]: 163.com
Sendmail 改變成smtp
[root@mail config]# vim /etc/httpd/conf/httpd.conf
去改變字符集
747行禁掉就行了 然後重啓
http:192.168.30.120/mail (http登錄)
下面出錯了,主要是沒有安裝dovecot接收郵件的服務器
用yum將dovecot安裝上就行了
[root@mail Server]# yum install dovecot-1.0.7-7.el5.i386.rpm
[root@mail Server]# service dovecot start
[root@mail Server]# chkconfig dovecot on
成功登錄