Guest User

NGINX Autoinstaller

a guest
Sep 11th, 2015
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 56.71 KB | None | 0 0
  1. #!/bin/bash
  2. PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
  3. export PATH
  4.  
  5. #######################################################
  6. #                   NGINXAUTO v2.0                  #
  7. # Written by 2298@otoinstall.com and Junker@vbfk.com  #
  8. #                 Based on LNMP Script                #
  9. #######################################################
  10.  
  11. if [ $(id -u) != "0" ]; then
  12.     echo "Error: You must be root to run this script, please use root to install this script"
  13.     exit 0
  14. fi
  15.  
  16. if [ -a "/etc/debian_version" ] || [ -a "/etc/ubuntu-release" ]; then
  17.  
  18. clear
  19.  
  20. echo "=============================================================================="
  21. echo "      NGINX - PHP - MYSQL AUTO INSTALLER 2.0 FOR DEBIAN 7 & UBUNTU 14.04"            
  22. echo "=============================================================================="
  23. echo "                   2298@otoinstall.com & Junker@vbfk.com"
  24. echo "       http://otoinstall.com/nginx-auto-installer-php-mysql-lnmp-v2-0"
  25. echo "                     For more information please visit:"
  26. echo "                           http://otoinstall.com"
  27. echo "=============================================================================="
  28.  
  29. arch=`uname -m`
  30. proc=`cat /proc/cpuinfo | grep -c processor`
  31. # myhome=`ifconfig | grep 'inet addr:' | grep -v '127.0.0.1' | grep -v '127.0.0.2' | cut -d: -f2 | awk {'print $1'} | head -n 1`
  32. myhome=`hostname --ip-address`
  33. mkdir -p /tmp/pkgs
  34.  
  35. if [ "$arch" == "x86_64" ]; then
  36.     tipe="x86_64-linux-gnu"
  37. else
  38.     tipe="i386-linux-gnu"
  39. fi
  40.  
  41. #Set MySQL root password
  42. SAKSESBUNG=0
  43. COBALAGI=1
  44. while [ $SAKSESBUNG -eq "0" ]; do
  45.     read -p "Please input your preferred mysql root password: " mysqlrootpwd
  46.     if [ "$mysqlrootpwd" = "" ]; then
  47.         if [ $COBALAGI -lt 3 ]; then
  48.             echo ""
  49.             echo "You're not typing, it is still empty!"
  50.             echo ""
  51.             COBALAGI=`expr $COBALAGI + 1`
  52.         else
  53.             echo ""
  54.             echo "You might want to try it again later."
  55.             echo ""
  56.             exit 0
  57.         fi
  58.     else
  59.         mysqlrootpwd="$mysqlrootpwd"
  60.         SAKSESBUNG=1
  61.     fi
  62. done
  63. echo ""
  64.  
  65. #Set phpMyAdmin blowfish_secret
  66. SAKSESBUNG=0
  67. COBALAGI=1
  68. while [ $SAKSESBUNG -eq "0" ]; do
  69.     read -p "Please input your preferred phpmyadmin blowfish_secret (eg: mysecret): " ppblow
  70.     if [ "$ppblow" = "" ]; then
  71.         if [ $COBALAGI -lt 3 ]; then
  72.             echo ""
  73.             echo "You're not typing, it is still empty!"
  74.             echo ""
  75.             COBALAGI=`expr $COBALAGI + 1`
  76.         else
  77.             echo ""
  78.             echo "You might want to try it again later."
  79.             echo ""
  80.             exit 0
  81.         fi
  82.     else
  83.         ppblow="$ppblow"
  84.         SAKSESBUNG=1
  85.     fi
  86. done
  87. echo ""
  88.  
  89. #Set phpMyAdmin directory name
  90. SAKSESBUNG=0
  91. COBALAGI=1
  92. while [ $SAKSESBUNG -eq "0" ]; do
  93.     read -p "Please input your preferred phpmyadmin directory name: " phpmyadmin
  94.     if [ "$phpmyadmin" = "" ]; then
  95.         if [ $COBALAGI -lt 3 ]; then
  96.             echo ""
  97.             echo "You're not typing, it is still empty!"
  98.             echo ""
  99.             COBALAGI=`expr $COBALAGI + 1`
  100.         else
  101.             echo ""
  102.             echo "You might want to try it again later."
  103.             echo ""
  104.             exit 0
  105.         fi
  106.     else
  107.         phpmyadmin="$phpmyadmin"
  108.         SAKSESBUNG=1
  109.     fi
  110. done
  111. echo ""
  112.  
  113. #Set FTP/SFTP password
  114. SAKSESBUNG=0
  115. COBALAGI=1
  116. while [ $SAKSESBUNG -eq "0" ]; do
  117.     read -p "Please input your preferred ftp/sftp password: " ftppwd
  118.     if [ "$ftppwd" = "" ]; then
  119.         if [ $COBALAGI -lt 3 ]; then
  120.             echo ""
  121.             echo "You're not typing, it is still empty!"
  122.             echo ""
  123.             COBALAGI=`expr $COBALAGI + 1`
  124.         else
  125.             echo ""
  126.             echo "You might want to try it again later."
  127.             echo ""
  128.             exit 0
  129.         fi
  130.     else
  131.         ftppwd="$ftppwd"
  132.         SAKSESBUNG=1
  133.     fi
  134. done
  135. echo ""
  136.  
  137. #Confirm PHP
  138. echo "Type 'php54' for PHP 5.4.x"
  139. echo "Type 'php55' for PHP 5.5.x"
  140. echo "Type 'php56' for PHP 5.6.x"
  141. while read -p "Please choose your preferred PHP version: " php5
  142.     do case $php5 in
  143.     php54) [ "php5" = "$php5" ]; break;;
  144.     php55) [ "php5" = "$php5" ]; break;;
  145.     php56) [ "php5" = "$php5" ]; break;;
  146.     *) echo "";
  147.        echo "Please type the right choice!";;
  148.     esac
  149. done
  150. echo ""
  151.  
  152. #Confirm PHP Accelerator
  153. echo "Would you like to install PHP Accelerator?"
  154. echo ""
  155. echo "Type 'zopt' for Zend Opcache"
  156. echo "Type 'xcache' for XCache"
  157. echo "Type 'noop' if you don't want to install PHP Accelerator"
  158. while read -p "Please choose your preferred PHP Opcode Cacher: " phpcacher
  159.     do case $phpcacher in
  160.     zopt) [ "phpcacher" = "$phpcacher" ]; break;;
  161.     xcache) [ "phpcacher" = "$phpcacher" ]; break;;
  162.     noop) [ "phpcacher" = "$phpcacher" ]; break;;
  163.     *) echo "";
  164.        echo "Please type the right choice!";;
  165.     esac
  166. done
  167. echo ""
  168.  
  169. #Confirm IMAGICK
  170. while read -p "Would you like to install ImageMagick?[Y/n] " imagick
  171.     do case $imagick in
  172.     Y) [ "imagick" = "$imagick" ]; break;;
  173.     y) [ "imagick" = "$imagick" ]; break;;
  174.     N) [ "imagick" = "$imagick" ]; break;;
  175.     n) [ "imagick" = "$imagick" ]; break;;
  176.     *) echo "";
  177.        echo "Please type the right choice!";;
  178.     esac
  179. done
  180. echo ""
  181.  
  182. #Confirm PureFTPD
  183. while read -p "Would you like to install PureFTPD?[Y/n] " pureftpd
  184.     do case $pureftpd in
  185.     Y) [ "pureftpd" = "$pureftpd" ]; break;;
  186.     y) [ "pureftpd" = "$pureftpd" ]; break;;
  187.     N) [ "pureftpd" = "$pureftpd" ]; break;;
  188.     n) [ "pureftpd" = "$pureftpd" ]; break;;
  189.     *) echo "";
  190.        echo "Please type the right choice!";;
  191.     esac
  192. done
  193.  
  194.     get_char()
  195.     {
  196.     SAVEDSTTY=`stty -g`
  197.     stty -echo
  198.     stty cbreak
  199.     dd if=/dev/tty bs=1 count=1 2> /dev/null
  200.     stty -raw
  201.     stty echo
  202.     stty $SAVEDSTTY
  203.     }
  204.     echo ""
  205.     echo "Press any key to start the installation..."
  206.     char=`get_char`
  207.  
  208. echo ""
  209. echo "==================================PREPARATION================================="
  210. echo ""
  211. if [ -s /etc/selinux/config ]; then
  212. sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
  213. fi
  214. /usr/sbin/setenforce 0
  215.  
  216. echo ""
  217. echo "=======================INSTALLING INSTALLER DEPENDENCIES======================"
  218. echo ""
  219. apt-get update -y
  220. apt-get install -y build-essential zip unzip
  221.  
  222. echo ""
  223. echo "=======================DEPENDENCIES INSTALLATION COMPLETED===================="
  224. echo ""
  225.  
  226. echo ""
  227. echo "================================INSTALLING NGINX=============================="
  228. echo ""
  229.  
  230. useradd www
  231. echo www:$ftppwd|chpasswd
  232. mkdir -p /home/www
  233.  
  234. wget -O /tmp/pkgs/nginx_signing.key http://nginx.org/keys/nginx_signing.key
  235. apt-key add /tmp/pkgs/nginx_signing.key
  236.  
  237. if [ -s /etc/lsb-release ]; then
  238. echo "deb http://nginx.org/packages/mainline/ubuntu/ trusty nginx" >> /etc/apt/sources.list
  239. echo "deb-src http://nginx.org/packages/mainline/ubuntu/ trusty nginx" >> /etc/apt/sources.list
  240. fi
  241.  
  242. if [[ $(cat /etc/debian_version) == *7.* ]]; then
  243. echo "deb http://nginx.org/packages/mainline/debian/ wheezy nginx" >> /etc/apt/sources.list
  244. echo "deb-src http://nginx.org/packages/mainline/debian/ wheezy nginx" >> /etc/apt/sources.list
  245. fi
  246.  
  247. apt-get update -y
  248. apt-get install -y nginx
  249.  
  250. apt-get install openssl
  251. mkdir -p /etc/nginx/sslconf
  252. cd /etc/nginx/sslconf
  253. openssl genrsa -out server.key 2048
  254. openssl req -new -key server.key -out server.csr -subj "/C=ab/ST=cd/L=ef/CN=ghij"
  255. mv server.key server.key.org
  256. openssl rsa -in server.key.org -out server.key
  257. openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
  258.  
  259. echo ""
  260. echo "          ----------------CREATING MASTER VIRTUAL HOST--------------          "
  261. echo ""
  262.  
  263. mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.default
  264.  
  265. cat >/etc/nginx/nginx.conf<<EOF
  266.  
  267. user              www;
  268. worker_processes  $proc;
  269.  
  270. error_log       /var/log/nginx/error.log warn;
  271.  
  272. pid /var/run/nginx.pid;
  273.  
  274.  
  275. events {
  276.     worker_connections  1024;
  277. }
  278.  
  279. http {
  280.     include     /etc/nginx/mime.types;
  281.     default_type    application/octet-stream;
  282.     client_max_body_size    10M;
  283.     client_body_buffer_size 128k;
  284.     server_names_hash_bucket_size  64;
  285.     types_hash_max_size 2048;
  286.  
  287.     log_format  main  '$remote_addr | $remote_user [$time_local] | "$request"'
  288.               ' | $status | $body_bytes_sent bytes | "$http_referer"'
  289.               ' | "$http_user_agent" | "$http_x_forwarded_for"';
  290.  
  291.     access_log  /var/log/nginx/access.log  main;
  292.  
  293.     sendfile        on;
  294.     #tcp_nopush     on;
  295.     keepalive_timeout  65;
  296.     tcp_nodelay on;
  297.  
  298.     gzip  on;
  299.  
  300. server {
  301.   listen 80;
  302.   server_name $myhome;
  303.   return      301 https://$myhome\$request_uri;
  304.   location / {
  305.     root /usr/share/nginx/html;
  306.     index index.html index.htm index.php;  
  307.   }
  308.  
  309.   location ~ \.php$ {
  310.     include /etc/nginx/fastcgi_params;
  311.     fastcgi_pass 127.0.0.1:9000;
  312.     fastcgi_index index.php;
  313.     fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html\$fastcgi_script_name;
  314.   }
  315. }
  316.  
  317. server {
  318.   listen 443 ssl;
  319.   server_name $myhome;
  320.   ssl_certificate      /etc/nginx/sslconf/server.crt;
  321.   ssl_certificate_key  /etc/nginx/sslconf/server.key;
  322.   ssl_session_timeout  5m;
  323.  
  324.   location / {
  325.     root /usr/share/nginx/html;
  326.     index index.html index.htm index.php;  
  327.   }
  328.  
  329.   location ~ \.php$ {
  330.     include /etc/nginx/fastcgi_params;
  331.     fastcgi_pass 127.0.0.1:9000;
  332.     fastcgi_index index.php;
  333.     fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html\$fastcgi_script_name;
  334.   }
  335. }
  336.    
  337.     # Load virtual host configuration files.
  338.       include /etc/nginx/sites-enabled/*;
  339. }
  340.  
  341. EOF
  342.  
  343. echo ""
  344. echo "==========================NGINX INSTALLATION COMPLETED========================"
  345. echo ""
  346.  
  347. echo ""
  348. echo "===============================INSTALLING MYSQL==============================="
  349. echo ""
  350.  
  351. dpkg -P mysql
  352. apt-get remove -y mysql-server
  353. wget -O /tmp/pkgs/mysql_pubkey.asc http://txt.otoinstall.com/mysql_pubkey.asc
  354. gpg --import /tmp/pkgs/mysql_pubkey.asc
  355. apt-key add /tmp/pkgs/mysql_pubkey.asc
  356.  
  357. if [ -s /etc/lsb-release ]; then
  358. wget -O /etc/apt/sources.list.d/mysql_ubuntu_t.list http://txt.otoinstall.com/mysql_ubuntu_t.list
  359. fi
  360.  
  361. if [[ $(cat /etc/debian_version) == *7.* ]]; then
  362. wget -O /etc/apt/sources.list.d/mysql_debian_w.list http://txt.otoinstall.com/mysql_debian_w.list
  363. fi
  364.  
  365. apt-get update -y
  366. apt-get install -y mysql-server
  367.  
  368. echo ""
  369. echo "          -----------------------SECURING MYSQL---------------------          "
  370. echo ""
  371.  
  372. service mysql start
  373. mysqladmin -u root password $mysqlrootpwd
  374. echo 'DROP DATABASE 'test';' | mysql -u root -p$mysqlrootpwd
  375. echo "SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('$mysqlrootpwd');" | mysql -u root -p$mysqlrootpwd
  376. echo "SET PASSWORD FOR 'root'@'`hostname`' = PASSWORD('$mysqlrootpwd');" | mysql -u root -p$mysqlrootpwd
  377. echo "DELETE FROM mysql.user WHERE User = '';" | mysql -u root -p$mysqlrootpwd
  378. echo "DROP USER ''@'%';" | mysql -u root -p$mysqlrootpwd
  379. echo "DROP USER 'root'@'::1';" | mysql -u root -p$mysqlrootpwd
  380. service mysql stop
  381.  
  382. echo ""
  383. echo "==========================MYSQL INSTALLATION COMPLETED========================"
  384. echo ""
  385.  
  386. echo ""
  387. echo "=================================INSTALLING PHP==============================="
  388. echo ""
  389.  
  390. apt-get install -y python-dev libssl-dev libbz2-dev libjpeg-dev libvpx-dev libpng-dev libfreetype6-dev libgmp-dev libc-client-dev libicu-dev libaspell-dev \
  391. libtidy-dev libenchant-dev libxpm-dev libedit-dev libsnmp-dev xinetd libpam0g-dev libpspell-dev autoconf
  392.  
  393. wget -O /tmp/pkgs/libxml2-2.9.2.tar.gz http://pkgs.otoinstall.com/libxml2-2.9.2.tar.gz
  394. tar -C /tmp/pkgs -zxvf /tmp/pkgs/libxml2-2.9.2.tar.gz
  395. cd /tmp/pkgs/libxml2-2.9.2
  396. rm -rf /usr/lib/libxml2*
  397. ./configure --prefix=/usr --libdir=/usr/lib
  398. make
  399. make install
  400.  
  401. wget -O /tmp/pkgs/libxslt-1.1.28.tar.gz http://pkgs.otoinstall.com/libxslt-1.1.28.tar.gz
  402. tar -C /tmp/pkgs -zxvf /tmp/pkgs/libxslt-1.1.28.tar.gz
  403. cd /tmp/pkgs/libxslt-1.1.28
  404. rm -rf /usr/lib/libxslt* /usr/lib/libexslt*
  405. ./configure --prefix=/usr --libdir=/usr/lib
  406. make
  407. make install
  408.  
  409. wget -O /tmp/pkgs/curl-7.44.0.tar.gz http://pkgs.otoinstall.com/curl-7.44.0.tar.gz
  410. tar -C /tmp/pkgs -zxvf /tmp/pkgs/curl-7.44.0.tar.gz
  411. cd /tmp/pkgs/curl-7.44.0
  412. ./configure --prefix=/usr --libdir=/usr/lib
  413. make
  414. make install
  415.  
  416. wget -O /tmp/pkgs/libmcrypt-2.5.8.tar.gz http://pkgs.otoinstall.com/libmcrypt-2.5.8.tar.gz
  417. tar -C /tmp/pkgs -zxvf /tmp/pkgs/libmcrypt-2.5.8.tar.gz
  418. cd /tmp/pkgs/libmcrypt-2.5.8
  419. ./configure --prefix=/usr --libdir=/usr/lib
  420. make
  421. make install
  422.  
  423. wget -O /tmp/pkgs/mm-1.4.2.tar.gz http://pkgs.otoinstall.com/mm-1.4.2.tar.gz
  424. tar -C /tmp/pkgs -zxvf /tmp/pkgs/mm-1.4.2.tar.gz
  425. cd /tmp/pkgs/mm-1.4.2
  426. ./configure --prefix=/usr --libdir=/usr/lib
  427. make
  428. make install
  429.  
  430. ln -s /usr/lib/$tipe/libXpm.* /usr/lib/
  431. if [ -s /etc/lsb-release ]; then
  432. ln -s /usr/include/$tipe/gmp.h /usr/include
  433. fi
  434.  
  435. if [ $php5 = "php54" ]; then
  436.  
  437. wget -O /tmp/pkgs/php-5.4.45.tar.gz http://pkgs.otoinstall.com/php-5.4.45.tar.gz
  438. tar -C /tmp/pkgs -zxvf /tmp/pkgs/php-5.4.45.tar.gz
  439. cd /tmp/pkgs/php-5.4.45
  440. ./configure --prefix=/usr --libdir=/usr/lib --with-libdir=lib --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-libxml-dir=/usr/bin/xml2-config \
  441. --with-openssl --with-kerberos --with-zlib-dir=/usr/lib --enable-bcmath --with-bz2=/usr/lib --enable-calendar --with-curl=/usr/include/curl --with-enchant \
  442. --with-curlwrappers --enable-exif --enable-ftp --with-openssl-dir=/usr/include/openssl --with-gd --with-vpx-dir=/usr/lib --with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib \
  443. --with-zlib-dir=/usr/lib --with-xpm-dir=/usr/lib --with-freetype-dir=/usr/lib --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext=/usr/lib/gettext \
  444. --with-gmp --with-mhash --with-imap=/usr/lib --with-imap-ssl=/usr/include/openssl --enable-intl --enable-mbstring --with-mcrypt=/usr/lib--with-mysql --with-mysqli \
  445. --with-mysql-sock=/var/lib/mysql/mysql.sock --with-pdo-mysql --with-pspell --enable-shmop --enable-soap --enable-sockets --with-tidy --enable-wddx --with-xmlrpc \
  446. --with-xsl=/usr/lib --enable-zip
  447. make
  448. make install
  449.  
  450. /tmp/pkgs/php-5.4.45/build/shtool install -c ext/phar/phar.phar /usr/bin
  451. ln -s -f /usr/bin/phar.phar /usr/bin/phar
  452. cp php.ini-production /usr/lib/php.ini
  453.  
  454. cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
  455. chmod +x /etc/init.d/php-fpm
  456. update-rc.d php-fpm defaults
  457. cp sapi/fpm/php-fpm.conf /usr/etc/php-fpm.conf
  458.  
  459. else if [ $php5 = "php55" ]; then
  460.  
  461. wget -O /tmp/pkgs/php-5.5.29.tar.gz http://pkgs.otoinstall.com/php-5.5.29.tar.gz
  462. tar -C /tmp/pkgs -zxvf /tmp/pkgs/php-5.5.29.tar.gz
  463. cd /tmp/pkgs/php-5.5.29
  464.  
  465. ./configure --prefix=/usr --libdir=/usr/lib --with-libdir=lib --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-libxml-dir=/usr/bin/xml2-config \
  466. --with-openssl --with-zlib --enable-bcmath --with-bz2 --enable-calendar --with-curl --with-enchant --enable-exif --enable-ftp --with-gd --with-vpx-dir \
  467. --with-jpeg-dir --with-png-dir --with-zlib-dir --with-xpm-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext \
  468. --with-gmp --with-mhash --with-imap --with-imap-ssl --with-kerberos --enable-intl --enable-mbstring --with-libmbfl --with-onig --with-mcrypt --with-mysql \
  469. --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysqli --enable-embedded-mysqli --enable-pcntl --with-pdo-mysql --with-pspell --with-libedit --with-readline \
  470. --with-mm --enable-shmop --with-snmp --enable-soap --enable-sockets --with-tidy --enable-wddx --with-xmlrpc --with-xsl --enable-zip
  471. make
  472. make install
  473.  
  474. /tmp/pkgs/php-5.5.29/build/shtool install -c ext/phar/phar.phar /usr/bin
  475. ln -s -f /usr/bin/phar.phar /usr/bin/phar
  476. cp php.ini-production /usr/lib/php.ini
  477.  
  478. cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
  479. chmod +x /etc/init.d/php-fpm
  480. update-rc.d php-fpm defaults
  481. cp sapi/fpm/php-fpm.conf /usr/etc/php-fpm.conf
  482.  
  483. else if [ $php5 = "php56" ]; then
  484.  
  485. wget -O /tmp/pkgs/php-5.6.13.tar.gz http://pkgs.otoinstall.com/php-5.6.13.tar.gz
  486. tar -C /tmp/pkgs -zxvf /tmp/pkgs/php-5.6.13.tar.gz
  487. cd /tmp/pkgs/php-5.6.13
  488.  
  489. ./configure --prefix=/usr --libdir=/usr/lib --with-libdir=lib --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-libxml-dir=/usr/bin/xml2-config \
  490. --with-openssl --with-zlib --enable-bcmath --with-bz2 --enable-calendar --with-curl --with-enchant --enable-exif --enable-ftp --with-gd --with-vpx-dir \
  491. --with-jpeg-dir --with-png-dir --with-zlib-dir --with-xpm-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext \
  492. --with-gmp --with-mhash --with-imap --with-imap-ssl --with-kerberos --enable-intl --enable-mbstring --with-libmbfl --with-onig --with-mcrypt --with-mysql \
  493. --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysqli --enable-embedded-mysqli --enable-pcntl --with-pdo-mysql --with-pspell --with-libedit --with-readline \
  494. --with-mm --enable-shmop --with-snmp --enable-soap --enable-sockets --with-tidy --enable-wddx --with-xmlrpc --with-xsl --enable-zip
  495. make
  496. make install
  497.  
  498. /tmp/pkgs/php-5.6.13/build/shtool install -c ext/phar/phar.phar /usr/bin
  499. ln -s -f /usr/bin/phar.phar /usr/bin/phar
  500. cp php.ini-production /usr/lib/php.ini
  501.  
  502. cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
  503. chmod +x /etc/init.d/php-fpm
  504. update-rc.d php-fpm defaults
  505. cp sapi/fpm/php-fpm.conf /usr/etc/php-fpm.conf
  506.  
  507. fi
  508. fi
  509. fi
  510.  
  511. echo ""
  512. echo "          ---------------------INSTALLING MODULES-------------------          "
  513. echo ""
  514.  
  515. if [ "$arch" == "x86_64" ]; then
  516.  
  517. wget -O /tmp/pkgs/ioncube_loaders_lin_x86-64.tar.gz http://pkgs.otoinstall.com/ioncube_loaders_lin_x86-64.tar.gz
  518. tar -C /tmp/pkgs -zxvf /tmp/pkgs/ioncube_loaders_lin_x86-64.tar.gz
  519.  
  520. else
  521.  
  522. wget -O /tmp/pkgs/ioncube_loaders_lin_x86.tar.gz http://pkgs.otoinstall.com/ioncube_loaders_lin_x86.tar.gz
  523. tar -C /tmp/pkgs -zxvf /tmp/pkgs/ioncube_loaders_lin_x86.tar.gz
  524.  
  525. fi
  526.  
  527. if [ $php5 = "php54" ]; then
  528.  
  529. mkdir -p /usr/lib/extensions/no-debug-non-zts-20100525
  530. mv /tmp/pkgs/ioncube/ioncube_loader_lin_5.4.so /usr/lib/extensions/no-debug-non-zts-20100525
  531. echo "
  532. zend_extension="/usr/lib/extensions/no-debug-non-zts-20100525/ioncube_loader_lin_5.4.so"" >> /usr/lib/php.ini
  533.  
  534. else if [ $php5 = "php55" ]; then
  535.  
  536. mv /tmp/pkgs/ioncube/ioncube_loader_lin_5.5.so /usr/lib/extensions/no-debug-non-zts-20121212
  537. echo "
  538. zend_extension="/usr/lib/extensions/no-debug-non-zts-20121212/ioncube_loader_lin_5.5.so"" >> /usr/lib/php.ini
  539.  
  540. else if [ $php5 = "php56" ]; then
  541.  
  542. mv /tmp/pkgs/ioncube/ioncube_loader_lin_5.6.so /usr/lib/extensions/no-debug-non-zts-20131226
  543. echo "
  544. zend_extension="/usr/lib/extensions/no-debug-non-zts-20131226/ioncube_loader_lin_5.6.so"" >> /usr/lib/php.ini
  545.  
  546. fi
  547. fi
  548. fi
  549.  
  550. if [ $phpcacher = "xcache" ]; then
  551.  
  552. wget -O /tmp/pkgs/xcache-3.2.0.tar.gz http://pkgs.otoinstall.com/xcache-3.2.0.tar.gz
  553. tar -C /tmp/pkgs -zxvf /tmp/pkgs/xcache-3.2.0.tar.gz
  554. cd /tmp/pkgs/xcache-3.2.0
  555. phpize
  556. ./configure --prefix=/usr --libdir=/usr/lib  --enable-xcache --enable-xcache-constant --enable-xcache-optimizer
  557. make
  558. make install
  559.  
  560.     if [ $php5 = "php54" ]; then
  561. echo "
  562. extension="/usr/lib/extensions/no-debug-non-zts-20100525/xcache.so"
  563. xcache.shm_scheme="mmap"
  564. xcache.mmap_path="/dev/zero"
  565. xcache.readonly_protection=Off
  566. xcache.size=0
  567. xcache.count=1
  568. xcache.slots=8K
  569. xcache.ttl=0
  570. xcache.gc_interval=0
  571. xcache.cacher=On
  572. xcache.stat=On
  573. xcache.var_size=0
  574. xcache.var_count=1
  575. xcache.var_slots=8K
  576. xcache.var_ttl=0
  577. xcache.var_maxttl=0
  578. xcache.var_gc_interval=300" >> /usr/lib/php.ini
  579.     else if [ $php5 = "php55" ]; then
  580. echo "
  581. extension="/usr/lib/extensions/no-debug-non-zts-20121212/xcache.so"
  582. xcache.shm_scheme="mmap"
  583. xcache.mmap_path="/dev/zero"
  584. xcache.readonly_protection=Off
  585. xcache.size=0
  586. xcache.count=1
  587. xcache.slots=8K
  588. xcache.ttl=0
  589. xcache.gc_interval=0
  590. xcache.cacher=On
  591. xcache.stat=On
  592. xcache.var_size=0
  593. xcache.var_count=1
  594. xcache.var_slots=8K
  595. xcache.var_ttl=0
  596. xcache.var_maxttl=0
  597. xcache.var_gc_interval=300" >> /usr/lib/php.ini
  598.     else if [ $php5 = "php56" ]; then
  599. echo "
  600. extension="/usr/lib/extensions/no-debug-non-zts-20131226/xcache.so"
  601. xcache.shm_scheme="mmap"
  602. xcache.mmap_path="/dev/zero"
  603. xcache.readonly_protection=Off
  604. xcache.size=0
  605. xcache.count=1
  606. xcache.slots=8K
  607. xcache.ttl=0
  608. xcache.gc_interval=0
  609. xcache.cacher=On
  610. xcache.stat=On
  611. xcache.var_size=0
  612. xcache.var_count=1
  613. xcache.var_slots=8K
  614. xcache.var_ttl=0
  615. xcache.var_maxttl=0
  616. xcache.var_gc_interval=300" >> /usr/lib/php.ini
  617.     fi
  618.     fi
  619.     fi
  620.  
  621. else if [ $phpcacher = "zopt" ]; then
  622.  
  623.     if [ $php5 = "php54" ]; then
  624.     wget -O /tmp/pkgs/zendopcache-7.0.5.tgz http://pkgs.otoinstall.com/zendopcache-7.0.5.tgz
  625.     tar -C /tmp/pkgs -zxvf /tmp/pkgs/zendopcache-7.0.5.tgz
  626.     cd /tmp/pkgs/zendopcache-7.0.5
  627.     phpize
  628.     ./configure --prefix=/usr --libdir=/usr/lib
  629.     make
  630.     make install
  631. echo "
  632. zend_extension="/usr/lib/extensions/no-debug-non-zts-20100525/opcache.so"
  633. opcache.memory_consumption=128
  634. opcache.interned_strings_buffer=8
  635. opcache.max_accelerated_files=4000
  636. opcache.revalidate_freq=60
  637. opcache.fast_shutdown=1
  638. opcache.enable_cli=1
  639. opcache.enable=1" >> /usr/lib/php.ini
  640.     else if [ $php5 = "php55" ]; then
  641. echo "
  642. zend_extension="/usr/lib/extensions/no-debug-non-zts-20121212/opcache.so"
  643. opcache.memory_consumption=128
  644. opcache.interned_strings_buffer=8
  645. opcache.max_accelerated_files=4000
  646. opcache.revalidate_freq=60
  647. opcache.fast_shutdown=1
  648. opcache.enable_cli=1
  649. opcache.enable=1" >> /usr/lib/php.ini
  650.     else if [ $php5 = "php56" ]; then
  651. echo "
  652. zend_extension="/usr/lib/extensions/no-debug-non-zts-20131226/opcache.so"
  653. opcache.memory_consumption=128
  654. opcache.interned_strings_buffer=8
  655. opcache.max_accelerated_files=4000
  656. opcache.revalidate_freq=60
  657. opcache.fast_shutdown=1
  658. opcache.enable_cli=1
  659. opcache.enable=1" >> /usr/lib/php.ini
  660.     fi
  661.     fi
  662.     fi
  663.  
  664. fi
  665. fi
  666.  
  667. wget -O /tmp/pkgs/suhosin-0.9.38.tar.gz http://pkgs.otoinstall.com/suhosin-0.9.38.tar.gz
  668. tar -C /tmp/pkgs -zxvf /tmp/pkgs/suhosin-0.9.38.tar.gz
  669. cd /tmp/pkgs/suhosin-0.9.38
  670. phpize
  671. ./configure --prefix=/usr --libdir=/usr/lib --enable-suhosin
  672. make
  673. make install
  674.     if [ $php5 = "php54" ]; then
  675. echo "
  676. extension="/usr/lib/extensions/no-debug-non-zts-20100525/suhosin.so"
  677. suhosin.request.max_vars=2048
  678. suhosin.post.max_vars=2048
  679. suhosin.request.max_array_index_length=256
  680. suhosin.post.max_array_index_length=256
  681. suhosin.request.max_totalname_length=8192
  682. suhosin.post.max_totalname_length=8192" >> /usr/lib/php.ini
  683.     else if [ $php5 = "php55" ]; then
  684. echo "
  685. extension="/usr/lib/extensions/no-debug-non-zts-20121212/suhosin.so"
  686. suhosin.request.max_vars=2048
  687. suhosin.post.max_vars=2048
  688. suhosin.request.max_array_index_length=256
  689. suhosin.post.max_array_index_length=256
  690. suhosin.request.max_totalname_length=8192
  691. suhosin.post.max_totalname_length=8192" >> /usr/lib/php.ini
  692.     else if [ $php5 = "php56" ]; then
  693. echo "
  694. extension="/usr/lib/extensions/no-debug-non-zts-20131226/suhosin.so"
  695. suhosin.request.max_vars=2048
  696. suhosin.post.max_vars=2048
  697. suhosin.request.max_array_index_length=256
  698. suhosin.post.max_array_index_length=256
  699. suhosin.request.max_totalname_length=8192
  700. suhosin.post.max_totalname_length=8192" >> /usr/lib/php.ini
  701.     fi
  702.     fi
  703.     fi
  704.  
  705. if [ "d$imagick" = "d" ] || [ `expr "$imagick" : '[yY]'` -gt 0 ]; then
  706.  
  707. wget -O /tmp/pkgs/ImageMagick.tar.gz http://pkgs.otoinstall.com/ImageMagick.tar.gz
  708. tar -C /tmp/pkgs -zxvf /tmp/pkgs/ImageMagick.tar.gz
  709. cd /tmp/pkgs/ImageMagick-6.9.2-0
  710. ./configure --prefix=/usr --libdir=/usr/lib
  711. make
  712. make install
  713.  
  714. wget -O /tmp/pkgs/imagick-3.3.0RC2.tgz http://pkgs.otoinstall.com/imagick-3.3.0RC2.tgz
  715. tar -C /tmp/pkgs -zxvf /tmp/pkgs/imagick-3.3.0RC2.tgz
  716. cd /tmp/pkgs/imagick-3.3.0RC2
  717. phpize
  718. ./configure --prefix=/usr --libdir=/usr/lib
  719. make
  720. make install
  721.     if [ $php5 = "php54" ]; then
  722. echo "
  723. extension="/usr/lib/extensions/no-debug-non-zts-20100525/imagick.so"" >> /usr/lib/php.ini
  724.     else if [ $php5 = "php55" ]; then
  725. echo "
  726. extension="/usr/lib/extensions/no-debug-non-zts-20121212/imagick.so"" >> /usr/lib/php.ini
  727.     else if [ $php5 = "php56" ]; then
  728. echo "
  729. extension="/usr/lib/extensions/no-debug-non-zts-20131226/imagick.so"" >> /usr/lib/php.ini  
  730.     fi
  731.     fi
  732.     fi
  733. fi
  734.  
  735. echo ""
  736. echo "===========================PHP INSTALLATION COMPLETED========================="
  737. echo ""
  738.  
  739. echo ""
  740. echo "==============================CREATING WELCOME PAGE==========================="
  741. echo ""
  742. OUTFILE=/usr/share/nginx/html/index.html
  743. (
  744. echo "<html>"
  745. echo "<head>"
  746. echo "<title>NginX Auto Installer 2.0 - Powered By Otoinstall.com</title>"
  747. echo "<style type=text/css media=screen>"
  748. echo "td, tr {background: #FFFFFF;"
  749. echo "font-size: 15px;"
  750. echo "border: none;"
  751. echo "}"
  752. echo "td.head1 {background: #000000;"
  753. echo "color: #FFFFFF;"
  754. echo "}"
  755. echo "td.head2 {font-weight: bold;"
  756. echo "}"
  757. echo "</style>"
  758. echo "</head>"
  759. echo "<body>"
  760. echo "<center><h3>NginX Works!!!</h3></center>"
  761. echo "<table width=500 border=0 align=center>"
  762. echo "<tr>"
  763. echo "<td class=head1 colspan=8><center><strong>SERVER HARDWARE</strong></center></td></tr>"
  764. echo "<tr>"
  765. echo "<td class=head2 width=130>&nbsp;CPU:</td><td>&nbsp;`cat /proc/cpuinfo | grep 'model name' | head -n 1 | awk {'print $4, $5, $6, $7, $8, $9'}`</td></tr>"
  766. echo "<tr>"
  767. echo "<td class=head2 width=130>&nbsp;Number of CPU(s):</td><td>&nbsp;`cat /proc/cpuinfo | grep -c processor`</td></tr>"
  768. echo "</table>"
  769. echo "<table width=500 border=0 align=center>"
  770. echo "<tr>"
  771. echo "<td class=head1 colspan=8><center><strong>SERVER SOFTWARE</strong></center></td></tr>"
  772. echo "<tr>"
  773. if [ -s /etc/lsb-release ]; then
  774.     echo "<td class=head2 width=130>&nbsp;Operating System:</td><td>&nbsp;Ubuntu 14.04 Trusty</td></tr>"
  775. fi
  776. if [[ $(cat /etc/debian_version) == *7.* ]]; then
  777.     echo "<td class=head2 width=130>&nbsp;Operating System:</td><td>&nbsp;Debian `cat /etc/debian_version` Wheezy</td></tr>"
  778. else if [[ $(cat /etc/debian_version) == *8.* ]]; then
  779.     echo "<td class=head2 width=130>&nbsp;Operating System:</td><td>&nbsp;Debian `cat /etc/debian_version` Jessie</td></tr>"
  780. fi 
  781. fi
  782. echo "<tr>"
  783. echo "<td class=head2 width=130>&nbsp;Kernel Version:</td><td>&nbsp;`uname -r`</td></tr>"
  784. echo "<tr>"
  785. echo "<td class=head2 width=130>&nbsp;NginX Version:</td><td>&nbsp;1.9.4</td></tr>"
  786. echo "<tr>"
  787. echo "<td class=head2 width=130>&nbsp;PHP Version:</td><td>&nbsp;`php -v | grep -v 'with' | grep -v 'Copyright' | awk {'print $2'}`</td></tr>"
  788. echo "<tr>"
  789. echo "<td class=head2 width=130>&nbsp;Zend Version:</td><td>&nbsp;`php -v | grep -v 'PHP' | grep -v 'with' | awk {'print $3'} | cut -c2-6`</td></tr>"
  790. echo "<tr>"
  791. echo "<td class=head2 width=130>&nbsp;MySQL Version:</td><td>&nbsp;`mysql -V | awk {'print $5'} | cut -c1-6`</td></tr>"
  792. echo "<tr>"
  793. echo "<td class=head2 width=130>&nbsp;PHPINFO:</td><td>&nbsp;<a href=../phpinfo.php>here</a></td></tr>"
  794. echo "<tr>"
  795. echo "<td class=head2 width=130>&nbsp;phpMyAdmin:</td><td>&nbsp;<a href=../$phpmyadmin>here</a></td></tr>"
  796. echo "</table>"
  797. echo "<center><p>If you feel this script is helpul, you can give a feedback by spreading or promoting to your friends or communities.</p>"
  798. echo "<p>Created by <a href=http://otoinstall.com>NginX Auto Installer</a> &amp; <a href=http://www.vbfk.com>Junker</a></p></center>"<< EOF
  799. EOF
  800. ) > $OUTFILE
  801.  
  802. cat >/usr/share/nginx/html/phpinfo.php<<EOF
  803. <?php phpinfo(); ?>
  804. EOF
  805.  
  806. echo ""
  807. echo "==============================INSTALLING PHPMYADMIN==========================="
  808. echo ""
  809.  
  810. wget -O /tmp/pkgs/phpMyAdmin-4.4.14-all-languages.zip http://pkgs.otoinstall.com/phpMyAdmin-4.4.14-all-languages.zip
  811. unzip -d /usr/share/nginx/html /tmp/pkgs/phpMyAdmin-4.4.14-all-languages.zip
  812. cd /usr/share/nginx/html/phpMyAdmin-4.4.14-all-languages
  813. sed -i -e 's@blowfi55@'$ppblow'@' config.inc.php
  814. sed -i 's/localhost/127.0.0.1/g' config.inc.php
  815. cd /usr/share/nginx/html
  816. mv phpMyAdmin-4.4.14-all-languages $phpmyadmin
  817.  
  818. echo ""
  819. echo "===============================INSTALLING PUREFTPD============================"
  820. echo ""
  821.  
  822. if [ "d$pureftpd" = "d" ] || [ `expr "$pureftpd" : '[yY]'` -gt 0 ]; then
  823.     wget -O /tmp/pkgs/pure-ftpd-1.0.42.tar.gz http://pkgs.otoinstall.com/pure-ftpd-1.0.42.tar.gz
  824.     tar -C /tmp/pkgs -zxvf /tmp/pkgs/pure-ftpd-1.0.42.tar.gz
  825.     cd /tmp/pkgs/pure-ftpd-1.0.42
  826.     ./configure --prefix=/usr --libdir=/usr/lib
  827.     make install-strip
  828.     /usr/sbin/pure-ftpd &
  829.     wget -O /etc/init.d/pureftpd http://txt.otoinstall.com/pureftpd
  830.     chmod +x /etc/init.d/pureftpd
  831.     update-rc.d pureftpd defaults
  832. fi
  833.  
  834. echo ""
  835. echo "====================================CLEANING UP=============================="
  836. echo ""
  837.  
  838. rm -rf /tmp/pkgs
  839.  
  840. echo ""
  841. echo "===========================STARTING YOUR ROCK MACHINE!!!======================"
  842. echo ""
  843.  
  844. service nginx restart
  845. service php-fpm start
  846. service mysql start
  847.  
  848. echo ""
  849. echo "==============================INSTALLATION COMPLETED=========================="
  850. echo ""
  851.  
  852. echo "You're suggested to reboot first before start using your box."
  853. echo ""
  854. echo "=============================================================================="
  855. echo "              PLEASE SAVE THE FOLLOWING DATA FOR YOUR CREDENTIALS"
  856. echo "=============================================================================="
  857. echo "Post Installation:    http://$myhome"
  858. echo ""
  859. echo "FTP/SFTP Hostname:    $myhome"
  860. echo "FTP/SFTP URI:         ftp://www@$myhome"
  861. echo "FTP/SFTP User:        www"
  862. echo "FTP/SFTP Pass:        $ftppwd"
  863. echo "FTP/SFTP Directory:   /home/www"
  864. echo ""
  865. echo "MySQL Root Pass:      $mysqlrootpwd"
  866. echo "phpMyAdmin URL:       https://$myhome/$phpmyadmin"
  867. echo "phpMyAdmin User:      root"
  868. echo "phpMyAdmin Pass:      $mysqlrootpwd"
  869. echo "=============================================================================="
  870. echo ""
  871.  
  872. else
  873.  
  874. if [ -a "/etc/centos-release" ]; then
  875.  
  876. clear
  877.  
  878. echo "=============================================================================="
  879. echo "          NGINX - PHP - MYSQL AUTO INSTALLER 2.0 FOR CENTOS 6 & 7"            
  880. echo "=============================================================================="
  881. echo "                   2298@otoinstall.com & Junker@vbfk.com"
  882. echo "       http://otoinstall.com/nginx-auto-installer-php-mysql-lnmp-v2-0"
  883. echo "                     For more information please visit:"
  884. echo "                           http://otoinstall.com"
  885. echo "=============================================================================="
  886.  
  887. arch=`uname -i`
  888. proc=`cat /proc/cpuinfo | grep -c processor`
  889. centos=`cat /etc/redhat-release`
  890. # myhome=`ifconfig | grep 'inet addr:' | grep -v '127.0.0.1' | grep -v '127.0.0.2' | cut -d: -f2 | awk {'print $1'} | head -n 1`
  891. myhome=`hostname --ip-address`
  892. mkdir -p /tmp/pkgs
  893.  
  894. if [ "$arch" == "x86_64" ]; then
  895.     library="lib64"
  896. else
  897.     library="lib"
  898. fi
  899.  
  900. #Set MySQL root password
  901. SAKSESBUNG=0
  902. COBALAGI=1
  903. while [ $SAKSESBUNG -eq "0" ]; do
  904.     read -p "Please input your preferred mysql root password: " mysqlrootpwd
  905.     if [ "$mysqlrootpwd" = "" ]; then
  906.         if [ $COBALAGI -lt 3 ]; then
  907.             echo ""
  908.             echo "You're not typing, it is still empty!"
  909.             echo ""
  910.             COBALAGI=`expr $COBALAGI + 1`
  911.         else
  912.             echo ""
  913.             echo "You might want to try it again later."
  914.             echo ""
  915.             exit 0
  916.         fi
  917.     else
  918.         mysqlrootpwd="$mysqlrootpwd"
  919.         SAKSESBUNG=1
  920.     fi
  921. done
  922. echo ""
  923.  
  924. #Set phpMyAdmin blowfish_secret
  925. SAKSESBUNG=0
  926. COBALAGI=1
  927. while [ $SAKSESBUNG -eq "0" ]; do
  928.     read -p "Please input your preferred phpmyadmin blowfish_secret (eg: mysecret): " ppblow
  929.     if [ "$ppblow" = "" ]; then
  930.         if [ $COBALAGI -lt 3 ]; then
  931.             echo ""
  932.             echo "You're not typing, it is still empty!"
  933.             echo ""
  934.             COBALAGI=`expr $COBALAGI + 1`
  935.         else
  936.             echo ""
  937.             echo "You might want to try it again later."
  938.             echo ""
  939.             exit 0
  940.         fi
  941.     else
  942.         ppblow="$ppblow"
  943.         SAKSESBUNG=1
  944.     fi
  945. done
  946. echo ""
  947.  
  948. #Set phpMyAdmin directory name
  949. SAKSESBUNG=0
  950. COBALAGI=1
  951. while [ $SAKSESBUNG -eq "0" ]; do
  952.     read -p "Please input your preferred phpmyadmin directory name: " phpmyadmin
  953.     if [ "$phpmyadmin" = "" ]; then
  954.         if [ $COBALAGI -lt 3 ]; then
  955.             echo ""
  956.             echo "You're not typing, it is still empty!"
  957.             echo ""
  958.             COBALAGI=`expr $COBALAGI + 1`
  959.         else
  960.             echo ""
  961.             echo "You might want to try it again later."
  962.             echo ""
  963.             exit 0
  964.         fi
  965.     else
  966.         phpmyadmin="$phpmyadmin"
  967.         SAKSESBUNG=1
  968.     fi
  969. done
  970. echo ""
  971.  
  972. #Set FTP/SFTP password
  973. SAKSESBUNG=0
  974. COBALAGI=1
  975. while [ $SAKSESBUNG -eq "0" ]; do
  976.     read -p "Please input your preferred ftp/sftp password: " ftppwd
  977.     if [ "$ftppwd" = "" ]; then
  978.         if [ $COBALAGI -lt 3 ]; then
  979.             echo ""
  980.             echo "You're not typing, it is still empty!"
  981.             echo ""
  982.             COBALAGI=`expr $COBALAGI + 1`
  983.         else
  984.             echo ""
  985.             echo "You might want to try it again later."
  986.             echo ""
  987.             exit 0
  988.         fi
  989.     else
  990.         ftppwd="$ftppwd"
  991.         SAKSESBUNG=1
  992.     fi
  993. done
  994. echo ""
  995.  
  996. #Confirm PHP
  997. echo "Type 'php54' for PHP 5.4.x"
  998. echo "Type 'php55' for PHP 5.5.x"
  999. echo "Type 'php56' for PHP 5.6.x"
  1000. while read -p "Please choose your preferred PHP version: " php5
  1001.     do case $php5 in
  1002.     php54) [ "php5" = "$php5" ]; break;;
  1003.     php55) [ "php5" = "$php5" ]; break;;
  1004.     php56) [ "php5" = "$php5" ]; break;;
  1005.     *) echo "";
  1006.        echo "Please type the right choice!";;
  1007.     esac
  1008. done
  1009. echo ""
  1010.  
  1011. #Confirm PHP Accelerator
  1012. echo "Would you like to install PHP Accelerator?"
  1013. echo ""
  1014. echo "Type 'zopt' for Zend Opcache"
  1015. echo "Type 'xcache' for XCache"
  1016. echo "Type 'noop' if you don't want to install PHP Accelerator"
  1017. while read -p "Please choose your preferred PHP Opcode Cacher: " phpcacher
  1018.     do case $phpcacher in
  1019.     zopt) [ "phpcacher" = "$phpcacher" ]; break;;
  1020.     xcache) [ "phpcacher" = "$phpcacher" ]; break;;
  1021.     noop) [ "phpcacher" = "$phpcacher" ]; break;;
  1022.     *) echo "";
  1023.        echo "Please type the right choice!";;
  1024.     esac
  1025. done
  1026. echo ""
  1027.  
  1028. #Confirm IMAGICK
  1029. while read -p "Would you like to install ImageMagick?[Y/n] " imagick
  1030.     do case $imagick in
  1031.     Y) [ "imagick" = "$imagick" ]; break;;
  1032.     y) [ "imagick" = "$imagick" ]; break;;
  1033.     N) [ "imagick" = "$imagick" ]; break;;
  1034.     n) [ "imagick" = "$imagick" ]; break;;
  1035.     *) echo "";
  1036.        echo "Please type the right choice!";;
  1037.     esac
  1038. done
  1039. echo ""
  1040.  
  1041. #Confirm PureFTPD
  1042. while read -p "Would you like to install PureFTPD?[Y/n] " pureftpd
  1043.     do case $pureftpd in
  1044.     Y) [ "pureftpd" = "$pureftpd" ]; break;;
  1045.     y) [ "pureftpd" = "$pureftpd" ]; break;;
  1046.     N) [ "pureftpd" = "$pureftpd" ]; break;;
  1047.     n) [ "pureftpd" = "$pureftpd" ]; break;;
  1048.     *) echo "";
  1049.        echo "Please type the right choice!";;
  1050.     esac
  1051. done
  1052.  
  1053.     get_char()
  1054.     {
  1055.     SAVEDSTTY=`stty -g`
  1056.     stty -echo
  1057.     stty cbreak
  1058.     dd if=/dev/tty bs=1 count=1 2> /dev/null
  1059.     stty -raw
  1060.     stty echo
  1061.     stty $SAVEDSTTY
  1062.     }
  1063.     echo ""
  1064.     echo "Press any key to start the installation..."
  1065.     char=`get_char`
  1066.  
  1067. echo ""
  1068. echo "==================================PREPARATION================================="
  1069. echo ""
  1070. if [ -s /etc/selinux/config ]; then
  1071. sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
  1072. fi
  1073. /usr/sbin/setenforce 0
  1074.  
  1075. if [[ $(cat /etc/redhat-release | awk {'print $4'}) == *7.* ]]; then
  1076. firewall-cmd --permanent --zone=public --add-port=80/tcp
  1077. firewall-cmd --permanent --zone=public --add-port=443/tcp
  1078. firewall-cmd --permanent --zone=public --add-port=21/tcp
  1079. firewall-cmd --reload
  1080. firewall-cmd --zone=public --query-port=80/tcp
  1081. firewall-cmd --zone=public --query-port=443/tcp
  1082. firewall-cmd --zone=public --query-port=21/tcp
  1083. fi
  1084.  
  1085. echo ""
  1086. echo "=======================INSTALLING INSTALLER DEPENDENCIES======================"
  1087. echo ""
  1088.  
  1089. yum remove -y httpd* php* mysql*
  1090. yum install -y gcc gcc-c++ make automake wget zip unzip
  1091.  
  1092. echo ""
  1093. echo "=======================DEPENDENCIES INSTALLATION COMPLETED===================="
  1094. echo ""
  1095.  
  1096. echo ""
  1097. echo "================================INSTALLING NGINX=============================="
  1098. echo ""
  1099.  
  1100. useradd www
  1101. echo www:$ftppwd|chpasswd
  1102. mkdir -p /home/www
  1103.  
  1104. if [[ $(cat /etc/redhat-release | awk {'print $4'}) == *7.* ]]; then
  1105.     wget -O /etc/yum.repos.d/nginx.repo http://txt.otoinstall.com/centos7/nginx.repo
  1106. else
  1107.     wget -O /etc/yum.repos.d/nginx.repo http://txt.otoinstall.com/centos6/nginx.repo
  1108. fi
  1109.  
  1110. yum install -y nginx
  1111.  
  1112. mkdir -p /etc/nginx/sslconf
  1113. cd /etc/nginx/sslconf
  1114. openssl genrsa -out server.key 2048
  1115. openssl req -new -key server.key -out server.csr -subj "/C=ab/ST=cd/L=ef/CN=ghij"
  1116. mv server.key server.key.org
  1117. openssl rsa -in server.key.org -out server.key
  1118. openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
  1119.  
  1120. echo ""
  1121. echo "          ----------------CREATING MASTER VIRTUAL HOST--------------          "
  1122. echo ""
  1123.  
  1124. mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.default
  1125.  
  1126. cat >/etc/nginx/nginx.conf<<EOF
  1127.  
  1128. user              www;
  1129. worker_processes  $proc;
  1130.  
  1131. error_log       /var/log/nginx/error.log warn;
  1132.  
  1133. pid /var/run/nginx.pid;
  1134.  
  1135.  
  1136. events {
  1137.     worker_connections  1024;
  1138. }
  1139.  
  1140. http {
  1141.     include     /etc/nginx/mime.types;
  1142.     default_type    application/octet-stream;
  1143.     client_max_body_size    10M;
  1144.     client_body_buffer_size 128k;
  1145.     server_names_hash_bucket_size  64;
  1146.  
  1147.     log_format  main  '$remote_addr | $remote_user [$time_local] | "$request"'
  1148.               ' | $status | $body_bytes_sent bytes | "$http_referer"'
  1149.               ' | "$http_user_agent" | "$http_x_forwarded_for"';
  1150.  
  1151.     access_log  /var/log/nginx/access.log  main;
  1152.  
  1153.     sendfile        on;
  1154.     #tcp_nopush     on;
  1155.     keepalive_timeout  65;
  1156.     tcp_nodelay on;
  1157.  
  1158.     gzip  on;
  1159.  
  1160. server {
  1161.   listen 80;
  1162.   server_name $myhome;
  1163.   return      301 https://$myhome\$request_uri;
  1164.   location / {
  1165.     root /usr/share/nginx/html;
  1166.     index index.html index.htm index.php;  
  1167.   }
  1168.  
  1169.   location ~ \.php$ {
  1170.     include /etc/nginx/fastcgi_params;
  1171.     fastcgi_pass 127.0.0.1:9000;
  1172.     fastcgi_index index.php;
  1173.     fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html\$fastcgi_script_name;
  1174.   }
  1175. }
  1176.  
  1177. server {
  1178.   listen 443 ssl;
  1179.   server_name $myhome;
  1180.   ssl_certificate      /etc/nginx/sslconf/server.crt;
  1181.   ssl_certificate_key  /etc/nginx/sslconf/server.key;
  1182.   ssl_session_timeout  5m;
  1183.  
  1184.   location / {
  1185.     root /usr/share/nginx/html;
  1186.     index index.html index.htm index.php;  
  1187.   }
  1188.  
  1189.   location ~ \.php$ {
  1190.     include /etc/nginx/fastcgi_params;
  1191.     fastcgi_pass 127.0.0.1:9000;
  1192.     fastcgi_index index.php;
  1193.     fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html\$fastcgi_script_name;
  1194.   }
  1195. }
  1196.    
  1197.     # Load virtual host configuration files.
  1198.       include /etc/nginx/sites-enabled/*;
  1199. }
  1200.  
  1201. EOF
  1202.  
  1203. echo ""
  1204. echo "==========================NGINX INSTALLATION COMPLETED========================"
  1205. echo ""
  1206.  
  1207. echo ""
  1208. echo "===============================INSTALLING MYSQL==============================="
  1209. echo ""
  1210.  
  1211. if [[ $(cat /etc/redhat-release | awk {'print $4'}) == *7.* ]]; then
  1212. yum localinstall -y http://pkgs.otoinstall.com/mysql-community-release-el7-5.noarch.rpm
  1213. else
  1214. yum localinstall -y http://pkgs.otoinstall.com/mysql-community-release-el6-5.noarch.rpm
  1215. fi
  1216. yum install -y mysql-community-server mysql-community-devel
  1217.  
  1218. echo ""
  1219. echo "          -----------------------SECURING MYSQL---------------------          "
  1220. echo ""
  1221.  
  1222. service mysqld start
  1223. mysqladmin -u root password $mysqlrootpwd
  1224. echo 'DROP DATABASE 'test';' | mysql -u root -p$mysqlrootpwd
  1225. echo "SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('$mysqlrootpwd');" | mysql -u root -p$mysqlrootpwd
  1226. echo "SET PASSWORD FOR 'root'@'`hostname`' = PASSWORD('$mysqlrootpwd');" | mysql -u root -p$mysqlrootpwd
  1227. echo "DELETE FROM mysql.user WHERE User = '';" | mysql -u root -p$mysqlrootpwd
  1228. echo "DROP USER ''@'%';" | mysql -u root -p$mysqlrootpwd
  1229. echo "DROP USER 'root'@'::1';" | mysql -u root -p$mysqlrootpwd
  1230. service mysqld stop
  1231.  
  1232. echo ""
  1233. echo "==========================MYSQL INSTALLATION COMPLETED========================"
  1234. echo ""
  1235.  
  1236. echo ""
  1237. echo "=================================INSTALLING PHP==============================="
  1238. echo ""
  1239.  
  1240. yum install -y python-devel openssl-devel bzip2-devel libjpeg-devel libvpx-devel libpng-devel freetype-devel t1lib-devel gmp-devel libc-client-devel \
  1241. libicu-devel aspell-devel libtidy-devel enchant-devel libXpm-devel libedit-devel net-snmp-devel xinetd pam-devel
  1242.  
  1243. if [[ $(cat /etc/redhat-release | awk {'print $4'}) == *7.* ]]; then
  1244.     wget -O /tmp/pkgs/epel-release-latest-7.noarch.rpm http://pkgs.otoinstall.com/epel-release-latest-7.noarch.rpm
  1245.     rpm -ivh /tmp/pkgs/epel-release-latest-7.noarch.rpm
  1246.     yum install -y libc-client-devel libtidy-devel
  1247.     cd /etc/yum.repos.d/
  1248.     mv epel.repo epel.repo.backup
  1249.     mv epel-testing.repo epel-testing.repo.backup
  1250. fi
  1251.  
  1252. wget -O /tmp/pkgs/libxml2-2.9.2.tar.gz http://pkgs.otoinstall.com/libxml2-2.9.2.tar.gz
  1253. tar -C /tmp/pkgs -zxvf /tmp/pkgs/libxml2-2.9.2.tar.gz
  1254. cd /tmp/pkgs/libxml2-2.9.2
  1255. rm -rf /usr/$library/libxml2*
  1256. ./configure --prefix=/usr --libdir=/usr/$library
  1257. make
  1258. make install
  1259.  
  1260. wget -O /tmp/pkgs/libxslt-1.1.28.tar.gz http://pkgs.otoinstall.com/libxslt-1.1.28.tar.gz
  1261. tar -C /tmp/pkgs -zxvf /tmp/pkgs/libxslt-1.1.28.tar.gz
  1262. cd /tmp/pkgs/libxslt-1.1.28
  1263. rm -rf /usr/$library/libxslt* /usr/$library/libexslt*
  1264. ./configure --prefix=/usr --libdir=/usr/$library
  1265. make
  1266. make install
  1267.  
  1268. wget -O /tmp/pkgs/curl-7.44.0.tar.gz http://pkgs.otoinstall.com/curl-7.44.0.tar.gz
  1269. tar -C /tmp/pkgs -zxvf /tmp/pkgs/curl-7.44.0.tar.gz
  1270. cd /tmp/pkgs/curl-7.44.0
  1271. ./configure --prefix=/usr --libdir=/usr/$library
  1272. make
  1273. make install
  1274.  
  1275. wget -O /tmp/pkgs/libmcrypt-2.5.8.tar.gz http://pkgs.otoinstall.com/libmcrypt-2.5.8.tar.gz
  1276. tar -C /tmp/pkgs -zxvf /tmp/pkgs/libmcrypt-2.5.8.tar.gz
  1277. cd /tmp/pkgs/libmcrypt-2.5.8
  1278. ./configure --prefix=/usr --libdir=/usr/$library
  1279. make
  1280. make install
  1281.  
  1282. wget -O /tmp/pkgs/mm-1.4.2.tar.gz http://pkgs.otoinstall.com/mm-1.4.2.tar.gz
  1283. tar -C /tmp/pkgs -zxvf /tmp/pkgs/mm-1.4.2.tar.gz
  1284. cd /tmp/pkgs/mm-1.4.2
  1285. ./configure --prefix=/usr --libdir=/usr/$library
  1286. make
  1287. make install
  1288.  
  1289. if [ $php5 = "php54" ]; then
  1290.  
  1291. wget -O /tmp/pkgs/php-5.4.45.tar.gz http://pkgs.otoinstall.com/php-5.4.45.tar.gz
  1292. tar -C /tmp/pkgs -zxvf /tmp/pkgs/php-5.4.45.tar.gz
  1293. cd /tmp/pkgs/php-5.4.45
  1294. ./configure --prefix=/usr --libdir=/usr/$library  --with-libdir=$library --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-libxml-dir=/usr/bin/xml2-config \
  1295. --with-openssl --with-kerberos --with-zlib-dir=/usr/$library --enable-bcmath --with-bz2=/usr/$library --enable-calendar --with-curl=/usr/include/curl --with-enchant \
  1296. --with-curlwrappers --enable-exif --enable-ftp --with-openssl-dir=/usr/include/openssl --with-gd --with-vpx-dir=/usr/$library --with-jpeg-dir=/usr/$library \
  1297. --with-png-dir=/usr/$library --with-zlib-dir=/usr/$library --with-xpm-dir=/usr/$library --with-freetype-dir=/usr/$library --with-t1lib=/usr/include --enable-gd-native-ttf \
  1298. --enable-gd-jis-conv --with-gettext=/usr/$library/gettext --with-gmp --with-mhash --with-imap=/usr/$library --with-imap-ssl=/usr/include/openssl --enable-intl \
  1299. --enable-mbstring --with-mcrypt=/usr/$library --with-mysql --with-mysqli --with-mysql-sock=/var/$library/mysql/mysql.sock --with-pdo-mysql --with-pspell --enable-shmop \
  1300. --enable-soap --enable-sockets --with-tidy --enable-wddx --with-xmlrpc --with-xsl=/usr/$library --enable-zip
  1301. make
  1302. make install
  1303.  
  1304. /tmp/pkgs/php-5.4.45/build/shtool install -c ext/phar/phar.phar /usr/bin
  1305. ln -s -f /usr/bin/phar.phar /usr/bin/phar
  1306. cp php.ini-production /usr/$library/php.ini
  1307.  
  1308. cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
  1309. chmod +x /etc/init.d/php-fpm
  1310. chkconfig php-fpm on
  1311. cp sapi/fpm/php-fpm.conf /usr/etc/php-fpm.conf
  1312.  
  1313. else if [ $php5 = "php55" ]; then
  1314.  
  1315. wget -O /tmp/pkgs/php-5.5.29.tar.gz http://pkgs.otoinstall.com/php-5.5.29.tar.gz
  1316. tar -C /tmp/pkgs -zxvf /tmp/pkgs/php-5.5.29.tar.gz
  1317. cd /tmp/pkgs/php-5.5.29
  1318.  
  1319. ./configure --prefix=/usr --libdir=/usr/$library  --with-libdir=$library  --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-libxml-dir=/usr/bin/xml2-config \
  1320. --with-openssl --with-zlib --enable-bcmath --with-bz2 --enable-calendar --with-curl --with-enchant --enable-exif --enable-ftp --with-gd --with-vpx-dir \
  1321. --with-jpeg-dir --with-png-dir --with-zlib-dir --with-xpm-dir --with-freetype-dir --with-t1lib --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext \
  1322. --with-gmp --with-mhash --with-imap --with-imap-ssl --with-kerberos --enable-intl --enable-mbstring --with-libmbfl --with-onig --with-mcrypt --with-mysql \
  1323. --with-mysql-sock=/var/$library/mysql/mysql.sock --with-mysqli --enable-embedded-mysqli --enable-pcntl --with-pdo-mysql --with-pspell --with-libedit --with-readline \
  1324. --with-mm --enable-shmop --with-snmp --enable-soap --enable-sockets --with-tidy --enable-wddx --with-xmlrpc --with-xsl --enable-zip
  1325. make
  1326. make install
  1327.  
  1328. /tmp/pkgs/php-5.5.29/build/shtool install -c ext/phar/phar.phar /usr/bin
  1329. ln -s -f /usr/bin/phar.phar /usr/bin/phar
  1330. cp php.ini-production /usr/$library/php.ini
  1331.  
  1332. cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
  1333. chmod +x /etc/init.d/php-fpm
  1334. chkconfig php-fpm on
  1335. cp sapi/fpm/php-fpm.conf /usr/etc/php-fpm.conf
  1336.  
  1337. else if [ $php5 = "php56" ]; then
  1338.  
  1339. wget -O /tmp/pkgs/php-5.6.13.tar.gz http://pkgs.otoinstall.com/php-5.6.13.tar.gz
  1340. tar -C /tmp/pkgs -zxvf /tmp/pkgs/php-5.6.13.tar.gz
  1341. cd /tmp/pkgs/php-5.6.13
  1342.  
  1343. ./configure --prefix=/usr --libdir=/usr/$library  --with-libdir=$library  --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-libxml-dir=/usr/bin/xml2-config \
  1344. --with-openssl --with-zlib --enable-bcmath --with-bz2 --enable-calendar --with-curl --with-enchant --enable-exif --enable-ftp --with-gd --with-vpx-dir \
  1345. --with-jpeg-dir --with-png-dir --with-zlib-dir --with-xpm-dir --with-freetype-dir --with-t1lib --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext \
  1346. --with-gmp --with-mhash --with-imap --with-imap-ssl --with-kerberos --enable-intl --enable-mbstring --with-libmbfl --with-onig --with-mcrypt --with-mysql \
  1347. --with-mysql-sock=/var/$library/mysql/mysql.sock --with-mysqli --enable-embedded-mysqli --enable-pcntl --with-pdo-mysql --with-pspell --with-libedit --with-readline \
  1348. --with-mm --enable-shmop --with-snmp --enable-soap --enable-sockets --with-tidy --enable-wddx --with-xmlrpc --with-xsl --enable-zip
  1349. make
  1350. make install
  1351.  
  1352. /tmp/pkgs/php-5.6.13/build/shtool install -c ext/phar/phar.phar /usr/bin
  1353. ln -s -f /usr/bin/phar.phar /usr/bin/phar
  1354. cp php.ini-production /usr/$library/php.ini
  1355.  
  1356. cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
  1357. chmod +x /etc/init.d/php-fpm
  1358. chkconfig php-fpm on
  1359. cp sapi/fpm/php-fpm.conf /usr/etc/php-fpm.conf
  1360.  
  1361. fi
  1362. fi
  1363. fi
  1364.  
  1365. echo ""
  1366. echo "          ---------------------INSTALLING MODULES-------------------          "
  1367. echo ""
  1368.  
  1369. if [ $library = "lib" ]; then
  1370.  
  1371. wget -O /tmp/pkgs/ioncube_loaders_lin_x86.tar.gz http://pkgs.otoinstall.com/ioncube_loaders_lin_x86.tar.gz
  1372. tar -C /tmp/pkgs -zxvf /tmp/pkgs/ioncube_loaders_lin_x86.tar.gz
  1373.  
  1374. else if [ $library = "lib64" ]; then
  1375.  
  1376. wget -O /tmp/pkgs/ioncube_loaders_lin_x86-64.tar.gz http://pkgs.otoinstall.com/ioncube_loaders_lin_x86-64.tar.gz
  1377. tar -C /tmp/pkgs -zxvf /tmp/pkgs/ioncube_loaders_lin_x86-64.tar.gz
  1378.  
  1379. fi
  1380. fi
  1381.  
  1382. if [ $php5 = "php54" ]; then
  1383.  
  1384. mkdir -p /usr/$library/extensions/no-debug-non-zts-20100525
  1385. mv /tmp/pkgs/ioncube/ioncube_loader_lin_5.4.so /usr/$library/extensions/no-debug-non-zts-20100525
  1386. echo "
  1387. zend_extension="/usr/$library/extensions/no-debug-non-zts-20100525/ioncube_loader_lin_5.4.so"" >> /usr/$library/php.ini
  1388.  
  1389. else if [ $php5 = "php55" ]; then
  1390.  
  1391. mv /tmp/pkgs/ioncube/ioncube_loader_lin_5.5.so /usr/$library/extensions/no-debug-non-zts-20121212
  1392. echo "
  1393. zend_extension="/usr/$library/extensions/no-debug-non-zts-20121212/ioncube_loader_lin_5.5.so"" >> /usr/$library/php.ini
  1394.  
  1395. else if [ $php5 = "php56" ]; then
  1396.  
  1397. mv /tmp/pkgs/ioncube/ioncube_loader_lin_5.6.so /usr/$library/extensions/no-debug-non-zts-20131226
  1398. echo "
  1399. zend_extension="/usr/$library/extensions/no-debug-non-zts-20131226/ioncube_loader_lin_5.6.so"" >> /usr/$library/php.ini
  1400.  
  1401. fi
  1402. fi
  1403. fi
  1404.  
  1405. if [ $phpcacher = "xcache" ]; then
  1406.  
  1407. wget -O /tmp/pkgs/xcache-3.2.0.tar.gz http://pkgs.otoinstall.com/xcache-3.2.0.tar.gz
  1408. tar -C /tmp/pkgs -zxvf /tmp/pkgs/xcache-3.2.0.tar.gz
  1409. cd /tmp/pkgs/xcache-3.2.0
  1410. phpize
  1411. ./configure --prefix=/usr --libdir=/usr/$library  --enable-xcache --enable-xcache-constant --enable-xcache-optimizer
  1412. make
  1413. make install
  1414.  
  1415.     if [ $php5 = "php54" ]; then
  1416. echo "
  1417. extension="/usr/$library/extensions/no-debug-non-zts-20100525/xcache.so"
  1418. xcache.shm_scheme="mmap"
  1419. xcache.mmap_path="/dev/zero"
  1420. xcache.readonly_protection=Off
  1421. xcache.size=0
  1422. xcache.count=1
  1423. xcache.slots=8K
  1424. xcache.ttl=0
  1425. xcache.gc_interval=0
  1426. xcache.cacher=On
  1427. xcache.stat=On
  1428. xcache.var_size=0
  1429. xcache.var_count=1
  1430. xcache.var_slots=8K
  1431. xcache.var_ttl=0
  1432. xcache.var_maxttl=0
  1433. xcache.var_gc_interval=300" >> /usr/$library/php.ini
  1434.     else if [ $php5 = "php55" ]; then
  1435. echo "
  1436. extension="/usr/$library/extensions/no-debug-non-zts-20121212/xcache.so"
  1437. xcache.shm_scheme="mmap"
  1438. xcache.mmap_path="/dev/zero"
  1439. xcache.readonly_protection=Off
  1440. xcache.size=0
  1441. xcache.count=1
  1442. xcache.slots=8K
  1443. xcache.ttl=0
  1444. xcache.gc_interval=0
  1445. xcache.cacher=On
  1446. xcache.stat=On
  1447. xcache.var_size=0
  1448. xcache.var_count=1
  1449. xcache.var_slots=8K
  1450. xcache.var_ttl=0
  1451. xcache.var_maxttl=0
  1452. xcache.var_gc_interval=300" >> /usr/$library/php.ini
  1453.     else if [ $php5 = "php56" ]; then
  1454. echo "
  1455. extension="/usr/$library/extensions/no-debug-non-zts-20131226/xcache.so"
  1456. xcache.shm_scheme="mmap"
  1457. xcache.mmap_path="/dev/zero"
  1458. xcache.readonly_protection=Off
  1459. xcache.size=0
  1460. xcache.count=1
  1461. xcache.slots=8K
  1462. xcache.ttl=0
  1463. xcache.gc_interval=0
  1464. xcache.cacher=On
  1465. xcache.stat=On
  1466. xcache.var_size=0
  1467. xcache.var_count=1
  1468. xcache.var_slots=8K
  1469. xcache.var_ttl=0
  1470. xcache.var_maxttl=0
  1471. xcache.var_gc_interval=300" >> /usr/$library/php.ini
  1472.     fi
  1473.     fi
  1474.     fi
  1475.  
  1476. else if [ $phpcacher = "zopt" ]; then
  1477.  
  1478.     if [ $php5 = "php54" ]; then
  1479.     wget -O /tmp/pkgs/zendopcache-7.0.5.tgz http://pkgs.otoinstall.com/zendopcache-7.0.5.tgz
  1480.     tar -C /tmp/pkgs -zxvf /tmp/pkgs/zendopcache-7.0.5.tgz
  1481.     cd /tmp/pkgs/zendopcache-7.0.5
  1482.     phpize
  1483.     ./configure --prefix=/usr --libdir=/usr/$library
  1484.     make
  1485.     make install
  1486. echo "
  1487. zend_extension="/usr/$library/extensions/no-debug-non-zts-20100525/opcache.so"
  1488. opcache.memory_consumption=128
  1489. opcache.interned_strings_buffer=8
  1490. opcache.max_accelerated_files=4000
  1491. opcache.revalidate_freq=60
  1492. opcache.fast_shutdown=1
  1493. opcache.enable_cli=1
  1494. opcache.enable=1" >> /usr/$library/php.ini
  1495.     else if [ $php5 = "php55" ]; then
  1496. echo "
  1497. zend_extension="/usr/$library/extensions/no-debug-non-zts-20121212/opcache.so"
  1498. opcache.memory_consumption=128
  1499. opcache.interned_strings_buffer=8
  1500. opcache.max_accelerated_files=4000
  1501. opcache.revalidate_freq=60
  1502. opcache.fast_shutdown=1
  1503. opcache.enable_cli=1
  1504. opcache.enable=1" >> /usr/$library/php.ini
  1505.     else if [ $php5 = "php56" ]; then
  1506. echo "
  1507. zend_extension="/usr/$library/extensions/no-debug-non-zts-20131226/opcache.so"
  1508. opcache.memory_consumption=128
  1509. opcache.interned_strings_buffer=8
  1510. opcache.max_accelerated_files=4000
  1511. opcache.revalidate_freq=60
  1512. opcache.fast_shutdown=1
  1513. opcache.enable_cli=1
  1514. opcache.enable=1" >> /usr/$library/php.ini
  1515.     fi
  1516.     fi
  1517.     fi
  1518.  
  1519. fi
  1520. fi
  1521.  
  1522. wget -O /tmp/pkgs/suhosin-0.9.38.tar.gz http://pkgs.otoinstall.com/suhosin-0.9.38.tar.gz
  1523. tar -C /tmp/pkgs -zxvf /tmp/pkgs/suhosin-0.9.38.tar.gz
  1524. cd /tmp/pkgs/suhosin-0.9.38
  1525. phpize
  1526. ./configure --prefix=/usr --libdir=/usr/$library --enable-suhosin
  1527. make
  1528. make install
  1529.     if [ $php5 = "php54" ]; then
  1530. echo "
  1531. extension="/usr/$library/extensions/no-debug-non-zts-20100525/suhosin.so"
  1532. suhosin.request.max_vars=2048
  1533. suhosin.post.max_vars=2048
  1534. suhosin.request.max_array_index_length=256
  1535. suhosin.post.max_array_index_length=256
  1536. suhosin.request.max_totalname_length=8192
  1537. suhosin.post.max_totalname_length=8192" >> /usr/$library/php.ini
  1538.     else if [ $php5 = "php55" ]; then
  1539. echo "
  1540. extension="/usr/$library/extensions/no-debug-non-zts-20121212/suhosin.so"
  1541. suhosin.request.max_vars=2048
  1542. suhosin.post.max_vars=2048
  1543. suhosin.request.max_array_index_length=256
  1544. suhosin.post.max_array_index_length=256
  1545. suhosin.request.max_totalname_length=8192
  1546. suhosin.post.max_totalname_length=8192" >> /usr/$library/php.ini
  1547.     else if [ $php5 = "php56" ]; then
  1548. echo "
  1549. extension="/usr/$library/extensions/no-debug-non-zts-20131226/suhosin.so"
  1550. suhosin.request.max_vars=2048
  1551. suhosin.post.max_vars=2048
  1552. suhosin.request.max_array_index_length=256
  1553. suhosin.post.max_array_index_length=256
  1554. suhosin.request.max_totalname_length=8192
  1555. suhosin.post.max_totalname_length=8192" >> /usr/$library/php.ini
  1556.     fi
  1557.     fi
  1558.     fi
  1559.  
  1560. if [ "d$imagick" = "d" ] || [ `expr "$imagick" : '[yY]'` -gt 0 ]; then
  1561.  
  1562. wget -O /tmp/pkgs/ImageMagick.tar.gz http://pkgs.otoinstall.com/ImageMagick.tar.gz
  1563. tar -C /tmp/pkgs -zxvf /tmp/pkgs/ImageMagick.tar.gz
  1564. cd /tmp/pkgs/ImageMagick-6.9.2-0
  1565. ./configure --prefix=/usr --libdir=/usr/$library
  1566. make
  1567. make install
  1568.  
  1569. wget -O /tmp/pkgs/imagick-3.3.0RC2.tgz http://pkgs.otoinstall.com/imagick-3.3.0RC2.tgz
  1570. tar -C /tmp/pkgs -zxvf /tmp/pkgs/imagick-3.3.0RC2.tgz
  1571. cd /tmp/pkgs/imagick-3.3.0RC2
  1572. phpize
  1573. ./configure --prefix=/usr --libdir=/usr/$library
  1574. make
  1575. make install
  1576.     if [ $php5 = "php54" ]; then
  1577. echo "
  1578. extension="/usr/$library/extensions/no-debug-non-zts-20100525/imagick.so"" >> /usr/$library/php.ini
  1579.     else if [ $php5 = "php55" ]; then
  1580. echo "
  1581. extension="/usr/$library/extensions/no-debug-non-zts-20121212/imagick.so"" >> /usr/$library/php.ini
  1582.     else if [ $php5 = "php56" ]; then
  1583. echo "
  1584. extension="/usr/$library/extensions/no-debug-non-zts-20131226/imagick.so"" >> /usr/$library/php.ini
  1585.     fi
  1586.     fi
  1587.     fi
  1588.    
  1589. fi
  1590.  
  1591. echo ""
  1592. echo "===========================PHP INSTALLATION COMPLETED========================="
  1593. echo ""
  1594.  
  1595. echo ""
  1596. echo "==============================CREATING WELCOME PAGE==========================="
  1597. echo ""
  1598. OUTFILE=/usr/share/nginx/html/index.html
  1599. (
  1600. echo "<html>"
  1601. echo "<head>"
  1602. echo "<title>NginX Auto Installer 2.0 - Powered By Otoinstall.com</title>"
  1603. echo "<style type=text/css media=screen>"
  1604. echo "td, tr {background: #FFFFFF;"
  1605. echo "font-size: 15px;"
  1606. echo "border: none;"
  1607. echo "}"
  1608. echo "td.head1 {background: #000000;"
  1609. echo "color: #FFFFFF;"
  1610. echo "}"
  1611. echo "td.head2 {font-weight: bold;"
  1612. echo "}"
  1613. echo "</style>"
  1614. echo "</head>"
  1615. echo "<body>"
  1616. echo "<center><h3>NginX Works!!!</h3></center>"
  1617. echo "<table width=500 border=0 align=center>"
  1618. echo "<tr>"
  1619. echo "<td class=head1 colspan=8><center><strong>SERVER HARDWARE</strong></center></td></tr>"
  1620. echo "<tr>"
  1621. echo "<td class=head2 width=130>&nbsp;CPU:</td><td>&nbsp;`cat /proc/cpuinfo | grep 'model name' | head -n 1 | awk {'print $4, $5, $6, $7, $8, $9'}`</td></tr>"
  1622. echo "<tr>"
  1623. echo "<td class=head2 width=130>&nbsp;Number of CPU(s):</td><td>&nbsp;`cat /proc/cpuinfo | grep -c processor`</td></tr>"
  1624. echo "</table>"
  1625. echo "<table width=500 border=0 align=center>"
  1626. echo "<tr>"
  1627. echo "<td class=head1 colspan=8><center><strong>SERVER SOFTWARE</strong></center></td></tr>"
  1628. echo "<tr>"
  1629. echo "<td class=head2 width=130>&nbsp;Operating System:</td><td>&nbsp;`cat /etc/redhat-release`</td></tr>"
  1630. echo "<tr>"
  1631. echo "<td class=head2 width=130>&nbsp;Kernel Version:</td><td>&nbsp;`uname -r`</td></tr>"
  1632. echo "<tr>"
  1633. echo "<td class=head2 width=130>&nbsp;NginX Version:</td><td>&nbsp;1.9.4</td></tr>"
  1634. echo "<tr>"
  1635. echo "<td class=head2 width=130>&nbsp;PHP Version:</td><td>&nbsp;`php -v | grep -v 'with' | grep -v 'Copyright' | awk {'print $2'}`</td></tr>"
  1636. echo "<tr>"
  1637. echo "<td class=head2 width=130>&nbsp;Zend Version:</td><td>&nbsp;`php -v | grep -v 'PHP' | grep -v 'with' | awk {'print $3'} | cut -c2-6`</td></tr>"
  1638. echo "<tr>"
  1639. echo "<td class=head2 width=130>&nbsp;MySQL Version:</td><td>&nbsp;`mysql -V | awk {'print $5'} | cut -c1-6`</td></tr>"
  1640. echo "<tr>"
  1641. echo "<td class=head2 width=130>&nbsp;PHPINFO:</td><td>&nbsp;<a href=../phpinfo.php>here</a></td></tr>"
  1642. echo "<tr>"
  1643. echo "<td class=head2 width=130>&nbsp;phpMyAdmin:</td><td>&nbsp;<a href=../$phpmyadmin>here</a></td></tr>"
  1644. echo "</table>"
  1645. echo "<center><p>If you feel this script is helpul, you can give a feedback by spreading or promoting to your friends or communities.</p>"
  1646. echo "<p>Created by <a href=http://otoinstall.com>NginX Auto Installer</a> &amp; <a href=http://www.vbfk.com>Junker</a></p></center>"<< EOF
  1647. EOF
  1648. ) > $OUTFILE
  1649.  
  1650. cat >/usr/share/nginx/html/phpinfo.php<<EOF
  1651. <?php phpinfo(); ?>
  1652. EOF
  1653.  
  1654. echo ""
  1655. echo "==============================INSTALLING PHPMYADMIN==========================="
  1656. echo ""
  1657.  
  1658. wget -O /tmp/pkgs/phpMyAdmin-4.4.14-all-languages.zip http://pkgs.otoinstall.com/phpMyAdmin-4.4.14-all-languages.zip
  1659. unzip -d /usr/share/nginx/html /tmp/pkgs/phpMyAdmin-4.4.14-all-languages.zip
  1660. cd /usr/share/nginx/html/phpMyAdmin-4.4.14-all-languages
  1661. sed -i -e 's@blowfi55@'$ppblow'@' config.inc.php
  1662. sed -i 's/localhost/127.0.0.1/g' config.inc.php
  1663. cd /usr/share/nginx/html
  1664. mv phpMyAdmin-4.4.14-all-languages $phpmyadmin
  1665.  
  1666. echo ""
  1667. echo "===============================INSTALLING PUREFTPD============================"
  1668. echo ""
  1669.  
  1670. if [ "d$pureftpd" = "d" ] || [ `expr "$pureftpd" : '[yY]'` -gt 0 ]; then
  1671.     wget -O /tmp/pkgs/pure-ftpd-1.0.42.tar.gz http://pkgs.otoinstall.com/pure-ftpd-1.0.42.tar.gz
  1672.     tar -C /tmp/pkgs -zxvf /tmp/pkgs/pure-ftpd-1.0.42.tar.gz
  1673.     cd /tmp/pkgs/pure-ftpd-1.0.42
  1674.     ./configure --prefix=/usr --libdir=/usr/$library
  1675.     make install-strip
  1676.     /usr/sbin/pure-ftpd &
  1677.     wget -O /etc/init.d/pureftpd http://txt.otoinstall.com/pureftpd
  1678.     chmod +x /etc/init.d/pureftpd
  1679.     chkconfig pureftpd on
  1680. fi
  1681.  
  1682. echo ""
  1683. echo "====================================CLEANING UP=============================="
  1684. echo ""
  1685.  
  1686. rm -rf /tmp/pkgs
  1687.  
  1688. echo ""
  1689. echo "===========================STARTING YOUR ROCK MACHINE!!!======================"
  1690. echo ""
  1691.  
  1692. service nginx start
  1693. service php-fpm start
  1694. service mysqld start
  1695.  
  1696. echo ""
  1697. echo "==============================INSTALLATION COMPLETED=========================="
  1698. echo ""
  1699.  
  1700. echo "You're suggested to reboot first before start using your box."
  1701. echo ""
  1702. echo "=============================================================================="
  1703. echo "              PLEASE SAVE THE FOLLOWING DATA FOR YOUR CREDENTIALS"
  1704. echo "=============================================================================="
  1705. echo "Post Installation:    http://$myhome"
  1706. echo ""
  1707. echo "FTP/SFTP Hostname:    $myhome"
  1708. echo "FTP/SFTP URI:         ftp://www@$myhome"
  1709. echo "FTP/SFTP User:        www"
  1710. echo "FTP/SFTP Pass:        $ftppwd"
  1711. echo "FTP/SFTP Directory:   /home/www"
  1712. echo ""
  1713. echo "MySQL Root Pass:      $mysqlrootpwd"
  1714. echo "phpMyAdmin URL:       https://$myhome/$phpmyadmin"
  1715. echo "phpMyAdmin User:      root"
  1716. echo "phpMyAdmin Pass:      $mysqlrootpwd"
  1717. echo "=============================================================================="
  1718. echo ""
  1719.  
  1720. else
  1721.  
  1722. echo "Operating system not supported. Please use CentOS/Debian/Ubuntu."
  1723.  
  1724. fi
Add Comment
Please, Sign In to add comment