搭建Qmail的安装环境
一 安装以下必须的辅助软件
jpegsrc.v6b.tar.gz
gd-2.0.35.tar.gz
gmp-4.2.1.tar.gz
libtool-1.5.24.tar.gz
libmcrypt-2.5.8.tar.gz
libpng-1.2.18.tar.gz
mhash-0.9.9.tar.gz
openssl-0.9.7e.tar.gz
nginx-0.6.33.tar.gz
pcre-7.3.tar.gz
mrtg-2.15.2.tar.gz
安装过程基本上都是:
1)tar zxf
2)进入解压后的目录下./configure
3)make && make install
4)比较特殊的几个如下:
((1 pcre ./configure --enable-utf8 --enable-unicode-properties
((2 mrtg ./configure --prefix=/usr/local/mrtg --with-gd-lib=/usr/local/lib --with-gd-inc=/usr/local/include/
二 安装apache
httpd-2.2.4.tar.gz
安装过程中出现如下错误提示:主要意思是缺少apr和apr-util工具
libtool: install: error: cannot install `libaprutil-1.la' to a directory not ending in /usr/local/http_post/lib
*** Error code 1
Stop in /home/sysadmin/zhangzhn/mailsoft/soft/httpd-2.2.4/srclib/apr-util.
*** Error code 1
Stop in /home/sysadmin/zhangzhn/mailsoft/soft/httpd-2.2.4/srclib.
*** Error code 1
Stop in /home/sysadmin/zhangzhn/mailsoft/soft/httpd-2.2.4.
cp: /usr/local/apache/conf/httpd.conf: No such file or directory
cp: directory /usr/local/apache/htdocs does not exist
cp: directory /usr/local/apache/htdocs does not exist
反思一下:编译apache 之前要先编译apr和apr-util,如果系统 自带的话就不用编译,直接编译apache就可以了。但是,为什么一定要编译apache可移植运行库apr和apr-util呢?它们应该只是可选择安装的吧?都有哪些具体的作用呢?还是就是必须装
相关解释:。APR(Apache Portable Runtime)是一个高可移植库,它是Apache HTTP Server 2.x的核心。apr 和apr-util 这两个软件是对后端服务软件进行优化的。因为apache作为前端web服务器软件,如果要整合一些后端的web服务器软件的话,如tomcat ,就要用到这两个软件了。这两个软件系统是自带的,也可以下载源码包安装。都是要编译进apache里面去的,以模块的形式。
补救措施:
#whereis apr
#cd /usr/ports/devel/apr
#make
# cd apr-1.3.8/
#./configure --prefix=/usr/local/apr
# make && make install
#cd ../ apr-util-1.3.9/
#./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config --with-lib=/usr/local/apr/lib
#make && make install
看一下安装情况:
# ls /usr/local/apr
bin build-1 include lib libdata
# ls /usr/local/apr-util/
bin include lib libdata
apr和apr-util安装成功之后,将之前解压的httpd-2.2.4删掉,重新安装
#tar zxf httpd-2.2.4.tar.gz
#cd httpd-2.2.4
# ./configure --prefix=/usr/local/apache --enable-modules=all --enable-mods-shared==most --with-perl=/usr/bin/perl --enable-cache --enable-rewrite --enable-mime-magic --enable-ssl --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
# make
# make install
在编译的过程中出现了如下状况:主要意思是安装配置文件失败,conf不是一个目录而是一个文件,可能是之前安过的没有清理干净导致的
Installing configuration files
mkdir /usr/local/apache/conf
mkdir: /usr/local/apache/conf: File exists
mkdir /usr/local/apache/conf
mkdir: /usr/local/apache/conf: File exists
mkdir /usr/local/apache/conf/extra
mkdir: /usr/local/apache/conf: No such file or directory
*** Error code 1
Stop in /home/sysadmin/zhangzhn/mailsoft/soft/httpd-2.2.4.
*** Error code 1
Stop in /home/sysadmin/zhangzhn/mailsoft/soft/httpd-2.2.4.
# ls -l /usr/local/apache/conf 还真应对了我的上述说法,conf果真以一个文件的形式存在
-rw-r--r-- 1 root wheel 13721 May 19 15:08 /usr/local/apache/conf
那我采取的措施是删掉conf文件再重新make install
# rm -rvf /usr/local/apacheconf
# cd /home/sysadmin/zhangzhn/mailsoft/soft/httpd-2.2.4
# make install
# ls /usr/local/apache/conf/ 这次编译成功了
extra httpd.conf magic mime.types original
下面这一步是更新apache配置文件,但是后来做对比以后两个文件没有任何差别,我有点纳闷了,稍后咨询一下前辈吧
# cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bk
# cp /home/sysadmin/zhangzhn/mailsoft/installserver/httpd.conf /usr/local/apache/conf/
# diff /home/sysadmin/zhangzhn/mailsoft/installserver/httpd.conf /usr/local/apache/conf/httpd.conf
这一步是必须有的,这是用户访问web的连接 ,
# cp /home/sysadmin/zhangzhn/mailsoft/installserver/index.php /usr/local/apache/htdocs/
做完这一步之后还有很重要的操作就是将该文件做了如下更改:
将$myip = "122.70.138"; 改为 $myip = "119.254.72";
将 Header("Location: http://$myhost/newwebmail/index.php"); 中的newwebmail改为webmail
在这做一下解释为什么这么做
122是搬迁机房之前的IP,119是搬迁之后的IP;newwebmail是老版本的连接,webmail新版本的连接
# cd ..
# rm -rvf httpd-2.2.4
安装http_post的安装编译过程中由于没有指定apr路径,这个整合的apache功能无法进行编译
# ./configure --prefix=/usr/local/http_post -enable-so --enable-modules=all --enable-mods-shared=all
Configuring Apache Portable Runtime library ...
checking for APR... apr-1-config: not found
yes
setting CC to "gcc"
setting CPP to "gcc -E"
setting CFLAGS to " -g -O2"
setting CPPFLAGS to " "
setting LDFLAGS to " "
Configuring Apache Portable Runtime Utility library...
checking for APR-util... apu-1-config: not found
reconfig
configure: error: Cannot use an external APR with the bundled APR-util
[root@mx33 /home/sysadmin/zhangzhn/mailsoft/soft/httpd-2.2.4]# make
make: no target to make.
# ./configure --prefix=/usr/local/http_post -enable-so --enable-modules=all --enable-mods-shared=all --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/
# make
# make install
# cp /usr/local/http_post/conf/httpd.conf /usr/local/http_post/conf/httpd.conf.bak
# cp /home/sysadmin/zhangzhn/mailsoft/installserver/http_post.conf /usr/local/http_post/conf/httpd.conf
# diff /usr/local/http_post/conf/httpd.conf.bak /usr/local/http_post/conf/httpd.conf 这两个文件是有差别的,在这里不宜透漏
三 安装c-client
c-client.tar
tar -xf c-client.tar
cd imap-2006k.DEV.SNAP-0708301750
make bsf
cd c-client
mkdir /usr/local/imap
mkdir /usr/local/imap/include
mkdir /usr/local/imap/lib
cp *.h /usr/local/imap/include/
cp *.h /usr/local/include/
cp c-client.a /usr/local/imap/lib/
cp c-client.a /usr/local/lib/
cp c-client.a /usr/local/imap/lib/libc-client.a
cp c-client.a /usr/local/lib/libc-client.a
cd ../
cd ../
rm -rf imap-2006k.DEV.SNAP-0708301750
四 安装mysql
mysql-5.0.45.tar.gz
pw groupadd mysql
pw useradd -n mysql -g mysql
tar zxf mysql-5.0.45.tar.gz
cd mysql-5.0.45
./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --with-charset=gbk
make; make install
cp support-files/my-medium.cnf /etc/my.cnf
/usr/local/mysql/bin/mysql_install_db --user=mysql
cd /usr/local/mysql
chown -R mysql var
/usr/local/mysql/bin/mysqld_safe --user=mysql &
rm -rf mysql-5.0.45
/usr/local/mysql/bin/mysql -f -h localhost -u USER -e "use mysql;update user set Password=PASSWORD('PASSWD') where User='USER' and Host='Hostname';"
/usr/local/mysql/bin/mysql -f -h localhost -u USER -e "use mysql; flush privileges;"
紧接着就是给用户授权,这个根据自己的环境需求来做的
安装完之后,要确认一下授权是否成功
mysql> select Host,User,Password from user;
五 安装php
php-5.2.3.tar.gz 安装选项是根据生产需求而定的,最好不要全盘搬用
./configure --with-openssl /
--with-zlib /
--enable-bcmath /
--enable-calendar /
--with-jpeg-dir /
--with-tiff-dir /
--with-curl /
--enable-dba /
--with-gdbm /
--with-cdb /
--with-inifile /
--enable-ftp /
--enable-fastcgi /
--with-flatfile /
--with-gmp /
--with-mcrypt /
--with-mhash /
--with-pdo-mysql=/usr/local/mysql /
--with-pdo-sqlite /
--enable-soap /
--enable-sqlite-utf8 /
--with-libxml-dir /
--with-gd /
--with-jpeg-dir=/usr/local /
--with-xpm-dir=/usr/local /
--with-png-dir=/usr/local /
--with-zlib-dir=/usr/local /
--with-freetype /
--with-ttf=/usr/local /
--enable-gd-native-ttf /
--with-gettext=/usr/local /
--with-iconv=/usr/local /
--enable-mbstring /
--with-mysql=/usr/local/mysql /
--disable-ipv6 /
--enable-sockets /
--with-zip /
--with-imap=/usr/local /
--enable-memory-limit /
--enable-zend-multibyte /
--with-apxs2=/usr/local/apache/bin/apxs
make
make install
#cp php.ini-dist /usr/local/lib/php.ini
cp /home/sysadmin/zhangzhn/mailsoft/installserver/php.ini /usr/local/lib
perl -pi -e 's/register_globals = Off/register_globals = On/g' /usr/local/lib/php.ini
perl -pi -e 's/upload_max_filesize = 2M/upload_max_filesize = 30M/g' /usr/local/lib/php.ini
六 安装Zend
ZendOptimizer-3.0.2-freebsd6.0-i386.tar.gz
ZendOptimizer-3.3.0a-freebsd6.0-i386.tar.gz
ln -s /lib/libutil.so.8 /lib/libutil.so.5
ln -s /lib/libm.so.5 /lib/libm.so.4
ln -s /lib/libc.so.7 /lib/libc.so.6
ln -s /lib/libcrypt.so.5 /lib/libcrypt.so.3
tar zxf ZendOptimizer-3.0.2-freebsd6.0-i386.tar.gz
tar zxf ZendOptimizer-3.3.0a-freebsd6.0-i386.tar.gz
cp -p /home/sysadmin/zhangzhn/mailsoft/soft/ZendOptimizer-3.0.2-freebsd6.0-i386/zui_files/dialog /home/sysadmin/zhangzhn/mailsoft/soft/ZendOptimizer-3.3.0a-freebsd6.0-i386/zui_files
/home/sysadmin/zhangzhn/mailsoft/soft/ZendOptimizer-3.3.0a-freebsd6.0-i386/install.sh
最后记得要更新/usr/local/Zend/etc/index.php文件
# diff php.ini php.ini.old 存在以下差异
305c305
< error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING
---
> error_reporting = E_ALL & ~E_NOTICE
1276,1278c1276,1279
< zend_extension_manager.optimizer=/usr/local/Zend/lib/Optimizer-3.0.2
< zend_extension_manager.optimizer_ts=/usr/local/Zend/lib/Optimizer_TS-3.0.2
< zend_optimizer.version=3.0.2
---
> zend_extension_manager.optimizer=/usr/local/Zend/lib/Optimizer-3.3.0
> zend_extension_manager.optimizer_ts=/usr/local/Zend/lib/Optimizer_TS-3.3.0
> zend_optimizer.version=3.3.0a
>
这次安装下来出了不少问题,看来我得把这些安装过程好好捋一下头绪了,总感觉有点乱
Qmail邮件系统的安装环境已经搭建好了,之后将会继续Qmail安装过程的体验