2014-07-13 20:21:59
来 源
中存储网
Postfix
实验环境介绍:操作系统:CentOS5.5Yum源使用的是光盘制作的本地源此文档参考自fly-fish的文档yum install -y openssl openssl-devel gcc gcc-c++libtermcap-devel gd gd-devel

实验环境介绍:

操作系统:CentOS5.5

Yum源使用的是光盘制作的本地源

此文档参考自fly-fish的文档

 

yum install -y openssl openssl-devel gcc gcc-c++ libtermcap-devel gd gd-devel flex libxml2 libxml2-devel gdbm gdbm-devel pcre-devel

 

 

tar zxvf mysql-5.0.56.tar.gz

cd mysql-5.0.56

 ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/var --with-unix-socket-path=/tmp/mysql.sock --enable-assembler --with-mysqld-ldflags=-all-static --with-low-memory --with-charset=utf8 --with-extra-charsets=gbk,gb2312 --enable-thread-safe-client

make && make install

 

拷贝MySQL配置文件

cp support-files/my-medium.cnf /etc/my.cnf

 

建立MySQL组和用户

groupadd -g 27 mysql

useradd -u 27 -g mysql -s /sbin/nologin -M mysql

 

初始化数据库

/usr/local/mysql/bin/mysql_install_db --user=mysql

chown -R root.mysql /usr/local/mysql

chown -R mysql /usr/local/mysql/var/

 

动态自动加载MySQL库文件

echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf

ldconfig

 

Mysql环境变量设置

echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile

source /etc/profile

 

设置MySQL开机自动启动

cp support-files/mysql.server /etc/init.d/mysqld

chmod u+x /etc/init.d/mysqld

chkconfig --add mysqld

chkconfig mysqld on

 

启动MySQL

service mysqld start

 

修改mysql的root用户密码为“root”

mysqladmin -u root password root

mysql -uroot –proot可以登录数据库查看

 

 

tar zxvf cyrus-sasl-2.1.22.tar.gz

cd cyrus-sasl-2.1.22

 ./configure --prefix=/usr/local/sasl2 --disable-gssapi --disable-anon --disable-sample --disable-digest --enable-plain --enable-login --enable-sql --with-mysql=/usr/local/mysql/ --with-mysql-includes=/usr/local/mysql/include/mysql/ --with-mysql-libs=/usr/local/mysql/lib/mysql/ --with-authdaemond=/usr/local/courier-authlib/var/spool/authdaemon/socket

make && make install

 

建立系统lib连接及缓存

ln -s /usr/local/sasl2/lib/* /usr/lib

ln -s /usr/local/sasl2/lib/* /usr/local/lib

ln -s /usr/local/sasl2/include/sasl/* /usr/local/include/

ln -s /usr/local/sasl2/include/sasl/* /usr/include/

echo "/usr/local/sasl2/lib" >> /etc/ld.so.conf

echo "/usr/local/sasl2/lib/sasl2" >> /etc/ld.so.conf

ldconfig

 

建立启动目录,调试启动测试

mkdir -p /var/state/saslauthd

/usr/local/sasl2/sbin/saslauthd -a shadow pam –d

正式启动,登录测试

/usr/local/sasl2/sbin/saslauthd -a shadow pam

建立测试用户:

useradd test

passwd test

/usr/local/sasl2/sbin/testsaslauthd -u test -p 123

0: OK "Success."   测试成功

 

开机自动启动

echo "/usr/local/sasl2/sbin/saslauthd -a shadow pam" >> /etc/rc.local

 

 

tar zxvf httpd-2.2.6.tar.gz

cd httpd-2.2.6

 ./configure --prefix=/usr/local/apache --enable-so --with-mpm=worker --enable-nonportable-atomics=yes --enable-ssl --enable-usertrack --enable-rewrite --enable-zlib --enable-suexec --with-suexec-docroot=/var/www --with-suexec-caller=daemon --with-ssl=/usr/lib/openssl/

make && make install

 

vim /usr/local/apache/conf/httpd.conf

修改DocumentRoot "/var/www"

修改<Directory />

     Options FollowSymLinks

     AllowOverride None

     Order deny,allow

     Deny from all  (改为Allow from all)

   </Directory>

修改<Directory "/usr/local/httpd/htdocs">(改为/var/www)

修改ServerName 本机ip:80

 

设置Apache开机启动

echo "/usr/local/apache/bin/apachectl start" >> /etc/rc.local

 

 

tar zxvf php-5.1.4.tar.gz

cd php-5.1.4

 ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql/ --with-zlib --with-gd --enable-mbstring –with-config-file-path=/usr/local/php –enable-sockets

make && make install

 

建立php配置文件

cp php.ini-dist /usr/local/php/php.ini

修改Apache配置文件

vim /usr/local/apache/conf/httpd.conf

找到这一行:LoadModule php5_module        modules/libphp5.so

在下面添加:

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

调整主页

<IfModule dir_module>

    DirectoryIndex index.html index.php

</IfModule>

 

测试php是否成功安装:

vim /var/www/index.php

<?php

phpinfo();

?>

启动Apache测试

http://serverIP/index.php

 

 

 

挂在光盘,安装bind服务

rpm -ivh bind-9.3.6-4.P1.el5_4.2.i386.rpm

rpm -ivh bind-devel-9.3.6-4.P1.el5_4.2.i386.rpm

rpm -ivh bind-utils-9.3.6-4.P1.el5_4.2.i386.rpm

rpm -ivh bind-chroot-9.3.6-4.P1.el5_4.2.i386.rpm

rpm -ivh caching-nameserver-9.3.6-4.P1.el5_4.2.i386.rpm

 

cd /var/named/chroot/etc

cp -p named.rfc1912.zones named.rfc1912.zones.bak

postfix <wbr>安装

vim named.rfc1912.zones

在文件末尾添加如下:

zone "test.com" IN {

        type master;

        file "test.com.zone";

};

 

zone "100.168.192.in-addr.arpa" IN {

        type master;

        file "100.168.192.rev";

};

cd ../var/named/

cp -p localhost.zone test.com.zone

cp -p named.local 100.168.192.rev

vim test.com.zone

postfix <wbr>安装

vim 100.168.192.rev

postfix <wbr>安装

vim ../../etc/named.caching-nameserver.conf

修改如下:

listen-on port 53 { any; };

allow-query     { any; };

allow-query-cache { any; };

启动服务

/etc/init.d/named start

echo "nameserver 192.168.100.1" >> /etc/resolv.conf

 

测试DNS

postfix <wbr>安装

 

 

系统如果安装了sendmail,请先关闭服务

service sendmail stop

chkconfig sendmail off

 

建立所需用户组和用户

groupadd -g 105 postfix

groupadd -g 106 postdrop

useradd -g postfix -u 105 -s /sbin/nologin -M postfix

 

tar zxvf postfix-2.6.2.tar.gz

cd postfix-2.6.2

安装db*-devel;否则会报错

yum install -y db*-devel

 

 make makefiles 'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include/mysql -DUSE_CYRUS_SASL -DUSE_SASL_AUTH -I/usr/local/include/sasl' 'AUXLIBS=-L/usr/local/mysql/lib/mysql -lmysqlclient -lm -lz -L/usr/local/lib -lsasl2 -L/usr/lib -lssl -lcrypto'

make && make install

 

mv /etc/aliases /etc/aliases.off

ln -s /etc/postfix/aliases /etc/aliases

postfix默认不允许给root发邮件,所以给root用户建立别名

echo "root:admin@mail.test.com" >> /etc/postfix/aliases

postalias /etc/postfix/aliases

使用postconf工具简化postfix配置文件main.cf,只保留与默认配置不同的参数,提高易读性和可编辑性

postconf -n > /etc/postfix/main.cf.tmp

cd /etc/postfix/

mv main.cf main.cf.bak

mv main.cf.tmp main.cf

配置Postfix,调整运行参数

vim main.cf

增加如下参数:

myhostname = mail.test.com

myorigin = $mydomain

mydomain = test.com

#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

mydestination =  #若使用虚拟账户,这里为空,如果不是,则将上面的变量填写

mynetworks = 127.0.0.1,192.168.100.0/24

local_recipient_maps = unix:passwd.byname $alias_maps

alias_maps = hash:/etc/postfix/aliases

alias_database = hash:/etc/postfix/aliases

inet_interfaces = all

smtp_helo_name = mail.test.com

注:

需要特别注意的是mydomain和myhostname,这2个项的值不要设置成一样,否则postfix将不能正确启动,虚拟邮箱不可用。
myorigin参数用来指明发件人所在的域名;
mydestination参数指定postfix接收邮件时收件人的域名,即您的postfix系统要接收到哪个域名的邮件;
myhostname 参数指定运行postfix邮件系统的主机的主机名,默认情况下,其值被设定为本地机器名;
mydomain参数指定您的域名,默认情况下,postfix将myhostname的第一部分删除而作为mydomain的值;
mynetworks 参数指定你所在的网络的网络地址,postfix系统根据其值来区别用户是远程的还是本地的,如果是本地网络用户则允许其访问;
inet_interfaces 参数指定postfix系统监听的网络接口;

 

设置开机启动

echo "/usr/sbin/postfix start" >> /etc/rc.local

启动postfix

/usr/sbin/postfix start

可以发送邮件测试

 

开启postfix的cyrus-sasl认证

postfix <wbr>安装

 

如果postconf命令显示上边结果,则说明postfix支持cyrus-sasl认证。

 

添加postfix对cyrus-sasl的支持

vim /etc/postfix/main.cf

添加如下内容:

#---------cyrus-sasl--------

broken_sasl_auth_clients = yes

smtpd_recipient_restrictions=permit_mynetworks,permit_sasl_authenticated,reject_invalid_hostname,reject_non_fqdn_hostname,reject_unknown_sender_domain,reject_non_fqdn_sender,reject_non_fqdn_recipient,reject_unknown_recipient_domain,reject_unauth_pipelining,reject_unauth_destination

smtpd_sasl_auth_enable = yes

smtpd_sasl_security_options = noanonymous

smtpd_banner = Welcome to our $myhostname ESMTP,Warning: Nonauthorized login is not recommended.

 

开启cyrus-sasl对smtp认证的支持

vim /usr/local/lib/sasl2/smtpd.conf

pwcheck_method: saslauthd

mech_list: PLAIN LOGIN

 

测试认证结果:

postfix reload

telnet localhost 25

Trying 127.0.0.1...

Connected to localhost.localdomain (127.0.0.1).

Escape character is '^]'.

220 Welcome to our mail.test.com ESMTP,Warning: Nonauthorized login is not recommended.

ehlo mail.test.com

250-mail.test.com

250-PIPELINING

250-SIZE 10240000

250-VRFY

250-ETRN

250-AUTH DIGEST-MD5 LOGIN PLAIN CRAM-MD5

250-AUTH=DIGEST-MD5 LOGIN PLAIN CRAM-MD5

250-ENHANCEDSTATUSCODES

250-8BITMIME

250 DSN

有红色的两行则说明认证开启成功

 

添加postfix对虚拟域和虚拟用户的支持(即添加MySQL支持)

vim /etc/postfix/main.cf

 

#------Virtual Mailbox Settings-------

virtual_mailbox_base = /var/mailbox

virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf

virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf

virtual_alias_domains =

virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf

virtual_uid_maps = static:105

virtual_gid_maps = static:105

virtual_transport = virtual

maildrop_destination_recipient_limit = 1

maildrop_destination_concurrency_limit = 1

#-------QUOTA Settings------

message_size_limit = 14336000

virtual_mailbox_limit = 20971520

virtual_create_maildirsize = yes

virtual_mailbox_extended = yes

virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf

virtual_mailbox_limit_override = yes

virtual_maildir_limit_message = Sorry, the user's maildir has overdrawn his diskspace quota, please Tidy your mailbox and try again later.

virtual_overquota_bounce = yes

 

注:需要注意virtual_uid_maps及virtual_gid_maps的值,它是postfix用户的uid和postfix组的gid,与文件/usr/local/courier-authlib/etc/authlib/authmysqlrc的"MYSQL_UID_FIELD""MYSQL_GID_FIELD"一定要保持一致。

虚拟域及虚拟用户的配置文件在extman的源代码中有提供。在安装extman时会说明操作。

 

 

安装配置Courier-authlib

 

tar jxvf courier-authlib-0.62.4.tar.bz2

cd courier-authlib-0.62.4

 ./configure --prefix=/usr/local/courier-authlib --without-authpam --without-authldap --without-authpwd --without-authshadow --without-authvchkpw --without-authpgsql --with-mysql-libs=/usr/local/mysql/lib/mysql/ --with-mysql-includes=/usr/local/mysql/include/mysql/

make && make install

 

chmod 755 /usr/local/courier-authlib/var/spool/authdaemon

cp /usr/local/courier-authlib/etc/authlib/authdaemonrc.dist /usr/local/courier-authlib/etc/authlib/authdaemonrc

cp /usr/local/courier-authlib/etc/authlib/authmysqlrc.dist /usr/local/courier-authlib/etc/authlib/authmysqlrc

 

vim /usr/local/courier-authlib/etc/authlib/authdaemonrc

authmodulelist="authmysql"

authmodulelistorig="authmysql"

daemons=10

 

vim /usr/local/courier-authlib/etc/authlib/authmysqlrc

MYSQL_SERVER        localhost

     MYSQL_USERNAME    extmail

     MYSQL_PASSWORD    extmail

     MYSQL_SOCKET       /tmp/mysql.sock

     MYSQL_PORT          3306

     MYSQL_DATABASE     extmail

     MYSQL_USER_TABLE   mailbox

     MYSQL_CRYPT_PWFILED   password

     MYSQL_UID_FIELD     105

     MYSQL_GID_FIELD     105

     MYSQL_LOGIN_FIELD   username

     MYSQL_HOME_FIELD   concat('/var/mailbox/',homedir)

     MYSQL_NAME_FIELD        name

     MYSQL_MAILDIR_FIELD   concat('/var/mailbox/',maildir)

注:authdaemonrc及authmysqlrc文件中都不能使用空格,间隔用TAB来实现。

 

echo "/usr/local/courier-authlib/lib/courier-authlib" >> /etc/ld.so.conf

ldconfig

 

设置开机自动启动

cp courier-authlib.sysvinit /etc/init.d/courier-authlib

chmod u+x /etc/init.d/courier-authlib

chkconfig --add courier-authlib

chkconfig courier-authlib on           

启动服务

/etc/init.d/courier-authlib start

 

 

配置Courier-imap(dovecot也可以)

 

tar jxvf courier-imap-4.1.3.tar.bz2

cd courier-imap-4.1.3

 ./configure --prefix=/usr/local/courier-imap --enable-unicode --disable-root-check --with-trashquota --without-ipv6 --with-redhat CPPFLAGS='-I/usr/local/courier-authlib/include -I/usr/include/openssl' LDFLAGS='-L/usr/local/courier-authlib/lib/courier-authlib' COURIERAUTHCONFIG='/usr/local/courier-authlib/bin/courierauthconfig'

make && make install

 

cd /usr/local/courier-imap/etc/

cp pop3d.dist pop3d

cp imapd.dist imapd

cp pop3d-ssl.dist pop3d-ssl

cp imapd-ssl.dist imapd-ssl

vim pop3d

修改:POP3DSTART=YES

vim imapd

修改:IMAPDSTART=YES

 

mkdir /var/mailbox

chown -R postfix /var/mailbox

 

设置开机启动

cd –

cp courier-imap.sysvinit /etc/init.d/courier-imapd

chmod u+x /etc/init.d/courier-imapd

chkconfig --add courier-imapd

chkconfig courier-imapd on

 

启动服务

/etc/init.d/courier-imapd start

 

重新配置smtp认证,使其支持使用courier-authlib从MySQL调用用户验证信息

vim /usr/local/lib/sasl2/smtpd.conf

pwcheck_method: authdaemond

mech_list:PLAIN LOGIN

log_level: 3

authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socket

 

 

 

tar zxvf extmail-1.2.tar.gz

mkdir /var/www/extsuite                                 

mv extmail-1.2 /var/www/extsuite/extmail

cp /var/www/extsuite/extmail/webmail.cf.default /var/www/extsuite/extmail/webmail.cf

vim /var/www/extsuite/extmail/webmail.cf

SYS_USER_LANG = zh_CN

SYS_MAILDIR_BASE = /var/mailbox

SYS_MYSQL_USER = extmail

SYS_MYSQL_PASS = extmail

SYS_MYSQL_DB = extmail

SYS_MYSQL_HOST = localhost

SYS_MYSQL_SOCKET = /tmp/mysql.sock

SYS_AUTHLIB_SOCKET = /usr/local/courier-authlib/var/spool/authdaemon/socket

 

配置Apache支持extmail

由于extmail要进行本地邮件的投递操作,故必须将运行apache服务器用户的身份修改为您的邮件投递代理的用户;本例中打开了apache服务器的suexec功能,故使用以下方法来实现虚拟主机运行身份的指定。此例中的MDA为postfix自带,因此将指定为postfix用户:

vim /usr/local/apache/conf/httpd.conf

在文件末尾添加:

NameVirtualHost *:80

<VirtualHost *:80>

ServerName mail.test.com

DocumentRoot /var/www/extsuite/extmail/html/

ScriptAlias /extmail/cgi /var/www/extsuite/extmail/cgi

Alias /extmail /var/www/extsuite/extmail/html

SuexecUserGroup postfix postfix

</VirtualHost>

 

修改Apache对extmail_cgi的访问权限

chown -R postfix.postfix /var/www/extsuite/extmail/cgi/ 

去掉extmail的plugin插件(这些插件会在邮件打开时访问其它服务器,进而可能会产生不必要的流量,而且会严重影响速度)

mv /var/www/extsuite/extmail/html/plugins/ /var/www/extsuite/extmail/html/plugins2

 

安装extmail运行时依赖的包

rpm -ivh perl-Unix-Syslog-0.100-1.2.el5.rf.i386.rpm

rpm -ivh libmysql10-3.23.52-1mdk.i586.rpm

 

tar zxvf DBD-mysql-3.0008.tar.tar

cd DBD-mysql-3.0008

PATH=$PATH:/usr/local/mysql/bin/

export PATH

perl Makefile.PL

make && make install

 

出现错误:

Can't locate DBI/DBD.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at Makefile.PL line 23.

安装DBI解决问题

tar zxvf DBI-1.607.tar.gz

cd DBI-1.607

perl Makefile.PL

make

make test

make install

 

 

重启Apache服务,访问页面测试:

http://IP/extmail

 

 

 

 

 

tar zxvf extman-0.2.5.tar.gz

mv extman-0.2.5 /var/www/extsuite/extman

vim /var/www/extsuite/extman/webman.cf

修改如下:

SYS_MAILDIR_BASE = /var/mailbox

SYS_MYSQL_USER = extmail

SYS_MYSQL_PASS = extmail

SYS_MYSQL_DB = extmail

SYS_MYSQL_HOST = localhost

SYS_MYSQL_SOCKET = /tmp/mysql.sock

 

chown -R postfix.postfix /var/www/extsuite/extman/cgi/

引入extmail数据表结构

cd /var/www/extsuite/extman/docs/

mysql -uroot -p < extmail.sql

mysql -uroot -p < init.sql

在MySQL中建立extmail账户,并赋予其extmail数据库管理权限

mysql> GRANT all privileges on extmail.* to extmail@localhost identified by 'extmail';

Query OK, 0 rows affected (0.00 sec)

 

mysql> GRANT all privileges on extmail.* to extmail@127.0.0.1 identified by 'extmail';

Query OK, 0 rows affected (0.00 sec)

 

复制postfix虚拟用户配置文件到/etc/postfix

cp mysql_virtual_* /etc/postfix/

 

vim /etc/postfix/mysql_virtual_alias_maps.cf

vim /etc/postfix/mysql_virtual_domains_maps.cf

vim /etc/postfix/mysql_virtual_mailbox_maps.cf

vim /etc/postfix/mysql_virtual_sender_maps.cf

更改这些文件里:hosts = 127.0.0.1

 

配置Apache支持extman

vim /usr/local/apache/conf/httpd.conf

NameVirtualHost *:80

<VirtualHost *:80>

ServerName mail.test.com

DocumentRoot /var/www/extsuite/extmail/html/

ScriptAlias /extmail/cgi /var/www/extsuite/extmail/cgi

Alias /extmail /var/www/extsuite/extmail/html

SuexecUserGroup postfix postfix

ScriptAlias /extman/cgi /var/www/extsuite/extman/cgi  #在原有基础上添加这两行

Alias /extman /var/www/extsuite/extman/html

</VirtualHost>

去掉extman的plugin插件(这些插件会在邮件打开时访问其它服务器,进而可能会产生不必要的流量,而且会严重影响速度)

mv /var/www/extsuite/extman/html/plugins/ /var/www/extsuite/extman/html/plugins2

 

安装extman中用于显示校验码的插件perl-GD

rpm -ivh perl-GD-2.35-1.el5.rf.i386.rpm

 

修改extman登录时使用的校验码位数

vi /var/www/extsuite/extman/webman.cf

 

# sys_captcha_len

SYS_CAPTCHA_LEN = 4

取消验证改为0就可以了

SYS_CAPTCHA_ON = 0

 

测试:

http://IP/extman

进入邮箱服务器的后台,添加域与添加用户邮箱。默认管理账号为:root@extmail.org密码为:extmail*123* 。开通邮件服务器自动注册邮箱服务,只需要编辑该域,将“允许自由注册邮箱”前面打上勾即可。

登录若提示出错,手动建立目录,并赋予权限就可以了

 

mkdir /tmp/extman

chown -R postfix.postfix /tmp/extman/

 

使用extmail图形日志:

安装Time::HiRes

tar zxvf Time-HiRes-1.9707.tar.gz

cd Time-HiRes-1.9707

perl Makefile.PL

make

make test

make install

 

安装File::Tail

tar zxvf File-Tail-0.99.3.tar.gz

cd File-Tail-0.99.3

perl Makefile.PL

make

make test

make install

 

安装rrdtool

yum -y install libart_lgpl-devel* libpng-devel* tcl-devel* freetype* libpng*

tar zxvf rrdtool-1.2.23.tar.tar

cd rrdtool-1.2.23

./configure --prefix=/usr/local/rrdtool

make && make install

如出现这个错:

configure: error: Please fix the library issues listed above and try again.

装上以下包:libart_lgpl-devel,libpng-devel,tcl-devel,freetype,libpng

如果出現 make[3]: *** [tclrrd.o] 错误 1

make[3]: Leaving directory `/home/cacti/rrdtool-1.2.10/bindings/tcl'

make[2]: *** [all-recursive] 错误 1

make[2]: Leaving directory `/home/cacti/rrdtool-1.2.10/bindings'

make[1]: *** [all-recursive] 错误 1

make[1]: Leaving directory `/home/cacti/rrdtool-1.2.10'

make: *** [all] 错误 2

可以./configure --prefix=/usr/local/rrdtool

--disable-tcl

 

复制mailgraph_ext到/usr/local,并启动

cp -r /var/www/extsuite/extman/addon/mailgraph_ext /usr/local/

/usr/local/mailgraph_ext/mailgraph-init start       

 

启动报错:Can't locate RRDs.pm in @INC.....

解决方法:

#find /usr -name "RRDs.pm"

# ln -sv /usr/local/rrdtool/lib/perl/5.8.8/i386-linux-thread-multi/RRDs.pm /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/

再启动:报错:Can't locate loadable ojbect for module RRDs

解决:

# ln -sv /usr/local/rrdtool/lib/perl/5.8.8/i386-linux-thread-multi/auto/RRDs/RRDs.so  /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/

再启动ok(如果碰到少别的模块都可以用查找链接这种方法解决,找不到就是没安装咯,一个是pm模块,一个是so库)

/usr/local/mailgraph_ext/qmonitor-init start

 

打开extman后台管理,打开图形日志,没报错就ok啦。

 

加入开机启动:

echo "/usr/local/mailgraph_ext/mailgraph-init start" >> /etc/rc.local

 

至此邮件服务器基本搭建成功!!!

 

 

 

ln -sv /usr/local/courier-authlib/bin/courierauthconfig /usr/bin/

ln -sv /usr/local/courier-authlib/include/* /usr/include/

groupadd vmail -g 1001

useradd -u 1001 -g 1001 vmail

tar jvxf maildrop-2.4.3.tar.bz2

cd maildrop-2.4.3

./configure --enable-sendmail=/usr/sbin/sendmail --enable-trusted-users='root vmail' --enable-syslog=1 --enable-maildirquota --enable-maildrop-uid=1001 --enable-maildrop-uid=1001 --with-trashquota --with-dirsync

make

make install

 

[root@mail maildrop-2.4.3]# maildrop -v

maildrop 2.4.2 Copyright 1998-2005 Double Precision, Inc.

GDBM/DB extensions enabled.

Courier Authentication Library extension enabled.   #请确保有这么一句!

Maildir quota extension are now always enabled.

This program is distributed under the terms of the GNU General Public

License. See COPYING for additional information.

 

vim /etc/maildroprc

logfile "/var/log/maildrop.log"

touch /var/log/maildrop.log

chown -R vmail.vmail /var/log/maildrop.log

 

vim /etc/postfix/main.cf

virtual_transport = maildrop

maildrop_destination_recipient_limit = 1

virtual_uid_maps = static:105==》virtual_uid_maps = static:1001

virtual_gid_maps = static:105==》virtual_gid_maps = static:1001

 

 

vim /etc/postfix/master.cf

maildrop  unix                           pipe

  flags=DRhu user=vmail argv=/usr/local/bin/maildrop -w 90 -d ${user}@${nexthop} ${recipient} ${user} ${extension}${nexthop}

 

vim /usr/local/courier-authlib/etc/authlib/authmysqlrc

MYSQL_UID_FIELD         105==》MYSQL_UID_FIELD         1001

MYSQL_GID_FIELD         105==》MYSQL_GID_FIELD         1001

 

vim /usr/local/apache/conf/httpd.conf

<VirtualHost *:80>

ServerName mail.test.com

DocumentRoot /var/www/extsuite/extmail/html/

ScriptAlias /extmail/cgi /var/www/extsuite/extmail/cgi

Alias /extmail /var/www/extsuite/extmail/html

SuexecUserGroup postfix postfix ==>SuexecUserGroup vmail vmail

ScriptAlias /extman/cgi /var/www/extsuite/extman/cgi

Alias /extman /var/www/extsuite/extman/html

</VirtualHost>

 

chown -R vmail.vmail /var/mailbox/

chown -R vmail.vmail /tmp/extman/

chown -R vmail.vmail /var/www/extsuite/extman/cgi/

chown -R vmail.vmail /var/www/extsuite/extmail/cgi/

 

重启服务:

/etc/init.d/courier-authlib restart

postfix reload

/usr/local/apache/bin/apachectl restart

 

使用邮件客户端无法发送邮件,但是可以接收,查看日志,错误信息为:

Nov 22 23:42:58 mail postfix/smtpd[3259]: warning: SASL authentication problem: unable to open Berkeley db /etc/sasldb2: No such file or directory

Nov 22 23:42:58 mail postfix/smtpd[3259]: warning: SASL authentication problem: unable to open Berkeley db /etc/sasldb2: No such file or directory

Nov 22 23:42:58 mail postfix/smtpd[3259]: warning: unknown[10.1.1.170]: SASL LOGIN authentication failed: authentication failure

解决:

cp /usr/local/sasl2/lib/sasl2/smtpd.conf /etc/sasl2/

cp /usr/local/sasl2/lib/sasl2/smtpd.conf /etc/sasldb2/

 

 

最新的clamav-0.96.2需要zlib-1.2.2以上的版本的支持,而centos5上的版本为zlib-1.2.3因此不需要升级

添加运行clamav所需用户和组

groupadd clamav

useradd -g clamav -s /sbin/noglin -M clamav

添加配合amavisd-new使用的用户amavis

groupadd amavis

useradd -g amavis -s /sbin/noglin -M amavis

tar zxvf clcd clamav-0.96.2

amav-0.96.2.tar.gz

./configure --prefix=/usr/local/clamav --with-dbdir=/usr/local/clamav/share --sysconfdir=/etc/clamav

make

make install

make check 时候出错了

 

 

 

声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。