Skip to content

Instantly share code, notes, and snippets.

@vincent178
Last active August 29, 2015 13:57
Show Gist options
  • Save vincent178/9679637 to your computer and use it in GitHub Desktop.
Save vincent178/9679637 to your computer and use it in GitHub Desktop.
Ubuntu Server Setup with Ruby Rails Nginx and Passenger

Create Account

Create Account for Application

$ useradd -m -s /bin/bash deploy

Add write permission to sudoers

$ adduser deploy sudo

Set the Password for User

$ passwd deploy

Then Exit and Login use deploy

Install RVM and Ruby

Update APT

$ sudo apt-get update

Install curl

$ sudo apt-get install curl

Install RVM

$ \curl -sSL https://get.rvm.io | bash

Exit and Relogin with deploy to initialize RVM

$ type rvm | head -1 

It should show rvm is a function

Install Ruby 1.9.3

$ rvm use --install --default 1.9.3
$ ruby -v

It should show ruby 1.9.3p545

Install Passenger

Follow the instruction in passenger

Step 1: Install our PGP key

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7

Step 2: Add HTTPS support for APT

sudo apt-get install apt-transport-https ca-certificates

Step 3: Add APT source

$ sudo echo "deb https://oss-binaries.phusionpassenger.com/apt/passenger precise main" > /etc/apt/sources.list.d/passenger.list
$ sudo apt-get update

Step 4: Install Phusion Passenger package

$ sudo apt-get install nginx-extras passenger

Database

Upload your files

Install git

$ sudo yum install git

Generate SSH keygen

$ ssh-keygen
$ cd ~/.ssh

Copy id_rsa.pub to the gitsum deploy

Create site folder

$ sudo mkdir -p /var/www/example.com
$ sudo chown deploy:deploy /var/www/example.com

Clone the project

$ cd /var/www/example.com
/var/www/example.com $ git clone https://github.com/YOURNAME/REPO.git .

Run Application

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment