一:安装PHP
1:安装
[root@redhat tmp]# tar zxvf php-5.2.3.tar.gz [root@redhat tmp]# cd php-5.2.3 [root@redhat php-5.2.3]# ./configure --prefix=/usr/local/php \ --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config \ --with-apxs2=/usr/local/httpd/bin/apxs \ --with-libxml-dir=/usr/include/libxml2/libxml --with-gd=/usr/local/gd/ \ --with-png=/usr/local/png/ --with-jpeg=/usr/local/jpeg/ --with-xpm \ --with-zlib --enable-debug --enable-magic-quotes --enable-libgcc \ --enable-ftp --enable-mbstring=all --enable-sockets --with-gnu-ld [root@redhat php-5.2.3]# make [root@redhat php-5.2.3]# make install [root@redhat php-5.2.3]# cp php.ini-recommended /usr/local/php/etc/php.ini
2:配置相关文件支持
//配置httpd.conf文件 [root@redhat php-5.2.3]# vi /etc/httpd/httpd.conf AddType application/x-httpd-php .php .phtml //第352行增加 AddType application/x-httpd-php-source .phps <Directory "/var/www"> //第174行 DirectoryIndex index.html index.html.var index.php index.htm //第209行 //第126行起增加以下内容 <VirtualHost *:80> ServerName redhat.test.com DocumentRoot /var/www/extsuite/extmail/html/ ScriptAlias /extmail/cgi /var/www/extsuite/extmail/cgi Alias /extmail /var/www/extsuite/extmail/html ScriptAlias /extman/cgi /var/www/extsuite/extman/cgi Alias /extman /var/www/extsuite/extman/html SuexecUserGroup vmail vmail //suexec用户执行权限 Alias /phpadmin /var/www/phpadmin //图形管理mysql </VirtualHost>
//配置httpd-vhost.conff文件,以支持虚拟主机,先删除原有的27-43 行的内容,然后再最后增加以下内容 [root@redhat php-5.2.3]# vi /etc/httpd/extra/httpd-vhosts.conf <VirtualHost *:80> ServerName redhat.test.com DocumentRoot /var/www/extsuite/extmail/html/ ScriptAlias /extmail/cgi /var/www/extsuite/extmail/cgi Alias /extmail /var/www/extsuite/extmail/html ScriptAlias /extman/cgi /var/www/extsuite/extman/cgi Alias /extman /var/www/extsuite/extman/html SuexecUserGroup vmail vmail </VirtualHost>
3:配置phpmyadmin用于管理mysql,测试启动Apache
[root@redhat tmp]# tar zxvf phpMyAdmin-2.11.2-all-languages.tar.gz [root@redhat tmp]# mv phpMyAdmin-2.11.2-all-languages /var/www/phpadmin [root@redhat tmp]# cd /var/www/phpadmin/ [root@redhat phpadmin]# cp ./libraries/config.default.php ./config.inc.php [root@redhat phpadmin]# vi config.inc.php $cfg['Servers'][$i]['auth_type'] = 'http'; //修改144行
//建立测试文件,启动Apache [root@redhat www]# vi ./phpamin/phpinfo1.php <?php phpinfo(); ?> [root@redhat www]# /usr/local/httpd/bin/apachectl start Warning: DocumentRoot [/var/www/extsuite/extmail/html/] does not exist [root@redhat www]#//不存在的原因是还没建立相关文件,将在后面进行
二:安装Postfix
1:安装
[root@redhat tmp]# tar zxvf postfix-2.5-20071006.tar.gz [root@redhat tmp]# cd postfix-2.5-20071006 //make -f这一句请去掉所有的'\',我这里是为了显示方便,因为其中含有单引号 [root@redhat postfix-2.5-20071006]# make -f Makefile.init makefiles \ 'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include -DUSE_SASL_AUTH -DUSE_CYRUS_SASL \ -I/usr/local/sasl2/include/sasl -I/usr/local/BerkeleyDB/include -DUSE_TLS -I-DUSE_TLS -I/usr/include/openssl' \ 'AUXLIBS=-L/usr/local/mysql/lib -lmysqlclient -lz -lm -L/usr/local/sasl2/lib -lsasl2 \ -L/usr/local/BerkeleyDB/lib -L/usr/lib -lssl -lcrypto' [root@redhat postfix-2.5-20071006]# make [root@redhat postfix-2.5-20071006]# make install install_root: [/] tempdir: [/tmp/postfix-2.5-20071006] config_directory: [/etc/postfix] daemon_directory: [/usr/libexec/postfix] command_directory: [/usr/sbin] queue_directory: [/var/spool/postfix] sendmail_path: [/usr/sbin/sendmail] newaliases_path: [/usr/bin/newaliases] mailq_path: [/usr/bin/mailq] mail_owner: [postfix] setgid_group: [postdrop] html_directory: [no] /var/www/postfix_html manpage_directory: [/usr/local/man] /usr/local/postfix/man readme_directory: [no] [root@redhat postfix-2.5-20071006]# newaliases
2:建立邮件存放目录及备份旧文件
[root@redhat postfix-2.5-20071006]# mkdir -pv /var/mailbox [root@redhat postfix-2.5-20071006]# chown -R vmail.vmail /var/mailbox [[root@redhat postfix-2.5-20071006]# mv /etc/postfix/main.cf /etc/postfix/main.cf.old [root@redhat postfix-2.5-20071006]# mv /etc/postfix/master.cf /etc/postfix/master.cf.old
3:配置main.cf文件
//main.cf中的注解太多了,不如重新新建来得直观 [root@redhat postfix-2.5-20071006]# vi /etc/postfix/main.cf queue_directory = /var/spool/postfix command_directory = /usr/sbin daemon_directory = /usr/libexec/postfix mail_owner = postfix myhostname = redhat.test.com mydomain = test.com myorigin = $mydomain inet_interfaces = all mydestination = unknown_local_recipient_reject_code = 550 mynetworks = 192.168.44.0/24, 127.0.0.0/8 ############################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_local_domain = $mydomain smtpd_sasl_security_options = noanonymous smtpd_sasl_application_name = smtpd smtpd_banner = Welcome to our $myhostname ESMTP,Warning: Version not Available! #############################SASL-END############################## #############################Virtual Mailbox Settings################ virtual_mailbox_base=/var/mailbox virtual_mailbox_maps=mysql:/etc/postfix/mysql/mysql_virtual_mailbox_maps.cf virtual_mailbox_domains=mysql:/etc/postfix/mysql/mysql_virtual_domains_maps.cf virtual_alias_domains= virtual_alias_maps=mysql:/etc/postfix/mysql/mysql_virtual_alias_maps.cf virtual_uid_maps=static:1001 virtual_gid_maps=static:1001 virtual_transport=maildrop maildrop_destination_recipient_limit=1 maildrop_destination_concurrency_limit=1 #################################Mailbox END########################### #################################Quota Settings######################## message_size_limit=1433600 virtual_mailbox_limit=20791520 virtual_create_maildirsize=yes virtual_mailbox_extended=yes virtual_mailbox_limit_maps=mysql:/etc/postfix/mysql/virtual_mailbox_limit_override=yes virtual_maildir_limit_message=User's maildir has overdrawn his diskspace quota,try again later. virtual_overquota_bounce=yes ################################Quota END############################ ################################Amavis Start########################## content_filter=amavisfeed:[127.0.0.1]:10024 max_use=10 ################################Amavis END########################### debug_peer_level = 2 debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin xxgdb $daemon_directory/$process_name $process_id & sleep 5 sendmail_path = /usr/sbin/sendmail newaliases_path = /usr/bin/newaliases mailq_path = /usr/bin/mailq setgid_group = postdrop html_directory = /var/www/postfix_html manpage_directory = /usr/local/postfix/man sample_directory = /etc/postfix
4:配置master.cf文件
//注意此文件中的有空格的地方 [root@redhat postfix-2.5-20071006]# vi /etc/postfix/master.cf smtp inet n - n - - smtpd pickup fifo n - n 60 1 pickup cleanup unix n - n - 0 cleanup qmgr fifo n - n 300 1 qmgr tlsmgr unix - - n 1000? 1 tlsmgr rewrite unix - - n - - trivial-rewrite bounce unix - - n - 0 bounce defer unix - - n - 0 bounce trace unix - - n - 0 bounce verify unix - - n - 1 verify flush unix n - n 1000? 0 flush proxymap unix - - n - - proxymap smtp unix - - n - - smtp relay unix - - n - - smtp -o fallback_relay= showq unix n - n - - showq error unix - - n - - error retry unix - - n - - error discard unix - - n - - discard local unix - n n - - local virtual unix - n n - - virtual lmtp unix - - n - - lmtp anvil unix - - n - 1 anvil scache unix - - n - 1 scache maildrop unix - n n - - pipe flags=DRhu user=vmail:vmail argv=/usr/bin/maildrop -w 90 -d ${recipient} old-cyrus unix - n n - - pipe flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user} cyrus unix - n n - - pipe user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user} uucp unix - n n - - pipe flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient) ifmail unix - n n - - pipe flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient) bsmtp unix - n n - - pipe flags=Fq. user=bsmtp argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient amavisfeed unix - - n - 2 smtp -o smtp_data_done_timeout=1200 -o smtp_send_xforward_command=yes -o disable_dns_lookups=yes -o max_use=20 127.0.0.1:10025 inet n - n - - smtpd -o content_filter= -o smtpd_delay_reject=no -o smtpd_client_restrictions=permit_mynetworks,reject -o smtpd_helo_restrictions= -o smtpd_sender_restrictions= -o smtpd_recipient_restrictions=permit_mynetworks,reject -o smtpd_data_restrictions=reject_unauth_pipelining -o smtpd_end_of_data_restrictions= -o smtpd_restriction_classes= -o mynetworks=127.0.0.0/8 -o smtpd_error_sleep_time=0 -o smtpd_soft_error_limit=1001 -o smtpd_hard_error_limit=1000 -o smtpd_client_connection_count_limit=0 -o smtpd_client_connection_rate_limit=0 -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_milters -o local_header_rewrite_clients=
5:添加为支持虚拟域和虚拟用户所用到的配置文件
//直接在extman中复制过去就可以了 [root@redhat tmp]# mkdir -pv /etc/postfix/mysql [root@redhat tmp]# tar zxvf extman-0.2.3.tar.gz [root@redhat tmp]# cd /tmp/extman-0.2.3/docs [root@redhat docs]# cp ./mysql_virtual_alias_maps.cf /etc/postfix/mysql/mysql_virtual_alias_maps.cf [root@redhat docs]# cp ./mysql_virtual_limit_maps.cf /etc/postfix/mysql/mysql_virtual_mailbox_limit_maps.cf [root@redhat docs]# cp ./mysql_virtual_mailbox_maps.cf /etc/postfix/mysql/mysql_virtual_mailbox_maps.cf [root@redhat docs]# cp ./mysql_virtual_domains_maps.cf /etc/postfix/mysql/mysql_virtual_domains_maps.cf [root@redhat docs]#
6:安装pcre
//maildrop时需要 [root@redhat httpd]# tar jxvf pcre-7.2.tar.bz2 [root@redhat httpd]# cd pcre-7.2 [root@redhat pcre-7.2]# ./configure [root@redhat pcre-7.2]# make [root@redhat pcre-7.2]# make install
7:安装zlib
//clamav的新版本需zlib大于1.2.2 [root@redhat php]# tar zxvf zlib-1.2.3.tar.gz [root@redhat php]# cd zlib-1.2.3 [root@redhat zlib-1.2.3]# ./configure --prefix=/usr --shared [root@redhat zlib-1.2.3]# make [root@redhat zlib-1.2.3]# make install
三:安装courier-imap
1:安装
[root@redhat tmp]# tar jxvf courier-imap-4.1.3.tar.bz2 [root@redhat tmp]# cd courier-imap-4.1.3 [root@redhat courier-imap-4.1.3]# export COURIERAUTHCONFIG=/usr/local/authlib/bin/courierauthconfig [root@redhat courier-imap-4.1.3]# ./configure --prefix=/usr/local/imap \ --with-redhat --disable-root-check \ --enable-unicode=utf-8,iso-8859-1,gb2312,gbk,gb18030 --with-trashquota \ --with-dirsync --with-mysql-libs=/usr/local/mysql/lib \ --with-mysql-includes=/usr/local/mysql/include --with-authmysql \ --with-authmysql=yes --disable-root-check [root@redhat courier-imap-4.1.3]# make [root@redhat courier-imap-4.1.3]# make install [root@redhat courier-imap-4.1.3]# make install-configure
2:编辑配置文件启用pop3及imap
[root@redhat courier-imap-4.1.3]# vi /usr/local/imap/etc/pop3d POP3DSTART=YES //第140行 [root@redhat courier-imap-4.1.3]# vi /usr/local/imap/etc/imapd IMAPDSTART=YES //第403行
3:启动及加入自动运行队列
//建立相关网页路径 [root@redhat php-5.2.3]# mkdir -pv /var/www/extsuite mkdir: created directory `/var/www' mkdir: created directory `/var/www/extsuite'
[root@redhat courier-imap-4.1.3]# cp courier-imap.sysvinit /usr/local/imap/sbin/imapd [root@redhat courier-imap-4.1.3]# chmod +x /usr/local/imap/sbin/imapd [root@redhat courier-imap-4.1.3]# /usr/local/imap/sbin/imapd start [root@redhat courier-imap-4.1.3]# cp courier-imap.sysvinit /etc/rc.d/init.d/courier-imapd [root@redhat courier-imap-4.1.3]# chmod 755 /etc/rc.d/init.d/courier-imapd [root@redhat courier-imap-4.1.3]# chkconfig --add courier-imapd [root@redhat courier-imap-4.1.3]# chkconfig --level 2345 courier-imapd on
四:安装maildrop
1:安装
[root@redhat tmp]# tar jxvf maildrop-2.0.4.tar.bz2 [root@redhat tmp]# cd maildrop-2.0.4 [root@redhat maildrop-2.0.4]# ln -sv /usr/local/authlib/bin/courierauthconfig /usr/bin create symbolic link `/usr/bin/courierauthconfig' to `/usr/local/authlib/bin/courierauthconfig' [root@redhat maildrop-2.0.4]# ln -sv /usr/local/authlib/include/* /usr/include [root@redhat maildrop-2.0.4]#./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@redhat maildrop-2.0.4]# make [root@redhat maildrop-2.0.4]# make install [root@redhat maildrop-2.0.4]# cp /usr/local/maildrop/bin/maildrop /usr/bin [root@redhat maildrop-2.0.4]# maildrop -v maildrop 2.0.4 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.
2:配置maildrop的日志文件
[root@redhat maildrop-2.0.4]# vi /etc/maildroprc logfile "/var/log/maildrop.log" VERBOSE="4"
五:安装clamav
1:安装
[root@redhat tmp]# tar zxvf clamav-0.91.2.tar.gz [root@redhat tmp]# cd clamav-0.91.2 [root@redhat clamav-0.91.2]# ./configure --prefix=/usr/local/clamav \ --with-dbdir=/usr/local/share/clamav --disable-zlib-vcheck \ --sysconfdir=/etc/clamav [root@redhat clamav-0.91.2]# make [root@redhat clamav-0.91.2]# make install
2:新建相关的文件及目录
[root@redhat clamav-0.91.2]# mkdir /var/log/clamav [root@redhat clamav-0.91.2]# chmod -R 744 /var/log/clamav [root@redhat clamav-0.91.2]# chown -R amavis:amavis /var/log/clamav [root@redhat clamav-0.91.2]# chown -R amavis.amavis /usr/local/share/clamav [root@redhat clamav-0.91.2]# mkdir /var/run/clamav [root@redhat clamav-0.91.2]# chmod 700 /var/run/clamav [root@redhat clamav-0.91.2]# chown amavis.amavis /var/run/clamav
//freshclam.conf内容 [root@redhat clamav-0.91.2]# mv /etc/clamav/freshclam.conf /etc/clamav/freshclam.conf.old [root@redhat clamav-0.91.2]#vi /etc/clamav/freshclam.conf DatabaseDirectory /usr/local/share/clamav UpdateLogFile /var/log/clamav/freshclam.log LogVerbose yes LogSyslog yes LogFacility LOG_MAIL PidFile /var/run/freshclam.pid DatabaseOwner amavis DatabaseMirror db.CN.clamav.net DatabaseMirror database.clamav.net DatabaseMirror database.clamav.net
//clamd文件内容 [root@redhat clamav-0.91.2]# mv /etc/clamav/clamd.conf /etc/clamav/clamd.conf.old [root@redhat clamav-0.91.2]# vi /etc/clamav/clamd.conf LogFile /var/log/clamav/clamd.log LogSyslog yes LogFacility LOG_MAIL LogVerbose yes PidFile /var/run/clamav/clamd.pid DatabaseDirectory /usr/local/share/clamav LocalSocket /var/run/clamav/clamd.socket StreamMaxLength 20M User amavis ScanELF yes ScanPDF yes ScanMail yes PhishingSignatures yes
3:配置库文件及开机自启动
[root@redhat clamav-0.91.2]# cp contrib/init/RedHat/clamd /etc/rc.d/init.d/clamd [root@redhat clamav-0.91.2]# cp contrib/init/RedHat/clamav-milter /etc/rc.d/init.d/clamav-milter [root@redhat clamav-0.91.2]# chkconfig --add clamd [root@redhat clamav-0.91.2]# chkconfig --add clamav-milter [root@redhat clamav-0.91.2]# chkconfig --level 2345 clamd on [root@redhat clamav-0.91.2]# chkconfig --level 2345 clamav-milter on [root@redhat clamav-0.91.2]# echo "/usr/local/clamav/lib" >> /etc/ld.so.conf [root@redhat clamav-0.91.2]# ldconfig -v
4:启动服务及添加自动任务
[root@redhat clamav-0.91.2]# vi /etc/rc.d/init.d/clamd progdir="/usr/local/clamav/sbin" //第19行 [root@redhat clamav-0.91.2]# service clamd start Starting clamd: [ OK ] [root@redhat clamav-0.91.2]# [root@redhat clamav-0.91.2]# crontab -e 37 * * * * /usr/local/clamav/bin/freshclam //增加系统启动任务 [root@redhat clamav-0.91.2]#/usr/local/clamav/bin/freshclam ClamAV update process started at Thu Dec 6 04:09:24 2007 WARNING: Your ClamAV installation is OUTDATED! WARNING: Local version: 0.91.2 Recommended version: 0.92 DON'T PANIC! Read [url]http://www.clamav.net/support/faq[/url] Downloading main-45.cdiff [100%]
差不多快完成一半了吧,是有点累,后面的等时间再更新吧。
转载于:https://blog.51cto.com/waringid/58210