#!/bin/bash
cd /usr/src/
tar -jvxf httpd-2.2.16.tar.bz2
cd httpd-2.2.16
./configure --prefix=/usr/local/http --enable-so --enable-rewrite --with-mpm=worker
make
make install
/usr/local/http/bin/apachectl start
tar fvxz mysql-5.1.44.tar.gz
rpm -ivh /mnt/Server/ncurses-devel-5.5-24.20060715.i386.rpm
cd /usr/src/mysql-5.1.44
##########configure########
./configure --prefix=/usr/local/mysql --with-extra-charsets=gbk,gb2312,utf8 --with-mysqld-user=mysql --enable-thread-safe-client
make
make install
cd
useradd -r mysql
cd /usr/local/mysql/bin/
./mysql_install_db
cd /usr/local/mysql/mysql-test ; perl mysql-test-run.pl
cd /usr/local/
chown -R mysql mysql
chown mysql.mysql ./mysql/var/
cd /usr/local/mysql/bin/
./mysqld_safe &
./mysqladmin -u root password "000000"
cd /usr/src/
tar fvxj libpng-1.4.4.tar.bz2
cd libpng-1.4.4
./configure --prefix=/usr/local/libpng
make
make install
cd /usr/src/
tar zvxf jpegsrc.v8b.tar.gz
cd jpeg-8b/
./configure --prefix=/usr/local/jpeg
make
make install
cd /usr/src/
tar -zvxf freetype-2.1.10.tar.gz
cd freetype-2.1.10
./configure --prefix=/usr/local/freetype
make
make install
cd /usr/src/
tar zxvf libxml2-2.6.30.tar.gz
cd libxml2-2.6.30
./configure --prefix=/usr/local/libxml2
make
make install
cd /usr/src/
tar zxvf gd-2.0.36RC1.tar.gz
cd gd-2.0.36RC1
./configure --prefix=/usr/local/gd --with-png=/usr/local/libpng --with-jpeg=/usr/local/jpeg --with-freetype=/usr/local/freetype --with-libxml2=/usr/local/libxml2
make
make install
cd /usr/src/
tar -jxvf php-5.2.5.tar.bz2
cd php-5.2.5
./configure --prefix=/usr/local/php --enable-mbstring --with-apxs2=/usr/local/http/bin/apxs --with-mysql=/usr/local/mysql --with-config-file-path=/usr/local/php --with-libxml-dir=/usr/local/libxml2 --with-jpeg-dir=/usr/local/jpeg --with-png-dir=/usr/local/libpng --with-freetype-dir=/usr/local/freetype --with-gd=/usr/local/gd --enable-soap --enable-gd-native-ttf --enable-ftp --enable-exif --enable-xml --enable-sockets --enable-ucd-snmp-hack
make
make install
cd /usr/local/http/conf/
#vim httpd.conf
sed s'/index.html/"index.php" &/' httpd.conf
echo "AddType application/x-httpd-php .php" >> httpd.conf
#LoadModule php5_module modules/libphp5.so
#AddType application/x-httpd-php .php
cd /usr/local/http/conf/extra/
echo "DocumentRoot /usr/local/http/web1" >> httpd-vhosts.conf
echo "ServerName www.baidu.com" >> httpd-vhosts.conf
echo "DocumentRoot /usr/local/http/web2" >> httpd-vhosts.conf
echo "ServerName www.sina.com" >> httpd-vhosts.conf
cd /etc/
echo "192.168.18.107 www.baidu.com" >> /etc/hosts
echo "192.168.18.107 www.sina.com" >> /etc/hosts
########################################
/usr/local/http/bin/apachectl restart
################
cd /usr/src/web/
cp phpMyAdmin-3.3.1-all-languages.zip /usr/local/http/
cp Discuz_7.2_FULL_SC_UTF8.zip /usr/local/http/
cd /usr/local/http/
mkdir web1
mkdir web2
mv phpMyAdmin-3.3.1-all-languages.zip web1/
cd web1/
unzip phpMyAdmin-3.3.1-all-languages.zip
rm -rf phpMyAdmin-3.3.1-all-languages.zip
cd phpMyAdmin-3.3.1-all-languages/
mv ./* ../
cd ..
rm -rf phpMyAdmin-3.3.1-all-languages/
cd /usr/local/http/
mv Discuz_7.2_FULL_SC_UTF8.zip web2/
cd web2/
unzip Discuz_7.2_FULL_SC_UTF8.zip
rm -rf Discuz_7.2_FULL_SC_UTF8.zip
cd /usr/local/http/web2/upload/
chmod -R 777 templates/
chmod -R 777 p_w_uploads/
chmod -R 777 forumdata/
mv ./* ../
/usr/local/http/bin/apachectl restart
firefox http://www.sina.com/install