all(){path=`pwd`cd $pathechoecho "exclude=*.i386 *.i686" >> /etc/yum.confrpm -ivh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpmyum listyum update -ysleep 20;#######检查命令是否执行正常##############################if [ $? -eq 0 ]; then echo "``````Update complete``````````" else exit 1 echo"```````failure```````"fisleep 15;yum -y install 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 yasm pcre libmcrypt libvpx tiff jpegsrc t1lib===============================================================================cd $pathtar zxvf cmake-2.8.11.2.tar.gzcd cmake-2.8.11.2./configuremakemake installcd ..tar zxvf mysql-5.5.18.tar.gzcd mysql-5.5.18yum install -y autoconf automake imake libxml2-devel expat-devel gcc gcc-c++ libaio libaio-devel bzr bison libtool ncurses-develmkdir -p /data/mysql-5.5.18mkdir -p /data/mysql_logmkdir -p /data/log-bingroupadd mysqluseradd mysql -g mysql -M -s /sbin/nologinchown -R mysql.mysql /data/mysql-5.5.18/ /data/mysql_log/ /data/log-bin/mkdir -p /usr/local/mysql-5.5.18chown -R mysql.mysql /usr/local/mysql-5.5.18cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.5.18 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/usr/local/mysql-5.5.18/data -DMYSQL_USER=mysqlmakemake installchown -R mysql:mysql /usr/local/mysql-5.5.18/rm -rf /etc/my.cnfcp support-files/my-small.cnf /etc/my.cnfchown mysql:mysql /etc/my.cnfcp $path/mysqld /etc/rc.d/init.d/mysqldchown -R mysql:mysql /etc/rc.d/init.d/mysqldchmod +x /etc/rc.d/init.d/mysqldln -s /usr/local/mysql-5.5.18/bin/mysql /usr/bin/usr/local/mysql-5.5.18/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql-5.5.18 --datadir=/data/mysql-5.5.18/datachmod +x mysql_install_dbsed -i ‘/\[mysqld\]/a\datadir=\/usr\/local\/mysql-5.5.18\/data\/‘ /etc/my.cnf/usr/local/mysql-5.5.18/scripts/mysql_install_db --basedir=/usr/local/mysql-5.5.18 --datadir=/usr/local/mysql-5.5.18/data --user=mysql/etc/init.d/mysqld start/usr/local/mysql-5.5.18/bin/mysqladmin -uroot password 123qwe####################################################################################cd $pathtar zxvf pcre-8.20.tar.gzcd pcre-8.20./configure --prefix=/usr/local/pcremakemake installcd $pathtar zxvf openssl-1.0.0a.tar.gzcd openssl-1.0.0a./config --prefix=/usr/local/opensslmakemake installcd $pathtar zxvf zlib-1.2.3.tar.gzcd zlib-1.2.3./configure -prefix=/usr/local/zlibmakemake install####nginx的安装cd $pathgroupadd wwwuseradd www -g mysql -M -s /sbin/nologintar zxvf nginx-1.1.7.tar.gzcd nginx-1.1.7./configure --prefix=/usr/local/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-openssl=$path/openssl-1.0.0a --with-zlib=$path/zlib-1.2.3 --with-pcre=$path/pcre-8.20makemake installrm -rf /usr/local/nginx/conf/nginx.confcp $path/nginx.conf /usr/local/nginx/conf/nginx.conf###################################################cd $pathtar zxvf yasm-1.3.0.tar.gzcd yasm-1.3.0.tar.gz./configuremakemake installcd $pathtar zxvf libmcrypt-2.5.8.tar.gzcd libmcrypt-2.5.8./configure --prefix=/usr/local/libmcryptmakemake installcd $pathtar jxvf libvpx-1.4.0.tar.bz2cd libvpx-1.4.0./configure --prefix=/usr/local/libvpx --enable-shared --enable-vp9makemake installcd $pathtar zxvf tiff-4.0.3.tar.gzcd tiff-4.0.3./configure --prefix=/usr/local/tiff --enable-sharedmakemake instalcd $pathtar zxvf libpng-1.5.6.tar.gzcd libpng-1.5.6./configure --prefix=/usr/local/libpng --enable-sharedmakemake installcd $pathtar zxvf freetype-2.4.8.tar.gzcd freetype-2.4.8./configure --prefix=/usr/local/freetype --enable-sharedmakemake installcd $pathtar zxvf jpegsrc.v8c.tar.gzcd jpeg-8c./configure --prefix=/usr/local/jpeg --enable-sharedmakemake installcd $pathtar zxvf t1lib-5.1.2.tar.gzcd t1lib-5.1.2./configure --prefix=/usr/local/t1lib --enable-sharedmake without_doccp -frp /usr/lib64/libltdl.so* /usr/lib/yum -y install libXpmcd $pathtar zxvf php-5.5.24.tar.gzcd php-5.5.24./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql-5.5.18 --with-mysqli=/usr/local/mysql-5.5.18/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-pdo-mysql=/usr/local/mysql-5.5.18 --with-png-dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/freetype --with-xpm-dir=/usr/ --with-vpx-dir=/usr/local/libvpx/ --with-zlib-dir=/usr/local/zlib --with-t1lib=/usr/local/t1lib --with-iconv --enable-libxml --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-opcache --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-curl --enable-ctypemakemake installcp $path/php.ini /usr/local/php/etc/php.inirm -rf /etc/php.inimv php-fpm.conf /usr/local/php/etc/ln -s /usr/local/php/etc/php.ini /etc/php.iniln -s /usr/local/php/etc/php-fpm.conf /etc/php-fpm.confcp $path/php-5.5.24/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpmchmod +x /etc/rc.d/init.d/php-fpmchkconfig php-fpm on}
一键安装lnmp(2)