Last active
January 18, 2016 16:16
-
-
Save veapon/6450234 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#################### | |
# REQUIRE PACKAGES | |
# Nginx | |
# Mysql | |
# Memcached | |
# libmcrypt,mhash,mcrypt,re2c | |
# PHP | |
##################### | |
/usr/bin/yum -y install gcc gcc-c++ pcre pcre-devel zlib zlib-devel make cmake libxml2 libxml2-devel ncurses-devel libtool-ltdl-devel bison automake autoconf libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxslt libxslt-devel openssl openssl-devel libevent libevent-devel | |
serverPath=/servers | |
sourcePath=$(pwd)/packages | |
[ -e $serverPath ] || mkdir $serverPath | |
groupadd nginx | |
useradd -g nginx -M -s /sbin/nologin nginx | |
[ -e $serverPath/nginx ] || mkdir $serverPath/nginx | |
# nginx-source-path | |
cd $sourcePath/nginx-1.7.3 | |
$(pwd)/configure --prefix=$serverPath/nginx --user=nginx --group=nginx | |
make && make install | |
groupadd mysql | |
useradd -g mysql -M -s /sbin/nologin mysql | |
dataPath=/data/mysql | |
[ -e $serverPath/mysql ] || mkdir $serverPath/mysql | |
[ -e $dataPath ] || mkdir -p $dataPath | |
chown -R mysql.mysql $serverPath/mysql | |
chown -R mysql.mysql $dataPath | |
# mysql-source-path | |
cd $sourcePath/mysql-5.6.20 | |
/usr/bin/cmake . -DCMAKE_INSTALL_PREFIX=$serverPath/mysql -DMYSQL_DATADIR=$dataPath -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci | |
make | |
make install | |
$serverPath/mysql/scripts/mysql_install_db --user=mysql --basedir=$serverPath/mysql --datadir=$dataPath --no-defaults | |
cp $serverPath/mysql/support-files/my-medium.cnf /etc/my.cnf | |
cp $serverPath/mysql/support-files/mysql.server /etc/init.d/mysql | |
chkconfig --add mysql | |
chkconfig mysql on | |
# libmcrypt-source-path | |
cd $sourcePath/libmcrypt-2.5.8 | |
./configure | |
make | |
make install | |
# mhash-source-path | |
cd $sourcePath/mhash-0.9.9.9 | |
./configure | |
make | |
make install | |
cd $sourcePath/mcrypt-2.6.8 | |
LD_LIBRARY_PATH=/usr/local/lib ./configure | |
make | |
make install | |
cd $sourcePath/re2c | |
make && make install | |
phpPath=$serverPath/php | |
[ -e $phpPath ] || mkdir $phpPath | |
cd $sourcePath/php-5.5.15 | |
./configure --prefix=$phpPath --with-curl --enable-mbstring --with-mcrypt=/usr/local --with-mysql=$serverPath/mysql --with-mysqli=$serverPath/mysql/bin/mysql_config --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --enable-libxml --with-xsl --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-zlib-dir --with-pdo-mysql=$serverPath/mysql --enable-opcache --with-openssl | |
make && make install | |
cp php.ini-development $phpPath/lib/php.ini | |
cp $phpPath/etc/php-fpm.conf.default $phpPath/etc/php-fpm.conf | |
cp $phpPath/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm | |
chmod +x /etc/init.d/php-fpm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment