Install
Ruby On Rails, MySql, GitHub, Nginx with Passenger
sudo apt-get install zlib1g zlib1g-dbg zlib1g-dev sqlite3 libsqlite3-dev build-essential openssl libreadline6 libreadline6-dev curl git-core libssl-dev libyaml-dev libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion g++ openjdk-6-jdk git nodejs
curl -L https://get.rvm.io | bash -s stable --ruby
# edit .bash_profile file and add following file then pressCtrl-Dif you are # using catcat >>~/.bash_profile[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"Ctrl+Drvm install 1.9.3rvm use 1.9.3rvm rubygems latest- sudo gem install rails '3.2.9'
- sudo apt-get install mysql-client-5.5 mysql-server-5.5
- sudo apt-get -y install postgresql libpq-dev
- sudo service mysql stop
- sudo service mysql start
MySql
Gems
- sudo gem install mysql2
- sudo gem install therubyracer
-
Installation
of Git
- sudo apt-get install git
- sudo apt-get update
which gitsudo apt-get install git-corewhich git/usr/bin/gitgit --versiongit version 1.7.0.4
Git Configuration
- sudo nano ~/.gitconfig
- git config --global user.name "NewUser"
- git config --global user.email newuser@example.com
- git config –list
Installation of Nginx
Update and install our
dependencies
- sudo apt-get -y update
- sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-dev libyaml-dev libcurl4-openssl-dev curl git-core python-software-properties
- gem install passenger
- rvmsudo passenger-install-nginx-module
# Choose "download, compile, and install Nginx for me"
# Accept defaults for any other
questions it asks you
Next we want to setup a script to allow us to control Nginx
- wget -O init-deb.sh http://library.linode.com/assets/660-init-deb.sh
- sudo mv init-deb.sh /etc/init.d/nginx
- sudo chmod +x /etc/init.d/nginx
- sudo /usr/sbin/update-rc.d -f nginx defaults
You can now control Nginx with this script. To start and stop the server manually, you run:
- sudo /etc/init.d/nginx stop
- sudo /etc/init.d/nginx startWe can verify nginx is running by opening up Firefox and going to http://localhost
Node.js
for the Rails asset pipeline
- sudo apt-add-repository ppa:chris-lea/node.js
- sudo apt-get -y update
- sudo apt-get -y install nodejs
Configure Your Rails App
you
can modify your
/opt/nginx/conf/nginx.conf
server
{
listen 80;
server_name
example.com;
root
/home/deploy/myapplication/public; # <--- be sure to
point to 'public'!
passenger_enabled
on;
}
Just
change the application folder name and the server name and then
restart the nginx service.