Skip to content

Instantly share code, notes, and snippets.

@mishrarohit
Last active December 22, 2015 04:09
Show Gist options
  • Save mishrarohit/6415537 to your computer and use it in GitHub Desktop.
Save mishrarohit/6415537 to your computer and use it in GitHub Desktop.
Install Rails on Ubuntu 12.04 with Nginx, Unicorn and Mysql.
# These instructions are based on Ryan Bates' deploying to VPS Railscasts -- http://railscasts.com/episodes/335-deploying-to-a-vps
$ ssh root@178.xxx.xxx.xxx
root@li349-144:~# apt-get update
root@li349-144:~# apt-get -y install curl git-core python-software-properties
root@li349-144:~# add-apt-repository ppa:nginx/stable
root@li349-144:~# apt-get update
root@li349-144:~# apt-get -y install nginx
root@li349-144:~# service nginx start
# Check nginx default page to be visible on domain
# Install mysql
sudo apt-get install mysql-server
mysql -u root -p
mysql> create database abcdb;
mysql> grant usage on *.* to abc@localhost identified by ‘abcpasswd’;
mysql> grant all privileges on abcdb.* to abc@localhost ;
# Check mysql
mysql -u shopify_aramex -p 'shopifyaramex' shopify_aramex_production
# Add deployer user
sudo adduser deployer
adduser <username> sudo
# Install node
root@li349-144:~# add-apt-repository ppa:chris-lea/node.js
root@li349-144:~# apt-get update
root@li349-144:~# apt-get -y install nodejs
su deployer
deployer@li349-144:~$ curl -L https://raw.github.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash
curl -L https://raw.github.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash
# Add this to .bashrc
export RBENV_ROOT="${HOME}/.rbenv"
if [ -d "${RBENV_ROOT}" ]; then
export PATH="${RBENV_ROOT}/bin:${PATH}"
eval "$(rbenv init -)"
fi
# before these 2 lines
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
deployer@li349-144:~$ . ~/.bashrc
rbenv bootstrap-ubuntu-12-04
rbenv install 2.0.0-p0
gem install bundler --no-ri --no-rdoc
rbenv rehash
sudo apt-get install libmysqlclient-dev
# On client in the app folder
cap deploy:setup
cap deploy:cold
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment