首页 | 站长技术 专题 | 下载频道 | 网页模板 | 图片素材 | 虚拟主机 | 项目市场 | 源码市场 | 本站产品 | 广告服务 | 建站论坛
文档首页
建站指南
网站编程
网站设计
图像动画
网络安全
服务器技术
数据库技术
技术专题
技术问答
您的位置:中国建站 > 站长技术 > 服务器技术 > Mail服务器 > linux下安装postfix邮件系统(一)

linux下安装postfix邮件系统(一)

作者: 来源:Blog.ChinaUnix.net 加入时间:2006-07-26

html版本:http://anstan.go.nease.net

redhat9+postfix+cyrus-sasl+mysql+postfixadmin+courier-imap+courier-maildrop+squirrelmail(courier-sqwebmail openwebmail)+clamav+spamassassin+amavisd-new

转载请注明出处
ldap(计划中)
2005年5月6日加入clamav的启动脚本
2005年5月5日加入Cyrus SASL with MySQL Encrypted Passwords
2005年5月3日更新防病毒及防垃圾
2005年4月12日加入mysql日志管理
2005年4月10日至13日加入openwebmail
2005年4月8日加入apache自启动脚本
2004年10左右成稿

1.mysql

2.apache

3.php

4.cyrus-sasl

5.postfix

6.postfixadmin

7.courier-authlib

8.courier-imap

9.courier-maildrop

10.webmail
    10.1.sqwebmai
    10.2.squirrelmail
    10.3.openwebmail

11.clamav

12.amavisd-new

13.spamassassin

14.后记加一点说明

15.附:启动脚本

本文用到的软件

1.安装mysql 4.1.11
# groupadd mysql
# useradd -g mysql mysql
# wget http://dev.mysql.com/get/Downloads/MySQL-4.1/mysql-4.1.11.tar.gz/from/http://mysql.new21.com/
# tar -zxvf mysql-4.1.11.tar.gz
# cd mysql-4.1.11
# ./configure --prefix=/usr/local/mysql --with-charset=gbk
# make
# make install
# cp support-files/my-medium.cnf /etc/my.cnf

设置自启动
# cp support-files/mysql.server /etc/rc.d/init.d/mysqld
# chmod 700 /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld

安装完以后要初始化数据库,要是升级安装的请跳过
# cd /usr/local/mysql
# /usr/local/mysql/bin/mysql_install_db --user=mysql
# chown -R root .
# chown -R mysql var
# chgrp -R mysql .
# /usr/local/mysql/bin/mysqld_safe --user=mysql &


好了,至此mysql安装完毕,你可以这样起动你的mysql服务

# /etc/rc.d/init.d/mysqld start

# ln -s /usr/local/mysql/bin/mysql /sbin/mysql
# ln -s /usr/local/mysql/bin/mysqladmin /sbin/mysqladmin


为了能让系统找到mysql,请运行如下命令
# PATH=$PATH:/usr/local/mysql/bin
# export PATH
# echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
# ldconfig

日志管理
开启错误日志 (在[safe_mysqld]项下添加)
# vi /etc/my.cnf
[safe_mysqld]
err-log=/var/log/mysqld/err.log


开启常规日志和更新日志 (在[mysqld]项下添加)
# vi /etc/my.cnf
[mysqld]
log=/var/log/mysqld/log.log
log-update=/var/log/mysqld/update.log


创建日志文件并设置权限
# mkdir /var/log/mysqld
# touch /var/log/mysqld/err.log /var/log/mysqld/log.log /var/log/mysqld/update.log
# chown -R mysql.mysql /var/log/mysqld

# service mysqld restart


说明:
错误日志包含了服务器写入标准错误输出设备的所有消息,同时还包括了mysql服务的启动和关闭事件
常规日志用来记录有关mysql服务器运行的常规信息,包括用户的连接、查询及其他各种时间
更新日志用来记录修改数据库的查询信息,包括所有涉及数据库修改的SQl语句的查询记录
建议调试结束后关闭日志

Go to top.

2.安装apache 2.0.54
# wget http://apache.freelamp.com/httpd/httpd-2.0.54.tar.bz2
# tar jxvf httpd-2.0.54.tar.bz2
# cd httpd-2.0.54
# ./configure --prefix=/usr/local/apache
# make
# make install


设置自启动
# cp support/apachectl /etc/init.d/httpd

修改/etc/init.d/httpd

# vi /etc/init.d/httpd(在第两行之后添加如下内容)
#!/bin/sh
#
# Startup script for the Apache Web Server
# chkconfig: - 85 15
# description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.
# processname: httpd
# pidfile: /usr/local/apache/log/httpd.pid
# config: /usr/local/apache/conf/httpd.conf


# chkconfig --add httpd
# chmod 755 /etc/init.d/httpd
# chkconfig httpd on


创建网页根目录
# mkdir /var/www

# vi /usr/local/apache/conf/httpd.conf
//存放网页的目录,原来为DocumentRoot "",改成:
DocumentRoot "/var/www"
//这句应该和DocumentRoot 的目录保持一致,原来为<Directory "">,改成:
<Directory "/var/www">
//Indexes:当在目录中找不到DirectoryIndex列表中指定的文件就生成当前目录的文件列表
//FollowSymlinks:允许符号链接跟随,访问不在本目录下的文件
Options Indexes FollowSymLinks
//禁止读取.htaccess配置文件的内容
AllowOverride None
//指定先执行Allow(允许)访问规则,再执行Deny(拒绝)访问规则
Order allow,deny
//设置Allow(允许)访问规则,允许所有连接
Allow from all
</Directory>

启动服务:
# /usr/local/apache/bin/apachectl start

# service httpd start

Go to top.

3.安装php 4.3.11
# wget http://cn2.php.net/get/php-4.3.11.tar.bz2/from/cn.php.net/mirror
# tar -jxvf php-4.3.11.tar.bz2
# cd php-4.3.11
# ./configure \
--prefix=/usr/local/php \
--with-mysql=/usr/local/mysql \
--with-apxs2=/usr/local/apache/bin/apxs
# make
# make install
# cp php.ini-dist /usr/local/php/lib/php.ini

# vi /usr/local/php/lib/php.ini
;default_charset = "iso-8859-1"
在这行下面加一行
default_charset = "gbk"

# vi /usr/local/apache/conf/httpd.conf
找到#AddType application/x-tar .tgz 这行,在下面加两行。

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

找到下面一行在后面加上index.php,这表示网站的默认页也能够为index.php
DirectoryIndex index.html index.html.var index.php
注意:改变了http.conf后,要重启apache服务器,否则不会生效!

php常用配置
max_execution_time = 30 ; // 改为600 (增加处理脚本的时间限制)
max_input_time = 600 ; //最大输出时间600秒
memory_limit = 8M ; //改为40M (这样才能发10M的附件)
register_global =On
post_max_size = 2M ; //php可接受的 post 方法大小 2M
file_uploads = On ; //允许上载文件
upload_max_filesize = 2M ; //最大上载文件2M
session.auto_start = 1 ; //session自动启动

Go to top.

4.安装cyrus-sasl 2.1.20
如果系统安装已经,先卸载它,或使用下面方法关闭它
# mv /usr/lib/sasl /usr/lib/sasl.OFF
# mv /usr/lib/sasl2 /usr/lib/sasl2.OFF

编译安装cyrus-sasl2.1.20
# wget ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/cyrus-sasl-2.1.20.tar.gz
# tar zxvf cyrus-sasl-2.1.20.tar.gz
# cd cyrus-sasl-2.1.20

# ./configure \
--disable-anon -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
# make
# make install

为了让postfix能找到sasl,请运行如下命令:
# echo "/usr/local/lib" >> /etc/ld.so.conf
# ldconfig

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

cyrus-sasl的密码是不加密的,可以下载加密认证补丁
# http://www.viperstrike.com/~lopaka/sysadmin/cyrus-sasl-mysql-encrypt/software-sources/patch-linux
# patch lib/checkpw.c patch-linux
重新编译安装
# LDFLAGS="-lcrypt" ./configure --disable-anon -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
# make
# make install

Go to top.

上一篇文章:架构基于FreeBSD和Postfix的邮件系统(二)
下一篇文章:linux下安装postfix邮件系统(二)
返回上页】 
 

本站在线服务QQ  程序定制:70632246 广告受理/投搞/投诉:7606208 技术客服:3828351
网站简介 广告服务 成功案例 联系方式 办公电话:0580-3825369
Copyright © 2001-2007 JZ173.COM,All rights reserved  浙ICP备05023962号 感谢【中国商务网】提供服务器