Guest User

NGINX Autoinstaller

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