CentOS5.3+Nginx0.7.57+Postfix+Extmail邮件系统安装配置(一))

说明:关于邮件配置这几篇文章,主要参考的是作者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.1network services)
6. base             (5.1 没有单独列出)
相关软件下载地址:
 
       http://prdownloads.sourceforge.net/courier/courier-authlib-0.62.2.tar.bz2
       http://asg3.andrew.cmu.edu/pub/cyrus-mail/cyrus-sasl-2.1.22.tar.gz
       http://jaist.dl.sourceforge.net/sourceforge/pcre/pcre-7.8.tar.gz
       http://www.postfix.cn/source/official/postfix-2.5.6.tar.gz
       http://nchc.dl.sourceforge.net/sourceforge/courier/courier-imap-4.4.1.tar.bz2
       http://switch.dl.sourceforge.net/sourceforge/courier/maildrop-2.0.4.tar.bz2
       http://fontconfig.org/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 �Cp shutdown
2.      设置密码
mysqladmin -u root password 'new-password'     
3. 添加 /usr/local/webserver/mysql5/bin 到环境变量
   v i /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
/***
** 由于 jpeg 的安装脚本中 , 没有创建文件夹 , 因此我们得手动给他创建好文件夹 **/
Shell> mkdir �Cp /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> 
 
  </section> 
 
  <workers> 
 
    <section name="pool"> 
 
      <value name="name">default</value> 
 
      <value name="listen_address">127.0.0.1:9000</value> 
 
      <value name="listen_options"> 
 
        <value name="backlog">-1</value> 
 
        <value name="owner"></value> 
        <value name="group"></value> 
        <value name="mode">0666</value> 
      </value> 
 
      <value name="php_defines"> 
        <value name="sendmail_path">/usr/sbin/sendmail -t -i</value> 
        <value name="display_errors">1</value> 
      </value> 
 
        <value name="user">vmail</value> 
 
        <value name="group">vmail</value> 
 
      <value name="pm"> 
 
        <value name="style">static</value> 
 
        <value name="max_children">25</value> 
 
        <value name="apache_like"> 
 
          <value name="StartServers">10</value> 
 
          <value name="MinSpareServers">5</value> 
 
          <value name="MaxSpareServers">25</value> 
 
        </value> 
 
      </value> 
 
      <value name="request_terminate_timeout">0s</value> 
 
      <value name="request_slowlog_timeout">0s</value> 
 
      <value name="slowlog">logs/slow.log</value> 
 
      <value name="rlimit_files">51200</value> 
 
      <value name="rlimit_core">0</value> 
 
      <value name="chroot"></value> 
 
      <value name="chdir"></value> 
 
      <value name="catch_workers_output">yes</value> 
 
      <value name="max_requests">500</value> 
 
      <value name="allowed_clients">127.0.0.1</value> 
 
      <value name="environment"> 
        <value name="HOSTNAME">$HOSTNAME</value> 
        <value name="PATH">/usr/local/bin:/usr/bin:/bin</value> 
        <value name="TMP">/tmp</value> 
        <value name="TMPDIR">/tmp</value> 
        <value name="TEMP">/tmp</value> 
        <value name="OSTYPE">$OSTYPE</value> 
        <value name="MACHTYPE">$MACHTYPE</value> 
        <value name="MALLOC_CHECK_">2</value> 
      </value> 
 
    </section> 
 
  </workers> 
 
</configuration>
起动php-cgi进程:
/usr/local/phpcgi/sbin/php-fpm start
4.NGINX安装
 @nginx 版本 :0.7.57
步骤 :
####################################################
#
./configure --user=vmail --group=vmail --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
# make && make install
###################################################
# more /usr/local/nginx/conf/fcgi.conf
#fastcgi.conf
fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx;
fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;
fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

你可能感兴趣的:(nginx,centos,postfix,ExtMail,SPAM)