-
-
Save eduramirezh/10275716 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 vim ruby-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 Passenger | |
gem install passenger | |
rvmsudo passenger-install-nginx-module | |
# Eighth step: Set directories and nginx config file | |
sudo mkdir /var/www | |
sudo chmod a+xwr /var/www | |
cd /var/www | |
#git clone your repo | |
cd yourrepo | |
bundle install | |
# Ninth step: Edit nginx conf file | |
#Add this in /opt/nginx/conf/nginx.conf | |
#server { | |
#... | |
#listen 80; | |
#server_name example.com; | |
#passenger_enabled on; | |
#root /var/www/livetrust/public; | |
#... | |
#} | |
sudo vim /etc/init.d/nginx | |
#change these two lines | |
#PATH=/opt/nginx/sbin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
#DAEMON=/opt/nginx/sbin/nginx | |
sudo service nginx start | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment