15、安装 maildorp
首先,将 courier-authlib 的头文件与库文件链接到 /usr 目录下,(编译 maildrop 时会此目录下寻找相关的文件)
[root @test root] # ln -s /usr/local/courier-authlib/bin/courierauthconfig /usr/bin
[root @test root] # ln -s /usr/local/courier-authlib/include/* /usr/include
Maildrop 需要 pcre 的支持,接下来首先安装 pcre
[root @test root] # tar jxvf pcre-7.4.tar.bz2
[root @test root] # cd pcre-7.4
[root @test pcre-7.4] # ./configure
[root @test pcre-7.4] # make
[root @test pcre-7.4] # make install
开始安装 maildrop
[root @test pcre-7.4] # groupadd -g 1001 vmail
[root @test pcre-7.4] # useradd -g vmail -u 1001 -M -s /bin/nologin vmail
[root @test pcre-7.4] # cd
[root @test root] # tar jxvf maildrop-2.0.2.tar.bz2
[root @test root] # cd maildrop-2.0.2
[root @test maildrop-2.0.2] # ./configure
--prefix=/usr/local/maildrop --enable-sendmail=/usr/sbin/sendmail
--enable-trusted-users='root vmail' --enable-syslog=1
--enable-maildirquota --enable-maildrop-uid=1001
--enable-maildrop-gid=1001 --with-trashquota --with-dirsync
[root @test maildrop-2.0.2] # make
[root @test maildrop-2.0.2] # make install
[root @test maildrop-2.0.2] # cp /usr/local/maildrop/bin/maildrop /usr/bin
运行 maildrop -v ,检查安装结果,请确保有“Courier Authentication Library extension enabled”这一句出现
[root @test maildrop-2.0.2] # maildrop -v
maildrop 2.0.2 Copyright 1998-2005 Double Precision, Inc.
GDBM extensions enabled.
Courier Authentication Library extension enabled.
Maildir quota extension enabled.
This program is distributed under the terms of the GNU General Public
License. See COPYING for additional information.
新建配置文件 /etc/maildroprc,首先指定 maildrop 的日志文件存放地点
[root @test maildrop-2.0.2] # vi /etc/maildroprc
添加:
logfile “/var/log/maildrop.log”
[root @test maildrop-2.0.2] # touch /var/log/maildrop.log
[root @test maildrop-2.0.2] # chown vmail.vmail /var/log/maildrop.log
配置 postfix,
编辑 /etc/postfix/master.cf
[root @test maildrop-2.0.2] # vi /etc/postfix/master.cf
启用下面这两行,将前面的注释符号去掉
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/local/maildrop/bin/maildrop -d ${recipient}
编辑 /etc/postfix/main.cf
[root @test maildrop-2.0.2] # vi /etc/postfix/main.cf
将
virtual_transport = virtual
修改为
virtual_transport = maildrop
编辑 authmysqlrc文件
[root @test maildrop-2.0.2] # vi /usr/local/courier-authlib/etc/authlib/authmysqlrc
将
MYSQL_UID_FIELD '2525'
MYSQL_GID_FIELD '2525'
修改为
MYSQL_UID_FIELD '1001’
MYSQL_GID_FIELD '1001'
注意:如果没有修改此处,maildrop 可能会报“signal 0x06” 的错误报告
编辑 apache 的配置文件
[root @test maildrop-2.0.2] # vi /usr/local/apache/conf/httpd.conf
将
User postfix
Group postfix
修改成
User vmail
Group vmail
将用户邮件所在目录 /var/mailbox 和 extman 的临时目录 /tmp/extman 的属主和属组指定为 vmail
[root @test maildrop-2.0.2] # chown -R vmail.vmail /var/mailbox
[root @test maildrop-2.0.2] # chown -R vmail.vmail /tmp/extman
重新启动 apache 和 postfix
[root @test maildrop-2.0.2] # /usr/local/apache/bin/apachectl restart
如果没有重新启动 apache,将不能通过 web 收发邮件,提示如下错误:
[root @test maildrop-2.0.2] # postfix reload
安装 clamav
[root @test root] # groupadd clamav
[root @test root] # useradd -g clamav -s /sbin/nologin -M clamav
[root @test root] # groupadd amavis
[root @test root] # useradd -g amavis -s /sbin/nologin -M amavis
[root @test root] # tar xzvf clamav-0.91.2.tar.gz
[root @test root] # cd clamav-0.91.2
[root @test clamav-0.91.2] # ./configure –prefix=/usr/local/clamav --disable-zlib-vcheck --disable-dns —disable-clamuko
[root @test clamav-0.91.2] # make
[root @test clamav-0.91.2] # make install
[root @test clamav-0.91.2] # vi /usr/local/clamav/etc/clamd.conf
# Example
LogFile /var/log/clamav/clamd.log
LogFileMaxSize 2M
LogTime yes
LogSyslog yes
LogVerbose yes
PidFile /var/run/clamd.pid
DatabaseDirectory /var/lib/clamav
LocalSocket /var/run/clamav/clamd.sock
MaxDirectoyRecursion 20
#=====================Executable Files==================
ScanPE yes
ScanELF yes
#=======================Documents=====================
ScanOLE2 yes
ScanPDF yes
#==================mail files====================
Scanmail yes
#=======================HTML========================
ScanHTML yes
#=======================Archives=======================
ScanArchive yes
ArchiveMaxFileSize 15M
ArchiveMaxRecursion 10
ArchiveMaxFiles 1500
ArchiveMaxCompressionRatio 300
[root @test clamav-0.91.2] # vi /usr/local/clamav/etc/freshclam.conf
/***这个要与 clamd.conf 里设置相同的目录
# Example
DatabaseDirectory /var/lib/clamav
UpdateLogFile /var/log/clamav/freshclam.log
LogVerbose yes
LogSyslog yes
PidFile /var/run/freshclam.pid
DatabaseMirror database.clamav.net
MaxAttempts 5
Check 24
HTTPProxyServer 192.168.98.8
HTTPProxyPort 80
ConnectTimeout 60
ReceiveTimeout 60
建立日志文件
[root @ test clamav-0.91.2] # mkdir –p /var/log/clamav
[root @ test clamav-0.91.2] # touch /var/log/clamav/clamd.log
[root @ test clamav-0.91.2] # touch /var/run/clamd.pid
[root @ test clamav-0.91.2] # touch /var/run/freshclam.pid
[root @ test clamav-0.91.2] # mkdir /var/lib/clamav
[root @ test clamav-0.91.2] # mkdir /var/run/clamav
[root @ test clamav-0.91.2] # chown –R amavis.amavis /var/log/clamav
[root @ test clamav-0.91.2] # chown –R clamav:clamav /var/run/clamd.pid /var/run/freshclam.pid
[root @ test clamav-0.91.2] # chown –R clamav:clamav /var/lib/clamav
[root @ test clamav-0.91.2] #chown –R amavis.amavis /var/run/clamav
[root @ test clamav-0.91.2] # chmod -R 776 /var/run/clamav /var/lib/clamav
[root @ test clamav-0.91.2] # chmod –R 776 /var/log/clamd
[root @ test clamav-0.91.2] # chmod –R 776 /var/run/clamd.pid /var/run/freshclam.pid
[root @ test clamav-0.91.2] # crond -e
37 * * * * /usr/local/clamav/bin/freshclam
[root @ test clamav-0.91.2] # echo “/usr/local/clamav/lib” >> /etc/ld.so.conf
[root @ test clamav-0.91.2] # ldconfig
配置 clamav 开机自启动
[root @ test clamav-0.91.2] # cp contrib/init/RedHat/clamd /etc/rc.d/init.d/clamd
[root @ test clamav-0.91.2] # cp contrib/init/RedHat/clamav-milter /etc/rc.d/init.d/clamav-milter
[root @ test clamav-0.91.2] # chkconfig --add clamd
[root @ test clamav-0.91.2] # chkconfig --add clamav-milter
[root @ test clamav-0.91.2] # chkconfig --level 345 clamd on
[root @ test clamav-0.91.2] # chkconfig —level 345 clamav-milter on
编辑 /etc/rc.d/init.d/clamd 文件,将服务进程的路径指向刚才安装 clamav 的目录
[root @ test clamav-0.91.2] # vi /etc/rc.d/init.d/clamd
将
progdir="/usr/local/sbin"
修改为
progdir="/usr/local/clamav/sbin"
[root @ test clamav-0.91.2] # service clamd start
安装 spamassassin
安装 spamassassin 需要很多 perl 模块的支持,
[root @ test clamav-0.91.2] # perl -MCPAN -e shell
/usr/lib/perl5/5.8.8/CPAN/Config.pm initialized.
CPAN is the world-wide archive of perl resources. It consists of about
100 sites that all replicate the same contents all around the globe.
Many countries have at least one CPAN site already. The resources
found on CPAN are easily accessible with the CPAN.pm module. If you
want to use CPAN.pm, you have to configure it properly.
If you do not want to enter a dialog now, you can answer 'no' to this
question and I'll try to autoconfigure. (Note: you can revisit this
dialog anytime later by typing 'o conf init' at the cpan prompt.)
Are you ready for manual configuration? [yes]
The following questions are intended to help you with the
configuration. The CPAN module needs a directory of its own to cache
important index files and maybe keep a temporary mirror of CPAN files.
This may be a site-wide directory or a personal directory.
First of all, I'd like to create this directory. Where?
CPAN build and cache directory? [/root/.cpan]
If you want, I can keep the source files after a build in the cpan
home directory. If you choose so then future builds will take the
files from there. If you don't want to keep them, answer 0 to the
next question.
How big should the disk cache be for keeping the build directories
with all the intermediate files?
Cache size for build directory (in MB)? [10]
By default, each time the CPAN module is started, cache scanning
is performed to keep the cache size in sync. To prevent from this,
disable the cache scanning with 'never'.
Perform cache scanning (atstart or never)? [atstart]
To considerably speed up the initial CPAN shell startup, it is
possible to use Storable to create a cache of metadata. If Storable
is not available, the normal index mechanism will be used.
Cache metadata (yes/no)? [yes]
The next option deals with the charset your terminal supports. In
general CPAN is English speaking territory, thus the charset does not
matter much, but some of the aliens out there who upload their
software to CPAN bear names that are outside the ASCII range. If your
terminal supports UTF-8, you say no to the next question, if it
supports ISO-8859-1 (also known as LATIN1) then you say yes, and if it
supports neither nor, your answer does not matter, you will not be
able to read the names of some authors anyway. If you answer no, names
will be output in UTF-8.
Your terminal expects ISO-8859-1 (yes/no)? [yes]
If you have one of the readline packages (Term::ReadLine::Perl,
Term::ReadLine::Gnu, possibly others) installed, the interactive CPAN
shell will have history support. The next two questions deal with the
filename of the history file and with its size. If you do not want to
set this variable, please hit SPACE RETURN to the following question.
File to save your history? [/root/.cpan/histfile]
Number of lines to save? [100]
The CPAN module can detect when a module that which you are trying to
build depends on prerequisites. If this happens, it can build the
prerequisites for you automatically ('follow'), ask you for
confirmation ('ask'), or just ignore them ('ignore'). Please set your
policy to one of the three values.
Policy on building prerequisites (follow, ask or ignore)? [ask]
The CPAN module will need a few external programs to work properly.
Please correct me, if I guess the wrong path for a program. Don't
panic if you do not have some of them, just press ENTER for those. To
disable the use of a download program, you can type a space followed
by ENTER.
Where is your gzip program? [/bin/gzip]
Where is your tar program? [/bin/tar]
Where is your unzip program? [/usr/bin/unzip]
Where is your make program? [/usr/bin/make]
Where is your links program? [/usr/bin/links]
Where is your wget program? [/usr/bin/wget]
Warning: ncftpget not found in PATH
Where is your ncftpget program? []
Warning: ncftp not found in PATH
Where is your ncftp program? []
Where is your ftp program? [/usr/kerberos/bin/ftp]
Where is your gpg program? [/usr/bin/gpg]
What is your favorite pager program? [/usr/bin/less]
What is your favorite shell? [/bin/bash]
Every Makefile.PL is run by perl in a separate process. Likewise we
run 'make' and 'make install' in processes. If you have any
parameters (e.g. PREFIX, LIB, UNINST or the like) you want to pass
to the calls, please specify them here.
If you don't understand this question, just press ENTER.
Parameters for the 'perl Makefile.PL' command?
Typical frequently used settings:
PREFIX=~/perl non-root users (please see manual for more hints)
Your choice: []
Parameters for the 'make' command?
Typical frequently used setting:
-j3 dual processor system
Your choice: []
Parameters for the 'make install' command?
Typical frequently used setting:
UNINST=1 to always uninstall potentially conflicting files
Your choice: []
ometimes you may wish to leave the processes run by CPAN alone
without caring about them. As sometimes the Makefile.PL contains
question you're expected to answer, you can set a timer that will
kill a 'perl Makefile.PL' process after the specified time in seconds.
If you set this value to 0, these processes will wait forever. This is
the default and recommended setting.
Timeout for inactivity during Makefile.PL? [0]
If you're accessing the net via proxies, you can specify them in the
CPAN configuration or via environment variables. The variable in
the $CPAN::Config takes precedence.
Your ftp_proxy? 192.168.98.8
Your http_proxy? 192.168.98.8
Your no_proxy?
If your proxy is an authenticating proxy, you can store your username
permanently. If you do not want that, just press RETURN. You will then
be asked for your username in every future session.
Your proxy user id?
You have no /root/.cpan/sources/MIRRORED.BY
I'm trying to fetch one
CPAN: LWP::UserAgent loaded ok
Fetching with LWP:
Fetching with LWP:
CPAN: Net::FTP loaded ok
Fetching with Net::FTP:
Fetching with Net::FTP:
Fetching with Net::FTP
Trying with "/usr/bin/links -source" to get
ELinks: 拒绝连接
Trying with "/usr/bin/links -source" to get
ELinks: 拒绝连接
Trying with "/usr/bin/wget -O -" to get
--18:39:55--
=> `-'
Connecting to 192.168.98.8:80... 已连接。
已发出 Proxy 请求,正在等待回应... 200 OK
长度:144,241 (141K) [text/plain]
100%[====================================>] 144,241 6.81K/s ETA 00:00
18:40:25 (6.74 KB/s) - `-' saved [144241/144241]
Now we need to know where your favorite CPAN sites are located. Push
a few sites onto the array (just in case the first on the array won't
work). If you are mirroring CPAN to your local workstation, specify a
file: URL.
First, pick a nearby continent and country (you can pick several of
each, separated by spaces, or none if you just want to keep your
existing selections). Then, you will be presented with a list of URLs
of CPAN mirrors in the countries you selected, along with previously
selected URLs. Select some of those URLs, or just keep the old list.
Finally, you will be prompted for any extra URLs -- file:, ftp:, or
http: -- that host a CPAN mirror.
(1) Africa
(2) Asia
(3) Central America
(4) Europe
(5) North America
(6) Oceania
(7) South America
Select your continent (or several nearby continents) []
Sorry! since you don't have any existing picks, you must make a
geographic selection.
(1)
(2)
(3)
Select as many URLs as you like (by number),
put them on one line, separated by blanks, e.g. '1 4 5' []
Enter another URL or RETURN to quit: []
New set of picks:
commit: wrote /usr/lib/perl5/5.8.8/CPAN/Config.pm
Terminal does not support AddHistory.
cpan shell -- CPAN exploration and modules installation (v1.7602)
ReadLine support available (try 'install Bundle::CPAN')
cpan>
以下这些博文,你可能同样感兴趣: