分类: LINUX
2011-10-30 19:43:52
postfix源码包升级
将本机的postfix-2.6.6升级到postfix-2.8.5
#rpm -q postfix //查看当前版本
#postconf -m //查看支持的对象
#postconf -a
#postconf -A //发现postfix支持cyrus dovecot
升级时,我们需要重新编译源码包,并加入相关对mysql cyrus的支持
#tar zxf postfix-2.8.5.tar.gz
#cd postfix-2.8.5
#cd README_FILES/
查看说明文档
#less MYSQL_README /make 查找make字符串
make -f Makefile.init makefiles \
'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include' \
'AUXLIBS=-L/usr/local/mysql/lib -lmysqlclient -lz -lm'
由于安装mysql时的二进制包,函数库路径不同,故需查看自己的主机环境
#rpm -ql mysql-devel //若没安装请自行安装
/usr/include/mysql
/usr/lib64/mysql/xxxxxx
编译时,需对相关路径进行修改
#make -f Makefile.init makefiles \
'CCARGS=-DHAS_MYSQL -I/usr/include/mysql' \
'AUXLIBS=-L/usr/lib64/mysql -lmysqlclient -lz -lm'
此时只加入了对mysql的支持,如要加入cyrus-sasl tls的支持,需加入相关参数
#less SASL_README
Cyrus SASL version 2.1.x
% make tidy # if you have left-over files from a previous build
% make makefiles CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
-I/usr/local/include/sasl" AUXLIBS="-L/usr/local/lib -lsasl2"
Cyrus SASL version 1.5.x
% make tidy # if you have left-over files from a previous build
% make makefiles CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
-I/usr/local/include" AUXLIBS="-L/usr/local/lib -lsasl"
以上说明了对于不同cyrus sasl版本的不同编译方法,编译前需先查看
#rpm -ql cyrus-sasl-devel //若没安装请安装
同理
#less TLS_README
* If the OpenSSL include files (such as ssl.h) are in directory /usr/include/
openssl, and the OpenSSL libraries (such as libssl.so and libcrypto.so) are in directory /usr/lib:
% make tidy # if you have left-over files from a previous build
% make makefiles CCARGS="-DUSE_TLS" AUXLIBS="-lssl -lcrypto"
* If the OpenSSL include files (such as ssl.h) are in directory /usr/local/
include/openssl, and the OpenSSL libraries (such as libssl.so and
libcrypto.so) are in directory /usr/local/lib:
% make tidy # if you have left-over files from a previous build
% make makefiles CCARGS="-DUSE_TLS -I/usr/local/include" \
AUXLIBS="-L/usr/local/lib -lssl -lcrypto"
以上说明,针对不同的openssl安装路径的不同,有不同的安装方式
#rpm -ql openssl-devel
#make tidy 或 make clean //清除刚才的编译文件,以便重新编译;也可删除该目录,再重新解压缩,再编译
本机最后完整编译方式为
#make -f Makefile.init makefiles 'CCARGS=-DHAS_MYSQL -I/usr/include/mysql -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl -DUSE_TLS' 'AUXLIBS=-L/usr/lib64/mysql -lmysqlclient -lz -lm -L/usr/lib64/ -lsasl2 -lssl -lcrypto '
注意:编译路径须在postfix-2.8.5这个解压缩目录类
编译过程中可能需要一些其他软件包,如db*-devel
#yum install db*-devel
#make upgrade //升级
#postconf -m //发现少了对ldap的支持
#postconf -a
#postconf -A