lnmp_install.sh

#/bin/bash
echo "Update Libs"
yum -y install wget gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers

nginx_dir="/usr/local/nginx"
php52_dir="/usr/local/php52"
mysql_dir="/usr/local/mysql"

groupadd www && useradd www -s /sbin/nologin -g www
useradd -M -s /sbin/nologin mysql
#############mysql install###########
cd packages/
tar zxf mysql-5.1.59.tar.gz
cd mysql-5.1.59
CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=nocona -O2 -pipe"
CXXFLAGS="${CFLAGS}"
./configure "--prefix=${mysql_dir}" "--with-server-suffix=-DZWWW" "--with-mysqld-user=mysql" "--without-debug" "--with-charset=utf8" "--with-extra-charsets=all" "--with-pthread" "--with-big-tables" "--enable-thread-safe-client" "--enable-assembler" "--with-readline" "--with-ssl" "--enable-local-infile" "--with-plugins=partition,myisammrg" "--without-ndb-debug"

make && make install

#########建立配置文件###########
\cp support-files/my-medium.cnf /etc/my.cnf

#########初始化数据库###########
/usr/local/mysql/bin/mysql_install_db --user=mysql
chown -R root.mysql /usr/local/mysql/
chown -R mysql /usr/local/mysql/var

###########调整lib库路径#########
echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
ldconfig

###########MYSQL启动配置###########

echo 'start MySQL 5.1.59'

/usr/local/mysql/bin/mysqld_safe --user=mysql &

\cp support-files/mysql.server /etc/init.d/mysqld

chmod +x /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on

#cd /usr/local/mysql
#chown -R mysql:mysql.
#rm -rf sql-bench mysql-test
#echo 'config MySQL 5.1.59'
#chmod +w /usr/local/mysql

###########设置MYSQL程序的执行路径##############
export PATH=$PATH:/usr/local/mysql/bin
echo "PATH=$PATH:/usr/local/mysql/bin">> /etc/profile

source /etc/profile

###设置MYSQL密码##
cd ..
echo 'init db MySQL 5.1.59'

sleep 3s
echo 'set password MySQL 5.1.59'

/usr/local/mysql/bin/mysqladmin -uroot password '123456quanlian'

#sed -i 's#/home/mysql:/bin/bash#/home:/sbin/nologin#' /etc/passwd

echo "mysql server 5.1.59 installed successfully"



################安装libunwind########
cd packages/
if [ `uname -m` == "x86_64" ];then
#tar zxf libunwind-0.99.tar.gz
tar zxvf libunwind-0.99.tar.gz
cd libunwind-0.99/
CFLAGS=-fPIC ./configure
make CFLAGS=-fPIC
make CFLAGS=-fPIC install
cd ../
else

echo "your system is 32bit ,not install libunwind lib"
fi

#############安装google-perftools############

#is_version
#tar zxvf gperftools-2.0.tar.gz
#cd gperftools-2.0
#./configure
#make
#make install

cd ..
tar zxf pcre-8.12.tar.gz
cd pcre-8.12/
./configure
make
make install
cd ..

###############NGINX##############

tar zxf pcre-8.12.tar.gz
cd pcre-8.12
./configure
make
make install
cd ..
tar zxf nginx-1.1.4.tar.gz  
cd nginx-1.1.4
./configure --prefix=${nginx_dir} --with-google_perftools_module --user=www --group=www --with-http_stub_status_module --with-http_flv_module --with-http_ssl_module
make && make install

service httpd stop
echo `nginx -t` #####测试是否成功
  mv /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.bak
  cp conf/nginx.conf /usr/local/nginx/conf/nginx.conf
  cp conf/fastcgi.conf /usr/local/nginx/conf/fcgi.conf
 
  echo `nginx -t`
  ln -sf /usr/local/nginx/sbin/nginx /sbin/nginx     ###方便管理
nginx
echo "/usr/local/nginx/sbin/nginx" >> /etc/rc.local
echo "nginx installed sucussfully"
cd ..


#####phpinstall 组件###########
#cd packages/
tar zxf libiconv-1.13.1.tar.gz
cd libiconv-1.13.1/
./configure --prefix=/usr/local
make
make install
cd ../

tar zxf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make
make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make
make install
cd ../../

tar zxf mhash-0.9.9.tar.gz
 cd mhash-0.9.9/
./configure
make
make install
cd ../

ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config

tar zxf mcrypt-2.6.7.tar.gz
cd mcrypt-2.6.7/
/sbin/ldconfig
./configure
make
make install
cd ../
################PHP install##############
tar zxf php-5.2.17.tar.gz
gzip -cd php-5.2.17-fpm-0.5.14.diff.gz | patch -d php-5.2.17 -p1
cd php-5.2.17/
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config
--with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir
--with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode
--enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers
--enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd
--enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap
make ZEND_EXTRA_LIBS='-liconv'
make install
#cd ..
#cp php.ini /usr/local/php52/etc/
cp php.ini-dist /usr/local/php52/etc/
cp php.ini-dist /usr/local/php/lib/php.ini
cp php-fpm.conf /usr/local/php52/etc/

echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf.d/mysql_lib.conf
/sbin/ldconfig
echo "php52 installed successfully!"
}

function ins_php52-ext()

{
cd packages/

############### PHP 扩展安装 #################


tar zxf memcache-2.2.5.tgz
cd memcache-2.2.5/
${php52_dir}/bin/phpize
./configure --with-php-config=${php52_dir}/bin/php-config
make
make install
cd ../

tar jxf eaccelerator-0.9.6.1.tar.bz2
cd eaccelerator-0.9.6.1/
${php52_dir}/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=${php52_dir}/bin/php-config
make
make install
cd ../




tar zxf PDO_MYSQL-1.0.2.tgz
cd PDO_MYSQL-1.0.2/
${php52_dir}/bin/phpize
./configure --with-php-config=${php52_dir}/bin/php-config --with-pdo-mysql=${mysql_dir}
make
make install
cd ../

tar zxf ImageMagick.tar.gz
cd ImageMagick-6.5.1-2/
./configure
make
make install
cd ../

以下这个包未安装
tar zxf imagick-2.3.0.tgz
cd imagick-2.3.0/
${php52_dir}/bin/phpize
./configure --with-php-config=${php52_dir}/bin/php-config
make
make install
cd ../
echo "php52 extension installed successfully!"

#################PHPMyadmin install#################333

echo 'install phpMyAdmin 3.2.0.1'
tar xvzf phpMyAdmin-3.2.0.1-all-languages.tar.gz
mv phpMyAdmin-3.2.0.1-all-languages $phpdir/phpMyAdmin
cp $phpdir/phpMyAdmin/libraries/config.default.php $phpdir/phpMyAdmin/config.inc.php

exit












  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值