In this tutorial you will install Ruby, RubyGems, and Rails on Debian/Ubuntu.
$ sudo apt-get install ruby-full build-essential
Prerequisite packages:
$ sudo apt-get install build-essential libssl-dev libreadline5-dev zlib1g-dev checkinstall
Download ruby sources:
$ wget ftp://ftp.ruby-lang.org/pub/ruby/stable-snapshot.tar.gz
then
$ tar xvzf stable-snapshot.tar.gz
Compiling and installing
$ cd ruby/ $ ./configure $ make $ sudo checkinstall
Test installation
$ ruby -v
show something like:
ruby 1.8.7p5000 (2009-02-22) [i686-linux]
Test libraries
$ ruby -ropenssl -rzlib -rreadline -e "puts :Hello"
Will show:
Hello
Note: to manage this type of installation you can use aptitude or apt-get.
Download the latest version of RubyGems at the Rubyforge RubyGems page.
Rails 2.2.2 requires v1.3.1 or higher.
$ cd ~ $ wget http://rubyforge.org/frs/download.php/57643/rubygems-1.3.4.tgz $ tar xzvf rubygems-1.3.4.tgz $ cd rubygems-1.3.4 $ sudo ruby setup.rb $ sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
Note: It is possible to install RubyGems using apt-get. However, this is not recommended although you can still do it:
$ sudo apt-get install rubygems $ sudo gem install rubygems-update --version=1.3.4 $ sudo gem install rails $ rails --version Rails 2.3.5
Once RubyGems is installed, use it to install Rails:
$ sudo gem install rails
By default, Rails includes the sqlite3 gem and is automatically configured to use it. To use MySQL instead, follow the following steps:
$ sudo apt-get install mysql-server mysql-client $ sudo apt-get install libmysql-ruby libmysqlclient-dev $ sudo gem install mysql
Rails assumes that the MySQL socket file will be found in /tmp/mysqld.sock. In Debian/Ubuntu, this is not the case. Be sure to change database.yml to reflect the actual location of the socket file:
socket: '/var/run/mysqld/mysqld.sock'
To test your Rails installation, generate a new Rails project:
$ rails myrailsapp
If you are using MySQL, use the following command:
$ rails myrailsapp -d mysql
Many popular web server configurations are available for Linux. Please see:
Discussion
Odd. I commented on this and now it's gone. Another comment was on here and it's gone as well.
Just there is an easier way of starting your Ruby life. Tested on Jaunty. http://tinyurl.com/ruby-on-rails-tutorial
Rails 2.3 provides new possibilities. Templates mean faster project initiation. And latest developments of Ubuntu and Rails mean lesser installation.
This tutorial is fully tested on Ubuntu Jaunty: Rais101 Tutorial Ruby on Rails with Relations http://conceptspace.wikidot.com/blog:19
Ubuntu 9.04 Rails 2.3.2
I strongly recommend to read this howto if you have Debian etch - http://www.offix.ch/Howto-Install-Rails-On-Debian-Etch . The information on the current page didn't work well on etch to me.