# author:sunboyu@gmail.com # qq:176300676 msn:sunboyu@gmail.com # http://www.sunboyu.cn #!/bin/sh h_path = "/root/" url="http://www.sunboyu.cn/sourse/" install_dir="/opt/" mkdir $install_dir termcap_sourse_name="termcap-1.3.1" mysql_sourse_name="mysql-5.0.22" mysql_install_dir=$install_dir$mysql_sourse_name openssl_sourse_name="openssl-0.9.8g" openssl_install_dir=$install_dir$openssl_sourse_name httpd_sourse_name="httpd-2.2.9" httpd_install_dir=$install_dir$httpd_sourse_name fastcgi_sourse_name="mod_fastcgi-2.4.6" fastcgi_install_dir=$install_dir$fastcgi_sourse_name fcgid_sourse_name="mod_fcgid.2.2" libxml2_sourse_name="libxml2-2.6.30" libxml2_install_dir=$install_dir$libxml2_sourse_name zlib_sourse_name="zlib-1.2.3" jpeg_sourse_name="jpegsrc.v6b" jpeg_install_dir=$install_dir$jpeg_sourse_name libpng_sourse_name="libpng-1.2.29" libpng_install_dir=$install_dir$libpng_sourse_name freetype_sourse_name="freetype-2.3.7" freetype_install_dir=$install_dir$freetype_sourse_name php_sourse_name="php-5.2.6" php_install_dir=$install_dir$php_sourse_name gd_sourse_name="gd-2.0.36RC1" gd_install_dir=$install_dir$gd_sourse_name ###MYSQL依赖库 wget ${url}${termcap_sourse_name}".tar.gz" tar -zxvf $termcap_sourse_name".tar.gz" cd $termcap_sourse_name ./configure make && make install cd .. #rm -rf ${termcap_sourse_name}* ###openssl wget ${url}${openssl_sourse_name}".tar.gz" tar -zxvf $openssl_sourse_name".tar.gz" cd $openssl_sourse_name ./Configure --prefix=$openssl_install_dir make && make install cd .. #rm -rf ${openssl_sourse_name}* ###libxml wget ${url}${libxml2_sourse_name}".tar.gz" tar -zxvf $libxml2_sourse_name".tar.gz" cd $libxml2_sourse_name ./configure --prefix=$libxml2_install_dir make && make install cd .. #rm -rf ${libxml2_sourse_name}* ###zlib wget ${url}${zlib_sourse_name}".tar.gz" tar -zxvf $zlib_sourse_name".tar.gz" cd $zlib_sourse_name ./configure make && make install cd .. cp /usr/lib/libz.so.1 /usr/lib/libz.so #rm -rf ${zlib_sourse_name}* ###jpeg wget ${url}${jpeg_sourse_name}".tar.gz" tar -zxvf $jpeg_sourse_name".tar.gz" cd jpeg-6b ./configure mkdir /usr/local/man/ mkdir /usr/local/man/man1/ mkdir /usr/local/man/man1/cjpeg/ make && make install cp /usr/lib/libjpeg.so.62 /usr/lib/libjpeg.so cp jpeglib.h /usr/include/jpeglib.h cp jconfig.h /usr/include/jconfig.h cp jmorecfg.h /usr/include/jmorecfg.h cp jerror.h /usr/include/jerror.h cd .. #rm -rf ${jpeg_sourse_name}.tar.gz #rm -rf jpeg-6b ###png wget ${url}${libpng_sourse_name}".tar.gz" tar -zxvf $libpng_sourse_name".tar.gz" cd $libpng_sourse_name ./configure --prefix=$libpng_install_dir make && make install cp png* /usr/include/ cd .. #rm -rf ${libpng_sourse_name}* ###freetype wget ${url}${freetype_sourse_name}".tar.gz" tar -zxvf $freetype_sourse_name".tar.gz" cd $freetype_sourse_name ./configure --prefix=$freetype_install_dir make && make install cd .. #rm -rf ${freetype_sourse_name}* ###GD2 wget ${url}${gd_sourse_name}".tar.gz" tar -zxvf $gd_sourse_name".tar.gz" cd $gd_sourse_name ./configure --prefix=$gd_install_dir --with-png=/opt/libpng-1.2.29 --with-freetype=/opt/freetype-2.3.7 --with-jpeg=/usr/lib/libjpeg.so make && make install cd .. #rm -rf ${gd_sourse_name}* ###MYSQL groupadd mysql useradd -g mysql mysql wget ${url}${mysql_sourse_name}".tar.gz" tar -zxvf $mysql_sourse_name".tar.gz" cd $mysql_sourse_name ./configure --prefix=$mysql_install_dir --without-debug --enable-thread-safe-client --with-unix-socket-path=/tmp/mysql.sock --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --enable-local-infile --enable-largefile --with-charset=utf8 --with-pic --with-mysqld-libs --with-comment --with-query-cache --with-bench --with-big-tables --with-innodb --with-mysqld-use=mysql make && make install cp ./support-files/my-medium.cnf /etc/my.cnf cp ./support-files/mysql.server /etc/init.d/mysqld chmod 755 /etc/init.d/mysqld cd .. #mkdir $mysql_install_dir/var/ echo ${mysql_install_dir}"/bin/mysqld_safe --user=mysql &">>/etc/rc.local #rm -rf ${mysql_sourse_name}* ###APACHE wget ${url}${httpd_sourse_name}".tar.gz" tar -zxvf $httpd_sourse_name".tar.gz" cd $httpd_sourse_name ./configure --prefix=$httpd_install_dir --enable-dav --enable-dav-fs --enable-modules=all --enable-mods-shared=all --enable-authz-dbm --enable-log-config --enable-headers --enable-setenvif --with-ssl=$openssl_install_dir --enable-static-ab --enable-http --enable-mime --disable-status --enable-isapi --enable-suexec --enable-vhost-alias --enable-dir --enable-rewrite --with-mpm=worker --with-included-apr --with-apr --with-apr-util --with-z make && make install cd .. ln -s $httpd_install_dir/bin/apachectl /etc/init.d/httpd echo $httpd_install_dir/bin/apachectl start>>/etc/rc.local chkconfig --level 345 httpd on echo "AddType application/x-httpd-php .php" >> $httpd_install_dir/conf/httpd.conf echo "" >> $httpd_install_dir/htdocs/index.php #rm -rf ${httpd_sourse_name}* ###fastcgi wget ${url}${fastcgi_sourse_name}".tar.gz" tar -zxvf $fastcgi_sourse_name".tar.gz" cd $fastcgi_sourse_name sed 's/\/usr\/local\/apache2/\/opt\/httpd-2.2.9\//g' Makefile.AP2 > Makefile make && make install cd .. ###fcgid wget ${url}${fcgid_sourse_name}".tgz" tar -zxvf $fcgid_sourse_name".tgz" cd $fcgid_sourse_name mv Makefile Makefile.AP2 sed 's/\/usr\/local\/apache2/\/opt\/httpd-2.2.9\//g' Makefile.AP2 > Makefile make && make install cd .. #echo LoadModule fcgid_module modules/mod_fcgid.so>>$httpd_install_dir/conf/httpd.conf #echo AddHandler fcgid-script .php>>$httpd_install_dir/conf/httpd.conf #echo "FCGIWrapper "${php_install_dir}"/bin/php-cgi .php">>$httpd_install_dir/conf/httpd.conf #rm -rf ${fastcgi_sourse_name}* ###PHP wget ${url}${php_sourse_name}".tar.gz" tar -zxvf $php_sourse_name".tar.gz" cd $php_sourse_name cp php.ini-dist php.ini ./configure --prefix=$php_install_dir --with-libxml-dir=$libxml2_install_dir --enable-cli --with-apxs2=$httpd_install_dir/bin/apxs --enable-cgi --enable-fastcgi --enable-force-cgi-redirect --enable-discard-path --enable-path-info-check --with-openssl --with-pcre-regex --enable-calendar --enable-dom --enable-ftp --with-openssl-dir=/usr/local/ssl --enable-gd-jis-conv --enable-hash --with-iconv --enable-json --enable-mbstring --enable-mbregex --enable-pdo --enable-posix --enable-libxml=$xml2_install_dir --enable-simplexml --with-sqlite --enable-tokenizer --enable-xmlreader --enable-xmlwriter --with-zlib --with-freetype-dir=$freetype_install_dir --with-gd=$gd_install_dir --with-jpeg-dir=/usr/lib/libjpeg.so --with-libpng-dir=/opt/libpng-1.2.29/lib/libpng12.so --with-zlib-dir=/usr/lib/libz.so --with-mime-magic --with-mysql=$mysql_install_dir --with-zlib-dir=/usr/lib/libz.so --with-pdo-mysql=$mysql_install_dir --with-pdo-sqlite --enable-posix --enable-soap make && make install cp php.ini $php_install_dir/lib/ cd .. $mysql_install_dir/bin/mysql_install_db --user=mysql & service httpd start service mysqld start