Skip to content

Instantly share code, notes, and snippets.

@AjeetK
Created January 20, 2018 13:17
Show Gist options
  • Save AjeetK/5a3faa8de504a983934effd3546e5471 to your computer and use it in GitHub Desktop.
Save AjeetK/5a3faa8de504a983934effd3546e5471 to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "Updates packages"
sudo apt-get update -y
echo "Installing packages"
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev nodejs -y
echo "Installs RVM (Ruby Version Manager) for handling Ruby installation"
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
echo "Installing Ruby"
rvm install 2.3.1
ruby -v
echo "gem: --no-ri --no-rdoc" > ~/.gemrc
gem install bundler
echo "Installing Rails"
gem install rails -v 4.2.4
rails -v
echo "Installing passenger app server"
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
sudo apt-get install -y apt-transport-https ca-certificates
# Add Passenger APT repository
sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger xenial main > /etc/apt/sources.list.d/passenger.list'
sudo apt-get update
echo "Installing passenger app server"
sudo nano /etc/apt/sources.list.d/passenger.list
# comment out
# deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main
# ctrl+x
# Y
# enter
sudo apt-get update
sudo apt-get install nginx nginx-extras
# sudo nano /etc/apt/sources.list.d/passenger.list
# insert
# deb https://oss-binaries.phusionpassenger.com/apt/passenger wheezy main
#
# ctrl+x
# Y
# enter
sudo apt-get update
sudo apt-get install passenger
# sudo apt-get install -y nginx-extras passenger
echo "Installing Mysql"
sudo apt-get install mysql-client libmysqlclient-dev
# Configuring passenger and ruby
sudo sed -i '/Phusion Passenger/a passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;' /etc/nginx/nginx.conf
sudo sed -i '/passenger_root/a passenger_ruby /home/ubuntu/.rvm/gems/ruby-1.9.3-p551/wrappers/ruby;' /etc/nginx/nginx.conf
# sudo sh -c 'echo passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini > /etc/nginx/nginx.conf'
# sudo sh -c 'echo passenger_ruby /home/ubuntu/.rvm/gems/ruby-1.9.3-p551/wrappers/ruby > /etc/nginx/nginx.conf'
echo "******* All packages installed successfully *********"
echo "Configure the nginx and passenger by reading the below lines."
echo "open the nginx configuration file by typing the command :"
echo "sudo nano /etc/nginx/nginx.conf"
echo "find the below two lines and uncomment them if it is commented."
echo "passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment