Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am interested in setting up a Ruby on Rails environment on my 10.10 laptop.

Is there anything special I need to keep in mind for installation (i.e. that could be new or unique to 10.10)?

Are there any suggested walkthroughs that I could follow along with?

Thanks in advance.

share|improve this question
add comment

7 Answers 7

up vote 12 down vote accepted

There are many ways of install ruby.

  1. RVM. This is the 'traditional' way that is used by many rubyists.

  2. rbenv.

  3. From packages.

  4. From source (answer coming).

share|improve this answer
add comment

This question has an answer which leads to a much more interesting "how-to" article "Ubuntu, Ruby, RVM, Rails, and You" guiding us through a fresh install of Ruby (and related things), starting from rvm. It adds insights and provides a lot of remarks for beginners -- because Ruby is truly something awful to get setup when one is without all that background knowledge and support.

The article was last updated on October 11th, 2012 and should install Ruby 1.9.3, RVM and Rails 3.2.8.

I'm posting this answer for the sake of linking the related questions.

share|improve this answer
add comment

From packages.

Install the following packages.

ruby1.9.1-full Install ruby1.9.1-full, ruby1.9.1-dev Install ruby1.9.1-dev, libpq-dev Install libpq-dev (only libpq-dev if you're doing ruby on rails development as well.)

share|improve this answer
add comment

What follows are instructions for installing Ruby on Rails(RoR) using rvm. Currently this will install ruby versions 1.9.3 and 2.0.0 with rails version 4.0.0.

Installing the latest version of RVM, Ruby and Rails (outside of the normal repositories)

  1. Removing all currently existing ruby and rvm packages and installations.

    Note: Apparently, Ubuntu has a broken version of rvm available in the repositories(No, I don't have a link to the specific issues at hand and have been unable to identify a bug in Launchpad in reference to this. There are various flame-wars regarding not using the standard repositories that I won't go into here;-)).

    When one tries to run it to install an updated version of ruby through an existing rvm installation, you will be presented with a message that redirects you to a fix located on Stack Overflow.

    I quote the solution here for completeness:

    Here, you will need to remove any existing ruby or rvm packages along with their configuration files. Run the following commands from the terminal (Ctrl-Alt-t):

    sudo apt-get --purge remove ruby-rvm
    sudo rm -rf /usr/share/ruby-rvm /etc/rvmrc /etc/profile.d/rvm.sh
    

    Open new terminal and validate environment is clean from old RVM settings (should be no output):

    env | grep rvm
    

    if there was output, try to open new terminal, if it does not help then restart your computer.

  2. Install the new(latest) ruby and rvm binaries with the following command:

    \curl -L https://get.rvm.io | 
      bash -s stable --ruby --autolibs=enable --auto-dotfiles
    

    During the installation download there will be some changes made to your ~/.bash_profile and other configuration files. Please note that there are also several important instructions that appear on the screen.

    It is important for you to follow them in order for your installation to be successful. At this point, you may be prompted for your sudo/root password in order to satisfy any missing dependencies. Enter it and select [Y} at the appropriate prompt.

    Note:These files are being downloaded from the stable branch on GitHub here.

    RVM will be install to /home/username/.rvm/

    Adding rvm PATH line to /home/username/.bashrc /home/username/.zshrc.

    Adding rvm loading line to /home/username/.bash_profile /home/username/.zprofile.

  3. Source your rvm file to have the new changes take effect. Run the command:

    source /home/username/.rvm/scripts/rvm

  4. Verify that you are running the latest version of ruby:

    $ruby --version
        ruby 2.0.0p247 (2013-06-27 revision 41674) [i686-linux]
    
  5. If you prefer to run ruby 1.9.3 you will need to do the following:

    rvm install 1.9.3
    rvm use 1.9.3 --default
    
  6. Install RubyGems

    rvm rubygems current
    
  7. Install rails

    gem install rails
    

Sources:

share|improve this answer
add comment

June 2012

I've been using this fantasic one-liner for rails 3.2 w/ruby 1.9.3, RVM, etc,

wget --no-check-certificate https://raw.github.com/joshfng/railsready/master/railsready.sh && bash railsready.sh
share|improve this answer
add comment

rvm.

rvm has a really nice installer.

First, install curl Install curl.

Then you need to install the dependencies:

sudo apt-get 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 ncurses-dev automake libtool bison subversion libpq-dev

Now, you can use the automated installer:

curl -L https://get.rvm.io | bash -s stable --ruby

After that, log out and then log back in, and you're all set!

ruby -v should return something like:

ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

If it doesn't, then you should look at the troubleshooting page for RVM.

share|improve this answer
add comment

rbenv + ruby-build.

First, install some dependencies:

sudo apt-get build-dep ruby1.9.1-full
sudo apt-get install curl git

Then, install it:

git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc

Now, to install Ruby Build:

git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
rbenv install 2.0.0-p247
rbenv global 2.0.0-p247
gem install bundler
rbenv rehash

All done!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.