The official Ruby on Rails documentation has a good guide on how to install Ruby on Rails. I still had some problems setting everything up, so here I will describe how I installed Ruby on Rails on Linux (LMDE).
Installing Ruby on Linux
Before installing Ruby on Rails we need to install Ruby as well as Ruby Gems and sqlite:
sudo apt-get install ruby rubygems sqlite3
Installing Ruby on Rails on Linux
sudo gem install rails -V
-V because otherwise you will get no direct feedback. Downloading and installing Ruby on Rails takes a lot of time, so without verbose output it looks like the install of ruby on rails stopped.
If the installation hangs at this step:
Installing RDoc documentation for rails-4.1.0...
rdoc --op /var/lib/gems/1.9.1/doc/rails-4.1.0/rdoc lib --title rails-4.1.0 Documentation --quiet
Try to install Ruby on Rails without documentation:
sudo gem install rails -V --no-ri --no-rdoc
Installing Ruby on Rails on LMDE (Linux Mint Debian Edition)
On LMDE, the above steps did not work for me, I got the following error message:
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'
This could be fixed by installing the following package before installing Ruby on Rails:
sudo apt-get install ruby-dev
Installing additional dependencies for Ruby on Rails
The Ruby on Rails server does not work without a Javascript Runtime (You would get the following error when starting the server: Could not find a JavaScript runtime.). You can install execjs with this command:
sudo gem install execjs
execjs depends on nodejs, so go ahead and install that as well:
sudo apt-get install nodejs
Creating a new Rails Project and starting the Server
Now you can go ahead and check if everything works:
rails new TestProject
cd TestProject
rails server
If you now visit http://localhost:3000/ you should see a page displaying: Welcome aboard You’re riding Ruby on Rails!