在 RedHat 中安装 Postfix + courier + MySQL

准备工作
安装编译环境:

# yum groupinstall 'Development Tools'
# yum groupinstall 'Development Libraries'
# yum install mysql-devel postgresql-devel expect libtool-ltdl-devel gamin-devel pcre-devel
编译时需要在普通用户下进行,添加一个用户:

# useradd username
# passwd username
使用"visudo"命令来配置 sudo ,添加用户:

root        ALL=(ALL)   ALL
username    ALL=(ALL)   ALL
切换至此用户:

# su username
创建工作目录:

$ mkdir $HOME/rpm
$ mkdir $HOME/rpm/SOURCES
$ mkdir $HOME/rpm/SPECS
$ mkdir $HOME/rpm/BUILD
$ mkdir $HOME/rpm/SRPMS
$ mkdir $HOME/rpm/RPMS
$ mkdir $HOME/rpm/RPMS/i386

$ echo "%_topdir $HOME/rpm" >> $HOME/.rpmmacros

mkdir $HOME/downloads
安装 Postfix
由于 RedHat 自带的 Postfix 包不支持 MySQL,所以我们需要重新打包一个新的版本。

下载源码包并安装:

# wget
# rpm -ivh postfix-2.5.9-1.src.rpm
修改编译参数:

# cd /usr/src/redhat/SPECS
# vi postfix.spec
将"postfix.spec"中的以下内容:

%define with_cdb 0
%define with_ldap 1
%define with_mysql 0
%define with_mysql_redhat 0
%define with_pcre 0
%define with_pgsql 0
%define with_sasl 0
%define with_spf 0
%define with_dovecot 0
%define with_tls 1
%define with_tlsfix 2
%define with_vda 0
修改为:

%define with_cdb 0
%define with_ldap 0
%define with_mysql 0
%define with_mysql_redhat 1
%define with_pcre 0
%define with_pgsql 0
%define with_sasl 2
%define with_spf 0
%define with_dovecot 1
%define with_tls 1
%define with_tlsfix 2
%define with_vda 0
重新制做 rpm 包:

# rpmbuild -ba postfix.spec
安装新打包的Postfix:

# cd /usr/src/redhat/RPMS/i386
# rpm -ivh postfix-2.5.9-1.rhel5.i386.rpm
安装 courier-imap, courier-authlib, maildrop
1、下载源码包:

$ cd $HOME/downloads
$ wget
$ wget
$ wget
2、创建 courier-imap 的RPM包并安装:

生成RPM包:

$ cd $HOME/downloads
$ sudo rpmbuild -ta courier-authlib-0.62.4.tar.bz2
安装RPM包:

$ cd $HOME/rpm/RPMS/i386
$ sudo rpm -ivh courier-authlib-0.62.4-1.i386.rpm
$ sudo rpm -ivh courier-authlib-devel-0.62.4-1.i386.rpm
$ sudo rpm -ivh courier-authlib-mysql-0.62.4-1.i386.rpm
3、创建 courier-authlib 的RPM包并安装:

生成RPM包:

$ cd $HOME/downloads
$ rpmbuild -ta courier-imap-4.6.0.tar.bz2
注意生成命令前不加"sudo"。

安装RPM包:

$ cd $HOME/rpm/RPMS/i386
$ sudo rpm -ivh courier-imap-4.6.0-1.i386.rpm
4、创建 maildrop 的RPM包并安装:

生成RPM包:

$ cd $HOME/downloads
$ sudo rpmbuild -ta maildrop-2.2.0.tar.bz2
安装RPM包:

$ cd $HOME/rpm/RPMS/i386
$ sudo rpm -ivh maildrop-2.2.0-1.i386.rpm
安装其它软件
实现 SMTP 发信认证需要安装"cyrus-sasl"程序,直接使用 YUM 来安装:

# yum install cyrus-sasl cyrus-sasl-sql
安装其它常用软件:

# yum install fetchmail mutt

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wygppg.html