Howto install rails 2.3 and ruby 1.9 on ubuntu for mysql and sqlite3
Prerequisite
As a prerequisite you will need to install the following packages,these packages are build tools and libraries you will need for compilation process.
sudo apt-get -y install libc6-dev libssl-dev libmysql++-dev libsqlite3-dev make build-essential libssl-dev libreadline5-dev zlib1g-dev
Installing Ruby 1.9.1
cd ~ mkdir src cd src/ wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p0.tar.gz tar xzvf ruby-1.9.1-p0.tar.gz cd ruby-1.9.1-p0/ wget http://redmine.ruby-lang.org/attachments/download/237 patch -p1 < 237 ./configure --prefix=/usr/local --with-openssl-dir=/usr --with-readline-dir=/usr --with-zlib-dir=/usr sudo make && sudo make install
To make sure form your ruby version use the following command line.
ruby -vThe output should be something like this
ruby 1.9.1p0 (2009-01-30 revision 21907) [i686-linux]
If this command only returns “Happy new Ruby” please feel comfortable, your instllation is going fine.
ruby -ropenssl -rzlib -rreadline -e "puts 'Happy new Ruby'"
Ruby 1.9 bundles rubygems so there is no need to install it.
Installing mysql-ruby adaptor
cd ~/src wget http://rubyforge.org/frs/download.php/51087/mysql-ruby-2.8.1.tar.gz tar xzvf mysql-ruby-2.8.1.tar.gz cd mysql-ruby-2.8.1 sudo ruby extconf.rb make sudo make install
Installing rails and other stuff
sudo gem install rails rake rack sqlite3-ruby
To make sure that all packages are successfully installed use the following command line
gem list
The output should be something like this
actionmailer (2.3.2) actionpack (2.3.2) activerecord (2.3.2) activeresource (2.3.2) activesupport (2.3.2) rack (0.9.1) rails (2.3.2) rake (0.8.4) sqlite3-ruby (1.2.4)
Now you can create and run a new rails application working on ruby 1.9 “.
For mysql database
rails yourapp --database=mysqlFor sqlite3
rails yourapp

rubyonrails 2.3
With best wishes for fast performance.






































April 20th, 2009 at 3:29 pm
rails give mysql error after the installation completes
April 22nd, 2009 at 3:54 am
What exactly is the error message? Maybe I can help you.
April 22nd, 2009 at 11:09 am
Status: 500 Internal Server Error
no such file to load — mysql
April 22nd, 2009 at 11:12 am
The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
April 22nd, 2009 at 11:12 am
I dont even have rails 2.2 installed
April 22nd, 2009 at 11:13 am
I will use sqlite for now until that error is resolved.
April 23rd, 2009 at 8:41 pm
This was helpful. Thanks!
April 24th, 2009 at 7:07 am
It all install fine but have mysql problem. When i try to migrate i get: Packets out of order: 0 error message?
April 24th, 2009 at 8:05 am
It sounds like a compatibility problem, are you using Mysql 5.1 or later? if yes try it again with mysql 5.0 but check your database.yml configurations first.
April 25th, 2009 at 8:33 am
Just add “sudo make install” as the last step of “Installing mysql-ruby adaptor”.
Also don’t forget to install mysql by running command “sudo apt-get install mysql-server mysql-client libmysqlclient15-dev”.
April 25th, 2009 at 10:41 am
Thanks for the great post! It really helped me out a lot. I just installed ubuntu 9.04 and was trying to run ruby 1.9 but had installed both version 1.9 and 1.8.7.
So typical of multi ruby versions there were many issues and headaches. So I googled and then got your blog. Copy-and-paste and then I’ve got a fully functional ruby1.9 environment
April 28th, 2009 at 1:58 pm
Thanks for the help great good post
April 28th, 2009 at 2:47 pm
I’m glad to hear that.
May 10th, 2009 at 1:30 am
There is a mistake in the post. After the line:
sudo ruby extconf.rb
You have to type in:
make
sudo make install
Then it will work.
May 10th, 2009 at 2:53 am
Nilakanta and David Thanks guys for your correction.
May 15th, 2009 at 6:14 am
Hi, I installed ruby-1.9.1-p129 and mysql gem doesn’t install correctly. The extconf.rb does not generate makefile, do you know how to fix it?
June 11th, 2009 at 4:19 am
I followed your instructions and managed to install everything. But there are still some issues (regarding the mysql-ruby adaptor, I think).
For example, running `rake db:migrate` works fine, but when I run my rails app I get the following error:
undefined method `init’ for Mysql:Class
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.2/lib/active_record/connection_adapters/mysql_adapter.rb:73:in `mysql_connection’
Any ideas on what might be causing this?
Thanks.
(This is the production environment, running Ubuntu and the app runs fine – on ruby1.9.1 / rails2.3.2 / OS X – on my development machine)
July 25th, 2009 at 2:56 am
How do I uninstall it or set the default back to Ruby 1.8? Thanks
August 18th, 2009 at 11:57 pm
Please let me know, how to install rails 2.3 and ruby 1.9 on ubuntu for mysql and sqlite3 on “Windows”
August 19th, 2009 at 12:10 am
Hi All,
I am installed Ruby-1.9.1 and gems rails,rake ,ack,sqlite3-ruby on my windows machine, below gem list is available on my machine.
*** LOCAL GEMS ***
actionmailer (2.3.3)
actionpack (2.3.3)
activerecord (2.3.3)
activeresource (2.3.3)
activesupport (2.3.3)
dbi (0.4.1)
deprecated (2.0.1)
needle (1.3.0)
net-scp (1.0.2)
net-sftp (2.0.2)
net-ssh (2.0.11)
rack (1.0.0)
rails (2.3.3)
rake (0.8.7)
ruby-oci8 (2.0.2)
sqlite3-ruby (1.2.5)
But I am unable to install (no idea how to install) the “mysql-ruby adaptor” on my “windows” machine, please let me know the installation process.
August 19th, 2009 at 12:32 am
Sorry my friend but I don’t use Windows a lot, specially for development, but I’ll highly recommend to you Ubuntu and Netbeans for your development environment, believe me you will feel the big difference.
August 19th, 2009 at 12:41 am
Julian I’m sorry to be late that much, I think the easiest way is to compile Ruby 1.8 and reinstall it.
August 19th, 2009 at 2:56 am
Thanks Amer..!
Please if anyone knows about installation of “mysql-ruby adaptor” on windows let me know.
September 9th, 2009 at 4:50 am
Thanks, this is exactly what I needed, it’s a little out of date but now I have ruby/rails all up to date and working. Good work!
root@———-:~# gem list
*** LOCAL GEMS ***
actionmailer (2.3.4)
actionpack (2.3.4)
activerecord (2.3.4)
activeresource (2.3.4)
activesupport (2.3.4)
rack (1.0.0)
rails (2.3.4)
rake (0.8.7)
sqlite3-ruby (1.2.5)
root@——-:~# ruby -v
ruby 1.9.1p243 (2009-07-16 revision 24175) [i686-linux]
September 12th, 2009 at 7:33 pm
Thanks a lot
I wonder why ubuntu doesnt regularly update their packages with ruby stuff
[~]$ gem list (09-12 23:32)
*** LOCAL GEMS ***
actionmailer (2.3.4)
actionpack (2.3.4)
activerecord (2.3.4)
activeresource (2.3.4)
activesupport (2.3.4)
rack (1.0.0)
rails (2.3.4)
rake (0.8.7)
sqlite3-ruby (1.2.5)
December 4th, 2009 at 2:12 am
Amer, I went up to ‘sudo make && sudo make install’ and I got at the very end the error:
gcc -O2 -g -Wall -Wno-parentheses -I. -I.ext/include/i686-linux -I./include -I. -DRUBY_EXPORT -o cont.o -c cont.c
cont.c:90:6: error: #elif with no expression
cont.c:270:6: error: #elif with no expression
cont.c:317:6: error: #elif with no expression
make: *** [cont.o] Error 1
serge@ubuntu:~/src/ruby-1.9.1-p0$ ruby -v
The program ‘ruby’ is currently not installed. You can install it by typing:
sudo apt-get install ruby
ruby: command not found
Any idea how to resolve it? I’m on Ubuntu 9.10. Thank you.
December 9th, 2009 at 12:46 am
I’m on Ubuntu 9.10 ‘KArmic Koala’ and I folllowed your instrtuctions to install just ruby 1.9.1. After I did
serge@ubuntu:~/src/ruby-1.9.1-p0$ cd ~
serge@ubuntu:~$ ruby -v
The program ‘ruby’ is currently not installed. You can install it by typing:
sudo apt-get install ruby
ruby: command not found
serge@ubuntu:~$
Any idea Amer?
January 21st, 2010 at 10:11 am
hello…
this post helped me a lot to install rails in ubuntu..
but m getting error while installing some gems..like unicode and slim_scrooge
make: *** [callsite_hash.o] Error 1
Plz guide me how to solve it???
February 11th, 2010 at 9:14 pm
My problem is similar to Javix’s.
After I typed ’sudo make && sudo make install’ and I got at the very end the error:
gcc -O2 -g -Wall -Wno-parentheses -I. -I.ext/include/x86_64-linux -I./include -I. -DRUBY_EXPORT -o cont.o -c cont.c
cont.c:90:6: error: #elif with no expression
cont.c:270:6: error: #elif with no expression
cont.c:317:6: error: #elif with no expression
make: *** [cont.o] Error 1
Could you give us any hint to solve this issue?
February 12th, 2010 at 9:06 am
Hi Ben,
Are you sure you have the right versions? anyway try to run rails 3 on Ruby 1.9 it’s still beta but for sure it’s more compatible than this one.
http://weblog.rubyonrails.org/2010/2/5/rails-3-0-beta-release
good luck.
April 28th, 2010 at 7:29 pm
for those who already installed ruby1.9.1 yet is getting an error “ruby command not found”, try typing ruby1.9.1 instead of ruby
example:
$ ruby1.9.1 -v
May 10th, 2010 at 6:52 am
Thanks! I was getting frustrated with trying to get “ruby -v” to work! “ruby1.9.1 -v” did the trick.
A question, why doesn’t this work for a ruby shell script? #!/usr/bin ruby1.9.1
May 10th, 2010 at 7:03 am
Found the answer:
#!/usr/bin/env ruby1.9.1