shell 源码安装lamp 已测试!


把脚本放在/root/lamp下运行就行了

#!/bin/bash
wget http://archive.apache.org/dist/httpd/httpd-2.2.9.tar.gz
tar -xzf httpd-2.2.9.tar.gz
cd httpd-2.2.9
./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 install
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 '152s/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 ..
wget http://downloads.mysql.com/archives/mysql-5.1/mysql-5.1.50.tar.gz
tar -xzf mysql-5.1.50.tar.gz
cd mysql-5.1.50
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
wget  http://museum.php.net/php5/php-5.2.5.tar.bz2
yum install libxml2-devel curl-devel libpng-devel freetype-devel libjpeg-devel -y
cd ..
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


你可能感兴趣的:(linux,PHP,shell,包,lamp,lamp,自动安装,LAMP源码)