Tuesday, May 21, 2013

Install Ruby On Rails, MySql, GitHub, Nginx with Passenger

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 press Ctrl-D if you are # using cat
  • cat >>~/.bash_profile
  • [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" 
  • Ctrl+D 

  • rvm install 1.9.3
  • rvm use 1.9.3
  • rvm 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 git
  • sudo apt-get install git-core
  • which git
  • /usr/bin/git
  • git --version
  • git 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 start
    We 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.
http://www.kosmetikstudio-hamburg.net http://www.howtoaddlikebutton.com

4 comments :

  1. If you are unable to install mysql gem then install fllowing dependancy.

    FOR : UBUNTU :
    sudo apt-get install libmysqlclient-dev

    http://stackoverflow.com/questions/3608287/error-installing-mysql2-failed-to-build-gem-native-extension

    ReplyDelete
  2. You can find here as well in future https://vishalzambre.github.io/tech/2017/03/19/install-ruby-on-rails-postgres-github-nginx.html

    ReplyDelete