说明:关于邮件配置这几篇文章,主要参考的是作者sery博客,里边还有一些作者的内容.本篇配置,大部分软件版本与原作者的都不相同.同时,里边更新了一些新的内容,如WEBServer 采用nginx,系统版本采用CentOS5.3.这几篇命名为原创不是作者的本意,为了避免误解,现更改为转载.但,整篇配置确是作者一步步配置.在原作者的配置上也发现了一些新的问题.本人会继续开源软件的研究和实践.
系统平台:CentOS5.3
1. nginx……………………………………………web server
2. Mysql…………………………………………… 用数据库存储用户信息
3. Php………………………………………………php(fastcgi)
4. Authlib………………………………………… 与sasl一起做验证
5. Sasl ……………………………………………验证方法
6. Postfix ……………………………………… smtp邮件发送服务主程序
7. Courier-imap…………………………………pop3 邮件接收主程序
8. Pcre ……………………………………………安装Imap需要perl正则表达式
9. Maildrop…………………………………………邮件投递代理,邮件转发到用户邮箱
10. clamav……………………………………………杀毒软件
11. amavisd-new………………………………………邮件病毒扫描
12. Mail-SpamAssassin………………………………防垃圾邮件
CentOS5.3系统安装包,一定要选的6个包。
1、system tools
2、administration tools
3、development tools
4、development libraries
5、network servers (5.1为network services)
6. base (5.1没有单独列出)
相关软件下载地址:
http://prdownloads./courier/courier-authlib-0.62.2.tar.bz2
http://asg3.andrew./pub/cyrus-mail/cyrus-sasl-2.1.22.tar.gz
http://jaist.dl./sourceforge/pcre/pcre-7.8.tar.gz
http://www./source/official/postfix-2.5.6.tar.gz
http://nchc.dl./sourceforge/courier/courier-imap-4.4.1.tar.bz2
http://switch.dl./sourceforge/courier/maildrop-2.0.4.tar.bz2
http:///release/fontconfig-2.6.0.tar.gz
ftp://ftp.openpkg.org/sources/DST/xpm/xpm-3.4k.tar.gz
以下是具体安装步骤:
一.PHP(FastCGI)环境
一.PHP(FastCGI)环境
1.MySQL安装
@版本:mysql-5.0.41.tar.gz
安装过程:
……………………………安装开始………………………………………………
# groupadd mysql
# useradd -g mysql mysql
#./configure --prefix=/usr/local/mysql --with-extra-charsets=gb2312,gbk
--with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
--with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static
--sysconfdir=/etc --enable-assembler
# make && make install
# scripts/mysql_install_db --user=mysql //数据库安装
# bin/mysqld_safe --user=mysql & //起动mysqld
…………………………安装结束……………………………………………
echo "/usr/local/mysql/lib/mysql">> /etc/ld.so.conf //postfix编译里会用到
基本操作:
1. 起动/关闭MySQL
/usr/local/mysql/bin/mysqld_safe &
/usr/local/mysql/bin/mysqladmin -u root –p shutdown
2. 设置密码
mysqladmin -u root password 'new-password'
3. 添加 /usr/local/webserver/mysql5/bin 到环境变量
vi /etc/profile
export PATH=$PATH:/usr/local/mysql/bin
2. GD相关安装
1. @版本libpng-1.2.29.tar.gz
###################################################
shell> tar zxvf libpng-1.2.29.tar.gz
shell> cd libpng-1.2.29
shell> ./configure
shell> make
shell> make install
###################################################
2.版本jpegsrc.v6b.tar.gz
#############################################################
shell> tar zxvf jpegsrc.v6b.tar.gz
shell> cd jpeg-6b
Shell> mkdir –p /usr/local/jpeg/bin
Shell> mkdir /usr/local/jpeg/lib
Shell> mkdir /usr/local/jpeg/include
Shell> mkdir /usr/local/jpeg/man
Shell> mkdir /usr/local/jpeg/man1
Shell> mkdir /usr/local/jpeg/man/man1
Shell> ./configure --prefix=/usr/local/jpeg --enable-shared --enable-static
Shell> make && make install
#################################################
3. @版本freetype-2.3.7.tar.gz
#############################################
shell> tar zxvf freetype-2.3.7.tar.gz
shell> cd freetype-2.3.7
shell> ./configure //不指定目录,方便以下RRDTool安装
shell> make && make install
##############################################
4.@版本 fontconfig-2.6.0.tar.gz
#################################################
Shell> tar zxvf fontconfig-2.6.0.tar.gz && cd font*
Shell> ./configure --prefix=/usr/local/fontconfig --with-freetype-config=/usr/local/bin/freetype-config
Shell> make && make install
##################################################
5. @版本 gd-2.0.35.tar.gz
GD库安装以前先把以上几个安装上,这个安装是有一定顺序的。
###############################################
Shell> tar zxvf gd-2.0.35.tar.gz
Shell> cd gd-2.0.35
Shell> ./configure --prefix=/usr/local/gd
--with-png
--with-jpeg=/usr/local/jpeg
--with-freetype
--with-fontconfig=/usr/local/fontconfig
Shell> make && make install
###############################################
** Configuration summary for gd 2.0.34:
Support for PNG library: yes
Support for JPEG library: yes
Support for Freetype 2.x library: yes
Support for Fontconfig library: yes
Support for Xpm library: no
Support for pthreads: yes
faq:
1> cd . && /bin/sh /usr/local/src/gd-2.0.35/config/missing --run aclocal-1.9 -I config
aclocal:configure.ac:64: warning: macro `AM_ICONV' not found in library
cd . && /bin/sh /usr/local/src/gd-2.0.35/config/missing --run automake-1.9 --foreign
cd . && /bin/sh /usr/local/src/gd-2.0.35/config/missing --run autoconf
configure.ac:64: error: possibly undefined macro: AM_ICONV
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
make: *** [configure] Error 1
解决:
重新make 一下,如果不行,可以安装下边的包
安装gettext包
安装方式: shell> yum install gettext 或通过手动下载gettext包
3.PHP(FastCGI)模式安装
@php版本:5.2.6
#gzip -cd php-5.2.9-fpm-0.5.10.diff.gz | patch -d php- 5.2.9 -p1
步骤:
###########################################################
#./configure --prefix=/usr/local/phpcgi --with-config-file-path=/usr/local/phpcgi/etc --with-mysql=/usr/local/mysql --with-gd=/usr/local/gd --with-jpeg-dir=/usr/local/jpeg --with-png-dir=/usr/local/lib --with-freetype-dir=/usr/local/lib --enable-mbstring --enable-mbregex --enable-bcmath --enable-sockets --with-xsl --with-curl --with-curlwrappers --enable-fastcgi --enable-force-cgi-redirect --enable-discard-path --with-openssl --enable-fpm
# make && make install
#cp php.ini-recommended /usr/local/phpcgi/etc/php.ini
######################################################
# /usr/local/phpcgi/etc/php-fpm.conf
<?xml version="1.0" ?>
<configuration>
<section name="global_options">
<value name="pid_file">/usr/local/phpcgi/logs/php-fpm.pid</value>
<value name="error_log">/usr/local/phpcgi/logs/php-fpm.log</value>
<value name="log_level">notice</value>
<value name="emergency_restart_threshold">10</value>
<value name="emergency_restart_interval">1m</value>
<value name="process_control_timeout">5s</value>
<value name="daemonize">yes</value>