歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> 關於Linux

postfix+dovecot+maildrop+mailscanner+clamav+spamassassin搭建

安裝配置前准備:

1.改主機名(非必要,但別是除localhost之外的其他主機名了,修改主機名也是為了避免出現不必要的錯誤)

#hostname mail.test.com

#vi /etc/sysconfig/network

修改 HOSTNAME=mail.test.com

注銷再登陸,驗證一下:

#hostname

#uname -n

顯示一致,說明已經可以進行下一步了。

 

2.DNS設置

如果方便可以直接在你的域名管理後台添加mail的A記錄及MX記錄。如果暫時是測試環境那就自己建一個dns服務吧,其實也很簡單。

從www.isc.org下載bind9.8,這是當前的最新版了。

#tar zxvf bind-9.8.0.tar.gz
#cd bind-9.8.0
#./configure --prefix=/usr/local/bind --enable-threads
#make;make install
#/usr/local/bind/sbin/rndc-confgen > /usr/local/bind/etc/rndc.conf
#tail -10/usr/local/bind/etc/rndc.conf |head -9| sed s/#\// > /usr/local#/bind/etc/named.conf

#dig > /usr/local/bind/etc/named.root
 

#vim /usr/local/bind/etc/named.conf

下是我的named.conf文件:

key "rndc-key" {
algorithm hmac-md5;
secret "phTa1qrl4gZ5Th3vrV+nzQ==";
};

controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
options {
directory "/usr/local/bind";
pid-file "var/named.pid";
forwarders {
202.106.0.20;
};
};
zone "." IN {
type hint;
file "etc/named.root";
};
zone "localhost" IN {
type master;
file "etc/named.local";
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "etc/named.localarpa";
};
zone "test.com" IN {
type master;
file "etc/named.test";
};
zone "0.168.192.in-addr.arpa" IN {
type master;
file "etc/named.testarpa";
};

接下來建立這個主文件中指定的zone配置文件

(1)named.local

$TTL 86400
@ 1D IN SOA @ root.localhost. (
20110429
3H
15M
1W
1D )
1D IN NS @
1D IN A 127.0.0.1

(2)named.localarpa

$TTL 86400
@ IN SOA localhost. root.localhost. (
20110429
3H
15M
1W
1D )
IN NS localhost.
1 IN PTR localhost.

(3)named.test

$TTL 86400
@ IN SOA test.com. root.test.com.(
20110429
3H
15M
1W
1D )
IN NS @
IN MX 1 mail.test.com.
ns IN A 192.168.50.170
@ IN A 192.168.50.170
mail IN A 192.168.50.170

(4)named.testarpa

$TTL 86400
@ IN SOA test.com. root.test.com. (
20110429 ; Serial
3H ; Refresh 1d=1 days
15M ; Retry 30m=30 minutes
1W ; Expire 1w=7 days
1D ) ; Minimum ;Negative Caching
@ IN NS test.com.
IN PTR test.com.
IN PTR mail.test.com.
IN PTR ns.test.com.


#/usr/local/bind/sbin/named

 

 

 

 

 

好了以上我只是建了一個測試環境。不需要太復雜

啟動之後用nslookup,ping檢查一下看是否能正常解析,如果有錯誤會在/var/log/messages中可以看到。

 

3.amp安裝配置

我自己測試時用的系統自帶的安裝包。不過我這裡還想再操作一遍。yum這個東西很不賴,安裝軟件時可以解決rpm包的依賴性,這是我為什麼討厭使用rpm包的原因,有時候讓人抓狂。不過一些簡單的包用rpm還是蠻有效率的。

由於我的系統安裝時比較干淨,所以一些包默認沒有安裝。比如安裝PHP環境需要的一些支持圖像的軟件我的系統只裝了主程序,但相應的devel包卻沒裝。這時候用光盤鏡像制作的yum源搬上來吧。

yum install libpng

yum install libpng-devel

yum install libjpeg

yum install libjpeg-devel

yum install freetype

yum install freetype-devel

yum install zlib

yum install zlib-devel

yum install libxml2

yum install libxml2-devel

yum install gd #以上的包也是為這個gd服務的,所以要先裝好

(1)apache

#tar jxvf httpd-2.2.15.tar.bz2

#cd httpd-2.2.15
#./configure --prefix=/usr/local/apache --enable-so --enable-rewrite && make && make install

(2)mysql

groupadd mysql
useradd -g mysql -M -s /bin/false mysql
tar zxvf mysql-5.1.53-linux-i686-glibc23.tar.gz
cp -a mysql-5.1.53-linux-i686-glibc23 /usr/local/mysql
cd /usr/local/mysql
chown -R mysql:mysql .

scripts/mysql_install_db --user=mysql
cp /usr/local/mysql/support-files/my-large.cnf /etc/my.cnf
chown -R root .
chown -R mysql data
bin/mysqld_safe --user=mysql &
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 35 mysqld on
echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
ldconfig
echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile

Copyright © Linux教程網 All Rights Reserved