Skip to content

Instantly share code, notes, and snippets.

@majimboo
Last active September 4, 2020 15:45
Show Gist options
  • Save majimboo/9947090 to your computer and use it in GitHub Desktop.
Save majimboo/9947090 to your computer and use it in GitHub Desktop.
CentOS 6.5 LEMP (Linux, Nginx, MySQL, PHP5) Stack Install Script with Composer and NodeJS
#!/bin/bash
# Install script for LEMP Web Server on CENTOS 6.5 by Majid Arif Siddiqui
# Init
echo "Initializing..."
sudo yum -y update
sudo yum -y groupinstall "Development Tools"
sudo yum -y install screen
# Install the Required Repositories
echo "Installing the Required Repositories..."
sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
# Install MySQL (not used)
echo "Installing MySQL..."
sudo yum install -y mysql mysql-server
# Install Nginx
echo "Installing Nginx..."
sudo yum install -y nginx
# Install PHP
echo "Installing PHP..."
sudo yum --enablerepo=remi install -y php-fpm php-mysql php-cli php-mcrypt
# Install Composer
echo "Installing Composer globally..."
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/bin/composer
# Install git
echo "Installing git version management"
sudo yum install -y git
# Install NodeJS
echo "Installing Nodejs..."
cd /usr/src
wget http://nodejs.org/dist/v0.10.26/node-v0.10.26.tar.gz
tar zxf node-v0.10.26.tar.gz
cd node-v0.10.26
./configure
make
make install
cd ~/
# Restarting Services
echo "Restarting Services..."
# sudo service mysqld restart
sudo service php-fpm restart
sudo service nginx restart
# Set Up Autostart
echo "Setting Autostart..."
# sudo chkconfig --levels 235 mysqld on
sudo chkconfig --levels 235 nginx on
sudo chkconfig --levels 235 php-fpm on
# Configure PHP
echo "Configuring PHP..."
sudo sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php.ini
sudo sed -i 's/user = apache/user = nginx/g' /etc/php-fpm.d/www.conf
sudo sed -i 's/group = apache/group = nginx/g' /etc/php-fpm.d/www.conf
# Configure Nginx for PHP
echo "Configuring Nginx for PHP..."
sudo sed -i 's/index index.html index.htm;/index index.php index.html index.htm;/g' /etc/nginx/conf.d/default.conf
# Done
echo "Done done suy!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment