#!/bin/bash
SOFTWARE_SOURCE=/home/source
NGINX_VERSION=nginx-1.8.0.tar.gz
MYSQL_VERSION=mysql-5.6.26.tar.gz
PHP_VERSION=php-5.5.29.tar.gz
if [ ! -d $SOFTWARE_SOURCE/nginx-1.8.0 ];then
echo "=========================开始安装Nginx=========================="
for i in $(chkconfig | awk '{print $1}');do chkconfig $i off; done
chkconfig network on
chkconfig sshd on
chkconfig rsyslog on
chkconfig crond on
yum install gcc gcc-c++ zlib zlib-devel pcre pcre-devel openssl openssl-devel -y
tar xf $SOFTWARE_SOURCE/$NGINX_VERSION -C $SOFTWARE_SOURCE
cd $SOFTWARE_SOURCE/nginx-1.8.0
./configure \
--prefix=/usr/local/nginx \
--user=web \
--group=web \
--with-http_stub_status_module \
--with-http_ssl_module
make && make install || exit 1
echo "=========================安装Nginx成功==========================="
else
echo "=========================安装Nginx失败==========================="
fi
if [ ! -d $SOFTWARE_SOURCE/mysql-5.6.26 ];then
echo "=========================开始安装MySQL==========================="
useradd -s /sbin/nologin mysql
yum install cmake ncurses ncurses-devel -y
tar xf $SOFTWARE_SOURCE/$MYSQL_VERSION -C $SOFTWARE_SOURCE
cd $SOFTWARE_SOURCE/mysql-5.6.26
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/home/mysql/data \
-DSYSCONFDIR=/etc \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
make && make install || exit 1
echo "=========================安装MySQL成功==========================="
else
echo "=========================安装MySQL失败==========================="
echo "=========================安装MySQL成功==========================="
else
echo "=========================安装MySQL失败==========================="
fi
if [ ! -d $SOFTWARE_SOURCE/php-5.5.29 ];then
echo "=========================开始安装PHP==========================="
yum install make gd gd-devel zlib zlib-devel \
libxml2 libxml2-devel freetype \
freetype-devel libpng libpng-devel \
bison bison-devel libjpeg libjpeg-devel \
libmcrypt libmcrypt-devel curl curl-devel -y
tar xf $SOFTWARE_SOURCE/$PHP_VERSION -C $SOFTWARE_SOURCE
cd $SOFTWARE_SOURCE/php-5.5.29
./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-pdo-mysql=/usr/local/mysql \
--with-libxml-dir \
--with-png-dir \
--with-jpeg-dir \
--with-freetype-dir \
--with-gd \
--with-zlib-dir \
--with-openssl \
--with-mcrypt \
--enable-xml \
--enable-soap \
--enable-safe-mode \
--enable-short-tags \
--enable-static \
--enable-mbstring=all \
--enable-sockets \
--enable-fpm \
--enable-mbstring \
--with-curl \
--with-mhash \
make && make install || exit 1
echo "=========================安装PHP成功==========================="
else
echo "=========================安装PHP失败==========================="
fi
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。