#!/bin/sh # Script for automatically install Nginx + PHP(php-fpm) + MySql + phpMyAdmin # Installation Requirement: # CentOS 5.x 32 bit and 64 bit / CentOS 6.x 32 bit and 64 bit # Guarantee Memory >= 128MB, Free Disk space >=2GB ########## Prepare repo for YUM ########## arch=`uname -m` OS_MAJOR_VERSION=`sed -rn 's/.*([0-9])\.[0-9].*/\1/p' /etc/redhat-release` OS_MINOR_VERSION=`sed -rn 's/.*[0-9].([0-9]).*/\1/p' /etc/redhat-release` if [ "$arch" = "x86_64" ]; then if [ "$OS_MAJOR_VERSION" = 5 ]; then rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm; rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm; else rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm; rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm; fi else if [ "$OS_MAJOR_VERSION" = 5 ]; then rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm; rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm; else rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm; rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm; fi fi cat > /etc/yum.repos.d/nginx.repo< /dev/null; rm -f phpMyAdmin*.gz; mv phpMyAdmin-*-all-languages phpMyAdmin4U; echo myweb:"${pass2}" | chpasswd; chown -R myweb:myweb /www; chmod +x /www; chmod +x -R /www/ip.com; ########## Display information after installation ########## clear echo -e "\n\n\n"; echo "====== Nginx + PHP-FPM + MYSQL Successfully installed"; echo "====== MySql root password is ${pass2}"; echo "====== SFTP Username is myweb"; echo "====== SFTP Password is ${pass2}"; echo "====== Website document root is /www/yourdomain"; echo "====== Add websites tutorials: http://goo.gl/sdDF9"; echo -e "\n\n\n"; echo "====== Now you can visit http://your-ip-address/ "; echo "====== Eg. http://`hostname -i`/"; echo "====== phpMyAdmin: http://`hostname -i`/phpMyAdmin4U/"; echo -e "\n\n\n"; echo "====== More tutorials: http://goo.gl/tNFb0"; echo -e "\n\n\n\n"; ########## Fast install command line ########## # What's you need to do is: Copy and post/run below single command line via SSH root login. Wait 5-15 minutes(depending on the software download speed from your server), Everything is Done! # wget --no-check-certificate -O /tmp/install-nginx-php-mysql.sh https://raw.github.com/ComfortVPS/Nginx-PHP-MySql-phpMyAdmin/master/install-nginx-php-mysql.sh; sh /tmp/install-nginx-php-mysql.sh;