Topic: HOWTO: Install Ruby on Rails on Ubuntu Linux
This tutorial will show you how to install Ruby on Rails on a base install of Ubuntu Linux. This tutorial should also work for any similar Linux distributions, such as Kubuntu, Xubuntu, or any Debian-based distribution.
We'll start with a base install ("server" install in Ubuntu), but you can do a graphical install as well if you don't want a command line only when you log in
.
So let's get started!
NOTE: anything marked in these:
code blocks
Are to be run in a terminal/command prompt window, unless otherwise noted.
1. Log in and open a terminal if you need to. First we'll install Ruby 1.8 and Ruby's development libraries. We'll also install IRB, which is quite useful while trying Ruby programming.
sudo apt-get install ruby ruby1.8-dev irb
You will be prompted for your password so be sure to get it right!
2. Now that Ruby's installed, let's install SQLite 3. SQLite is a lightweight, file-based database that's good for development. Feel free to use another database here if you'd like, such as MySQL or PostgreSQL.
sudo apt-get install sqlite3
3. Now let's start installing Rails. First you'll need RubyGems. Download it this way:
wget http://rubyforge.org/frs/download.php/5 0.8.11.tgz
4. Now unpack the RubyGems package:
tar -zxvf rubygems-0.8.11.tgz
5. Now go into the directory created from unpacking, and run the setup program:
cd rubygems-0.8.11
sudo ruby setup.rb
6. Now we have RubyGems installed, so we can install Rails and friends.
sudo gem install rails --include-dependencies
This will install the latest version of Rails (1.1.4 as of this writing).
7.OPTIONAL: Install Mongrel, the fast server for Rails:
sudo apt-get install build-essential
sudo gem install mongrel --include-dependencies
8. Create a test Rails app somewhere
rails my_test_app
9.Run your newly created Rails app to see if everything is working:
If you installed Mongrel, do this:
cd my_test_app
mongrel_rails start -d
If you didn't install Mongrel, do this:
cd my_test_app
ruby script/server
10. Go to http://localhost:3000 in your browser. Congratulations, you're on Rails!
NOTE FOR MONGREL USERS: Edge Rails (the version of Ruby on Rails that is under active development) now has support for running Mongrel through script/server if you have it installed. All you will have to run then is
ruby script/server
The script will start Mongrel instead of WEBrick if found.
Good luck with your install, and post any questions you may have here.