Last active
April 27, 2016 15:23
-
-
Save psgganesh/615548de47d324a56ada to your computer and use it in GitHub Desktop.
Lumen installer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Name: lumen.sh | |
# Description: Automated setup of LEMP stack with Lumen framework | |
# Author: Shankar <[email protected]> | |
# Twitter handle: @psgganesh | |
# USAGE | |
# CURL or WGET the RAW URL of this file and run below two commands | |
# 1. chmod +x lumen.sh | |
# 2. sudo bash ./lumen.sh | |
# Check your browser with the IP address of the host machine and viola, you have lumen installed | |
# Globals | |
php_config_file="/etc/php5/fpm/php.ini" | |
# Init | |
apt-get update | |
apt-get -y install sudo | |
apt-get -y install nano | |
# Step one, nginx | |
sudo apt-get -y install nginx | |
sudo service nginx restart | |
clear | |
echo "Please check http://localhost OR server_domain_name OR IP, you should get a nginx page" | |
sleep 10s | |
# Step two, php and it's dependencies, curl and git | |
sudo apt-get -y install php5-fpm php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-sqlite php5-tidy php5-xmlrpc php5-cli curl git | |
clear | |
sudo php5enmod mcrypt | |
sudo apt-get -y install imagemagick | |
sudo apt-get -y install php5-imagick | |
sudo php5enmod imagick | |
echo "Php and it's dependencies are installed !" | |
sleep 5s | |
# Step three, mysql and it's dependencies | |
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root' | |
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root' | |
sudo apt-get -y install mysql-server | |
# Create DB | |
echo "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION" | mysql -u root -proot | |
echo "GRANT PROXY ON ''@'' TO 'root'@'%' WITH GRANT OPTION" | mysql -u root -proot | |
mysql -u root -e "CREATE DATABASE IF NOT EXISTS localdb" -proot | |
mysql -u root -e "GRANT ALL PRIVILEGES ON localdb.* TO 'root'@'localhost' IDENTIFIED BY 'root'" -proot | |
mysql -u root -e "FLUSH PRIVILEGES" -proot | |
sleep 15s | |
clear | |
echo "mySQL and it's dependencies are installed !" | |
sleep 5s | |
# php.ini config change | |
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g" ${php_config_file} | |
sudo service php5-fpm restart | |
# Get composer globally installed | |
curl -sS https://getcomposer.org/installer | php | |
mv composer.phar /usr/local/bin/composer | |
# Get Lumen | |
cd /var/www | |
rm-rf * | |
rm-rf .* | |
composer create-project laravel/lumen lumen --prefer-dist | |
# Reset base nginx web root | |
cd /etc/nginx/sites-enabled/default | |
sudo rm-rf .* | |
sudo rm-rf * | |
sudo rm -rf /etc/nginx/sites-enabled/default | |
sudo rm -rf /etc/nginx/sites-available/default | |
cd /etc/nginx/sites-available/ | |
git clone https://gist.github.com/8d1790dd0c16ab5a4cde.git . | |
sudo ln -s /etc/nginx/sites-available/default.conf /etc/nginx/sites-enabled/default.conf | |
# Install sqlite | |
sudo apt-get install php5-sqlite | |
# Setup SSL | |
sudo mkdir /etc/nginx/ssl | |
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.crt | |
# Restart services | |
sudo service php5-fpm restart | |
sudo service nginx restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Edited local database name created during installation