Skip to content

Instantly share code, notes, and snippets.

@RohitRox
Last active December 18, 2015 05:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RohitRox/5734383 to your computer and use it in GitHub Desktop.
Save RohitRox/5734383 to your computer and use it in GitHub Desktop.
setting ruby on rails development environment in linux

Step 1: Setting up RVM

    $ sudo apt-get update
    $ sudo apt-get install curl
    $ curl -L https://get.rvm.io | bash -s stable
    $ source ~/.rvm/scripts/rvm 

In order to work, RVM has some of its own dependancies that need to be installed. You can see what these are:

    $ rvm requirements
    # In the text that RVM shows you, look for this paragraph.
    # Additional Dependencies:
    # For ruby:
    # apt-get --no-install-recommends install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev  libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev
    # Just follow the instructions to get your system up to date with all of the required dependancies.
    $ sudo apt-get --no-install-recommends install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev

Then

    $ echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" >> ~/.bash_profile
    # or 
    $ echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" >> ~/.bashrc

Step 2: Install ruby

    $ rvm install 1.9.3
    # after success you can verify your installation by 
    $ rvm list
    # should output something like 
    # rvm rubies
    # =* ruby-1.9.3-p362 [ i686 ]

Step 3: RubyGems

    $ rvm rubygems current

Step 4: Rails

    # a Javascript runtime, NodeJs
    $ sudo add-apt-repository ppa:chris-lea/node.js
    $ sudo apt-get update
    $ sudo apt-get install nodejs
    
    $ gem install bundler
    $ gem install rails

Step 5: First Rails app

    $ rails new my_app
    $ cd my_app
    $ bundle install
    $ rails s
    # open browser and visit localhost:3000
    # you should see the famous welcome abroad page

Step 6: Development Extras

Sublime Text 2

    $ sudo add-apt-repository ppa:webupd8team/sublime-text-2
    $ sudo apt-get update
    $ sudo apt-get install sublime-text

Install sublime package manager from here for other sublime goodies.

Configure Vim for Rails

    $ curl -Lo- https://bit.ly/janus-bootstrap | bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment