星期日, 8月 28, 2011

mail postfix

#!/bin/bash
#boot: linux ks=nfs:192.168.1.22:/nfs/ks.cfg
#export inst=/opt/cvmail
export inst=/usr/local/edward


mkdir ~/src
cd ~/src
find /mnt/cifs/src/tar -name "*gz" | xargs -t -i tar zxf {}
find /mnt/cifs/src/tar -name "*bz2" | xargs -t -i tar jxf {}
cp /mnt/cifs/src/tar/Config.pm ~/src
export MAKEFLAGS="-j4"

cd ~/src/zlib-1.2.5
./configure --prefix=$inst/zlib
make
make install

cd ~/src/libmcrypt-2.5.7
./configure --prefix=$inst/libmcrypt   --enable-dynamic-loading
make
make install
 
cd  ~/src/libiconv-1.13.1
./configure --prefix=$inst/libiconv 
make
make install

cd ~/src/perl-5.12.3
./Configure  -des -Dprefix=$inst/perl -Dinstallprefix=$inst/perl 
make install
rm -f /usr/local/edward/perl/lib/5.12.3/CPAN/Config.pm
cp ~/src/Config.pm   /usr/local/edward/perl/lib/5.12.3/CPAN/Config.pm

export PATH=$inst/perl/bin:$PATH
cd $inst/perl/bin

perl -MCPAN -e 'install Net::Server'

perl -MCPAN -e 'install IO::Multiplex'

perl -MCPAN -e 'install BerkeleyDB'


cd ~/src/openssl-0.9.8r
./config --prefix=$inst/openssl shared
make
export MAKEFLAGS="-j1"
make install
echo "$inst/openssl/lib" >>/etc/ld.so.conf
ldconfig

export MAKEFLAGS="-j4"
cd ~/src/mysql-5.1.56
libtoolize --force ; aclocal;cp -p BUILD/compile-pentium-max compile ;autoreconf
./configure --prefix=$inst/mysql --with-ssl=$inst/openssl/ssl \
        --without-debug \
        --enable-shared \
        --with-mysqld-user="mysql" \
        --with-extra-charsets=all \
        --with-innodb \
        --with-berkeley-db \
        --enable-local-infile \
        --enable-largefile \
        --enable-thread-safe-client \
        --disable-dependency-tracking \
        --with-named-thread-libs="-lpthread" 
make install
cp support-files/my-medium.cnf $inst/mysql/etc/my.cnf
cd $inst/mysql
chown -R mysql:mysql
bin/mysql_install_db --user=mysql
export PATH=$inst/mysql/bin:$PATH
echo "$inst/mysql/lib/mysql" >>/etc/ld.so.conf
ldconfig

cd ~/src/dovecot-1.2.16
export CPPFLAGS="-I$inst/mysql/include/mysql"
export LDFLAGS="-L$inst/mysql/lib/mysql"
./configure --prefix=$inst/dovecot --with-ssl=openssl --with-ssldir=$inst/openssl/ssl \
 --with-mysql --with-libiconv-prefix=$inst/libiconv 
make
make install
chown dovecot:dovecot $inst/dovecot/ -R

cd ~/src
cp imap-2007e $inst/ -R
cd $inst/imap-2007e
export SSLTYPE=nopw
make slx SSLDIR=$inst/openssl

cd ~/src/httpd-2.2.17
./configure --prefix=$inst/apache2                         --enable-modules=all --enable-pie \
--enable-proxy --enable-cache --enable-mem-cache  --enable-file-cache --enable-disk-cache \
--enable-cgid --enable-so --enable-ssl --with-ssl=$inst/openssl
make 
make install

cd ~/src/php-5.3.6
export  EXTRA_LIBS="-lresolv"
export LD_LIBRARY_PATH=$inst/openssl/lib
./configure --prefix=$inst/php --with-mysql=$inst/mysql  --with-apxs2=$inst/apache2/bin/apxs \
--with-mcrypt=$inst/libmcrypt --with-imap=$inst/imap-2007e  \
--enable-mbstring --with-config-file-path=$inst/apache2/conf --with-iconv-dir=$inst/libiconv --enable-sockets --with-pear \
--with-zlib=$inst/zlib --with-imap-ssl=$inst/openssl 
make 
make install
export PATH=$inst/php/bin:$PATH
pear install  MDB2 Mail_Mime Net_SMTP Auth_SASL



cd ~/src/clamav-0.97
./configure --prefix=$inst/clamav --with-user=clamav
make
make install

cd ~/src/clamsmtp-1.10
./configure  --prefix=$inst/clamsmtp
make 
make instll

cd ~/src/fetchmail-6.3.19
./configure --prefix=$inst/fetchmail --with-ssl  --with-libiconv-prefix=$inst/libiconv/lib --with-ssl=$inst/openssl 
make 
make install

cd ~/src
cp -R postgrey-1.33 $inst/postgrey 
chown postfix:postdrop $inst/postgrey
cd ~/src/
cp -R postfixadmin-2.3rc5 $inst/apache2/htdocs/postfixadmin 
cp -R roundcubemail-0.2-stable-dep $inst/apache2/htdocs/webmail  
cp -R rcpfa-1.0.5 $inst/apache2/htdocs/webmail/ 



cd ~/src/postfix-2.8.2

make -f Makefile.init makefiles 

make tidy
make makefiles CCARGS='-DHAS_MYSQL -I/usr/local/edward/mysql/include/mysql -DUSE_TLS -I/usr/local/edward/openssl/include/openssl \
-DUSE_SSL -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\"dovecot\" \
-DDEF_COMMAND_DIR=\"/usr/local/edward/postfix/sbin\" -DDEF_CONFIG_DIR=\"/usr/local/edward/postfix/etc\" -DDEF_DAEMON_DIR=\"/usr/local/edward/postfix/libexec\" -DDEF_DATA_DIR=\"/usr/local/edward/postfix/lib\" -DDEF_MAILQ_PATH=\"/usr/local/edward/postfix/bin/mailq\" -DDEF_NEWALIAS_PATH=\"/usr/local/edward/postfix/bin/newaliases\" -DDEF_QUEUE_DIR=\"/usr/local/edward/postfix/var/spool\" ' \
 AUXLIBS='-L/usr/local/edward/mysql/lib/mysql -lmysqlclient -lz -lm -L/usr/local/edward/openssl/lib -lssl -lcrypto -L/usr/local/edward/dovecot/lib/dovecot' 

make install