step 1. Install dependencies
Install git : Git is the most popular (as well as fast and efficient; Linux kernel uses it; developed by Linux Torwalds, the same guy who developed Linux kernel) open source version control system. You can install it in one simple command to install it from the official package repository -
[You could also install git from the source (Download the source code, extract it and execute make && sudo make install) ]
Install Curl : Curl is a command line tool to get a file from FTP/HTTP/HTTPS server. To install, open terminal and execute the command -
step 2. Install RVM (Ruby Version Manager)
Open terminal and execute the command (I assume you’ve already completed the step 1, otherwise first do that) -
Now, you might have to edit the bashrc file to load RVM in shell session. To do that type -
and add the following line to the end (and save the file)
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
Then reload the shell session using the command -
Now you can test whether the RVM has been installed successfully or not. Open terminal and execute the command -
After executing above command you should be getting this output -
rvm is a function
That’s All.. You’ve successfully installed the RVM. Next, you are supposed to install few additional dependencies. To find out those programs type -
After executing the above command, install the additional packages recommended by RVM -
step 3. Install Ruby
Now, it’s time to install the ruby version you want (you’re recommended to use either 1.8.7 or 1.9.2). The generic syntax is rvm use version_name. It will also install the associated packages such as RubyGems and Bundler.
Then select the version, you want to use -
If you aren’t sure about the ruby version currently being used, then type -
step 4. install Rails
Finally, you can install the rails gem using a simple command -
That’s All.
Now, create a sample application (just for testing) using Ruby on Rails.
Then open your browser and type the following address (to see the application running) -
http://localhost:3000
转自:http://blog.sudobits.com/2011/10/27/how-to-install-ruby-on-rails-in-ubuntu-11-10/