Skip to content

Instantly share code, notes, and snippets.

@wwwbruno
Last active January 16, 2016 11:31
Show Gist options
  • Save wwwbruno/4a915d1f77fe8423e48d to your computer and use it in GitHub Desktop.
Save wwwbruno/4a915d1f77fe8423e48d to your computer and use it in GitHub Desktop.
Rails env instalation
# INSTALATION
# udpate system
sudo apt-get update
# Fish Shell
wget https://launchpad.net/~fish-shell/+archive/ubuntu/release-2/+files/fish_2.2.0-1~trusty_amd64.deb
sudo dpkg --install fish_2.2.0-1~trusty_amd64.deb
curl -L https://github.com/oh-my-fish/oh-my-fish/raw/master/bin/install | fish
omf install bobthefish
# install curl
sudo apt-get install curl
# install rvm (it will install ruby and rails already, but take too long)
\curl -sSL https://get.rvm.io | bash -s stable --rails --no-rdoc --no-ri
# install node js
sudo apt-get install nodejs
# create alias for the node command
sudo ln -s /usr/bin/nodejs /usr/bin/node
# install npm
sudo apt-get install npm
# install imagemagick
sudo apt-get install imagemagick -y
# install postgres
sudo apt-get install postgresql postgresql-contrib libpq-dev -y
sudo -u postgres psql
CREATE ROLE vagrant LOGIN;
ALTER USER vagrant CREATEDB;
# install nginx with passenger
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7
# create this file:
sudo vim /etc/apt/sources.list.d/passenger.list
# and add this line
# deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main
sudo chown root: /etc/apt/sources.list.d/passenger.list
sudo chmod 600 /etc/apt/sources.list.d/passenger.list
# update the system
sudo apt-get update
# than finally install the passenger
sudo apt-get install nginx-extras passenger
# uncomment this two lines in the file:
sudo vim /etc/nginx/nginx.conf
# passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
# passenger_ruby /usr/bin/ruby;
# comment these two lines in the file:
sudo vim /etc/nginx/sites-available/default
# listen 80 default_server;
# listen [::]:80 default_server ipv6only=on;
# create a nginx configuration file
sudo vim /etc/nginx/sites-available/myapp
# insert this lines and replace 'www.mydomain.com' and '/home/rails/testapp/public' with your app settings
server {
listen 80 default_server;
server_name www.mydomain.com;
passenger_enabled on;
passenger_app_env development;
root /home/rails/testapp/public;
}
# enable the new config file
sudo ln -s /etc/nginx/sites-available/myapp /etc/nginx/sites-enabled/myapp
# and restart the server
sudo nginx -s reload
# References
# https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-passenger-and-nginx-on-ubuntu-14-04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment