复制粘贴即可,详细解释就不说了,你懂得~

软件包在http://down.51cto.com/data/614450 

自行创建 mkdir /root/lamp   把软件包放到这里就行了 

格式转换 $ sed -e 's/.$//' mydos.txt > myunix.txt

tar -xvjf httpd-2.2.16.tar.bz2
cd httpd-2.2.16
./configure --with-mpm=prefork --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-nonportable-atormics --enable-mods-shared=most --enable-so
make
make instal

echo "<Directory /var/www/html>" >>/usr/local/apache2/conf/httpd.conf
echo "Options FollowSymLinks +Indexes" >>/usr/local/apache2/conf/httpd.conf
echo "AllowOverride None" >>/usr/local/apache2/conf/httpd.conf
echo "Order allow,deny" >>/usr/local/apache2/conf/httpd.conf
echo "allow from all" >>/usr/local/apache2/conf/httpd.conf
echo "</Directory>" >>/usr/local/apache2/conf/httpd.conf
sed -i '155s/usr\/local\/apache2\/htdocs/var\/www\/html/' /usr/local/apache2/conf/httpd.conf
mkdir /var/www/html -pv
/usr/local/apache2/bin/apachectl -k start
cd ..

 


tar -xzf mysql-5.0.18.tar.gz
cd mysql-5.0.18
groupadd mysql
useradd -g mysql mysql
yum install gcc gcc-c++ ncurses-devel libtool openssl-devel -y
./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=innobase --enable-static --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static
make && make install
echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
ldconfig
chown -R mysql.mysql /usr/local/mysql/
cp /usr/local/mysql/share/mysql/my-huge.cnf /etc/my.cnf
sed -i -r '27a datadir\t\t\= /usr/local/mysql/data' /etc/my.cnf
sed -i '40s/^/#/' /etc/my.cnf
mkdir -pv /usr/local/mysql/data
chown mysql.mysql /usr/local/mysql/data
/usr/local/mysql/bin/mysql_install_db --user=mysql
cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
/etc/init.d/mysqld start
chkconfig mysqld on
export PATH=$PATH:/usr/local/mysql/bin
echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
cd..

 


yum install libxml2-devel curl-devel libpng-devel freetype-devel libjpeg-devel -y
tar -jxf php-5.2.5.tar.bz2
cd php-5.2.5
./configure --prefix=/usr/local/php5 --enable-mbstring --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-config-file-path=/usr/local/php5
make && make install
sed -i "217s/$/ index.php/" /usr/local/apache2/conf/httpd.conf
sed -i "218a AddType application/x-httpd-php .php" /usr/local/apache2/conf/httpd.conf
cp /root/lamp/php-5.2.5/php.ini-dist /usr/local/php5/php.ini
/usr/local/apache2/bin/apachectl -k stop
/usr/local/apache2/bin/apachectl -k start