Skip to content

Instantly share code, notes, and snippets.

@francorest
Last active August 29, 2015 13:58
Show Gist options
  • Save francorest/10033382 to your computer and use it in GitHub Desktop.
Save francorest/10033382 to your computer and use it in GitHub Desktop.
Setting Ubuntu 12.04 Production Environment from scratch for Ruby On Rails
# Ubuntu 12.04
# Goal: Setting up Production Environment for Ruby On Rails
# First Step: Create new user
# sudo useradd nameOfNewUser
# sudo passwd PASSWORD
# sudo adduser nameOfNewUser sudo
# su nameOfNewUser
# chsh (/bin/bash)
# sudo chown nameOfNewUser /home/nameOfNewUser
# sudo mkdir /usr/local/rvm
# sudo chmod a+xwr /usr/local/rvm
# Second Step: Fix Locales
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gem en_US.UTF-8
dpkg-reconfigure lolcales
# Third Step: Update and Install Requirements
sudo apt-get update
sudo apt-get install nginx postgresql git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libgdbm-dev libncurses5-dev automake libtool bison libffi-dev nodejs postgresql-common postgresql-9.3 libpq-dev
\curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
rvm requirements
# Forth Step: Install Ruby
rvm install 2.1.1
rvm use 2.1.1 --default
ruby -v
echo "gem: --no-ri --no-rdoc" > ~/.gemrc
# Fifth Step: Configure Git
git config --global color.ui true
git config --global user.name "Your Name"
git config --global user.email "mail@mail.com"
ssh-keygen -t rsa -C "mail@mail.com
cat ~/.ssh/id_rsa.pub
# Verify athentication
ssh -T git@github.com
# Sixth Step: Install Rails
gem install rails
rails -v
# Seventh Step: Install DB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment