码迷,mamicode.com
首页 > 系统相关 > 详细

linux LNMP自动安装脚本

时间:2014-10-13 08:24:49      阅读:359      评论:0      收藏:0      [点我收藏+]

标签:des   http   io   ar   for   sp   art   on   cti   

#!/bin/bash
soft_dir="/home/soft"
config_dir="/home/config"
httpd="httpd-2.0.52"
mysql="mysql-5.1.56"
php="php-5.2.17"
phpmyadmin="phpMyAdmin-2.9.0.2"
zend="ZendOptimizer-3.2.6-linux-glibc21-i386"
echo -n "check packages,please wait ...... "
cat > list << "EOF" &&
httpd-2.0.52.tar.gz
mysql-5.1.56.tar.gz
freetds-0.64.tar.gz
freetype-2.1.10.tar.gz
gd-2.0.33.tar.gz
jpegsrc.v6b.tar.gz
libmcrypt-2.5.7.tar.gz
libpng-1.2.16.tar.gz
libxml2-2.6.27.tar.gz
php-5.2.17.tar.gz
phpMyAdmin292.tar.gz
ZendOptimizer-3.2.6-linux-glibc21-i386.tar.gz
zlib-1.2.3.tar.gz
EOF
for i in `cat list`
do
if [ -s $soft_dir/$i ]; then
echo "$i [found]"
else
echo "Error: $i not found!!!"
fi
done
echo "auto install apache"
groupadd apache
useradd -g apache -d /usr/local/apache -s /sbin/nologin apache
cd ${soft_dir}
tar zxvf ${httpd}.tar.gz
cd ${httpd}
./configure --prefix=/usr/local/apache --datadir=/www --enable-mods=shared=all --enable-module=so --disable-info --enable-shared=max --enable-rule=SHARED_CORE
make && make install
sed -i "s/nobody/apache/g" /usr/local/apache/conf/httpd.conf
sed -i "s/#-1/apache/g" /usr/local/apache/conf/httpd.conf
chown -R apache.apache /usr/local/apache
sed -e "/4/a #chkconfig: 2345 10 90" -i /usr/local/apache/bin/apachectl
sed -e "/5/a #description: Activates/Deactivates Apache Web Server " -i /usr/local/apache/bin/apachectl
cd /etc/rc.d/init.d/
cp /usr/local/apache/bin/apachectl httpd
chmod 755 httpd
chkconfig --add httpd
chkconfig --level 35 httpd on
service httpd start
echo "auto install mysql"
groupadd mysql
useradd -g mysql -d /mysql -s /sbin/nologin mysql
mkdir -p /mysql/tmp
chown -R mysql.mysql /mysql
chown -R mysql.mysql /data
chmod -R 777 /mysql/
chmod -R 777 /data/
cd ${soft_dir}
tar zxvf ${mysql}.tar.gz
cd $mysql
./configure --prefix=/mysql --localstatedir=/data --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --with-mysqld-user=mysql --enable-assembler --with-extra-charsets=all --with-unix-socket-path=/mysql/tmp/mysql.sock
make && make install
cp support-files/my-huge.cnf /etc/my.cnf
scripts/mysql_install_db --user=mysql
chown -R mysql.mysql /mysql
chown -R mysql.mysql /data
chmod -R 777 /mysql
chmod -R 777 /data
cd /mysql/
share/mysql/mysql.server start
bin/mysqladmin -u root password "bcmedia"
cd /etc/rc.d/init.d/
cp /home/soft/mysql-5.1.56/support-files/mysql.server mysqld
chmod 755 mysqld
chkconfig --add mysqld
chkconfig --level 35 mysqld on
service mysqld start
ln -s /mysql/bin/mysql /sbin/mysql
echo "auto install gd libary"
mkdir -p /usr/local/jpeg6
mkdir -p /usr/local/jpeg6/bin
mkdir -p /usr/local/jpeg6/lib
mkdir -p /usr/local/jpeg6/include
mkdir -p /usr/local/jpeg6/man
mkdir -p /usr/local/jpeg6/man/man1
cd ${soft_dir}
tar zxvf libxml2-2.6.27.tar.gz
cd libxml2-2.6.27
./configure --prefix=/usr/local/libxml2
make && make install
cd ${soft_dir}
tar zxvf zlib-1.2.3.tar.gz
./configure --prefix=/usr/local/zlib
make && make install
cd ${soft_dir}
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b/
./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
make && make install
cd ${soft_dir}
tar zxvf libpng-1.2.16.tar.gz
cd libpng-1.2.16
./configure
make && make install
mkdir -p /usr/local/freetype
cd ${soft_dir}
tar zxvf freetype-2.1.10.tar.gz
cd freetype-2.1.10
./configure --prefix=/usr/local/freetype
make && make install
cd ${soft_dir}
tar zxvf gd-2.0.33.tar.gz
cd gd-2.0.33
./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg6/ --with-png --with-zlib --with-freetype=/usr/local/freetype/
make && make install
cd ${soft_dir}
tar zxvf freetds-0.64.tar.gz
cd freetds-0.64
./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib --enable-dbmfix --with-gnu-ld
make && make install
echo "auto install php"
cd ${soft_dir}
tar zxvf ${php}.tar.gz
cd ${php}
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --enable-sockets --with-mysql=/mysql --with-mssql=/usr/local/freetds --with-gd=/usr/local/gd --with-jpeg-dir=/usr/local/jpeg6 --with-freetype-dir=/usr/local/freetype --with-zlib --with-png --enable-gd-native-ttf --enable-magic-quotes --with-iconv --with-mbstring --enable-track-vars --enable-force-cgi-redirect --enable-calendar --with-gettext --with-gdbm --with-ttf --with-extra-charsets_complex --with-msdblib --enable-module=dso --with-versioning --enable-libxml --enable-so
make && make install
cp php.ini-dist /usr/local/php/lib/php.ini
echo "/mysql/lib /usr/local/php/modules/freetds/lib" >> /etc/ld.so.conf
ldconfig
cd ${config_dir}
yes | cp httpd.conf /usr/local/apache/conf/httpd.conf
yes | cp php.ini /usr/local/php/lib/php.ini
echo "install phpmyadmin"
mkdir -p /www/htdocs/phpmyadmin
cd /www/htdocs
rm -rf *
cd ${soft_dir}
tar zxvf phpMyAdmin292.tar.gz
cd ${phpmyadmin}
cp -rf * /www/htdocs/phpmyadmin
cd ${config_dir}
yes | cp config.default.php /www/htdocs/phpmyadmin/libraries/config.default.php
yes | cp select_lang.lib.php /www/htdocs/phpmyadmin/libraries/select_lang.lib.php
/etc/init.d/httpd restart
echo "auto install Zend"
cd /home/soft
tar zxvf ${zend}.tar.gz
cd ${zend}
./install.sh

 

linux LNMP自动安装脚本

标签:des   http   io   ar   for   sp   art   on   cti   

原文地址:http://www.cnblogs.com/networking/p/4021399.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!