May 13th, 2006
I have just installed Ubuntu Dapper Drake Flight 6 on my desktop machine, and because I had had different problems to install Rails from scratch several times (even the recent session was no exception), I have decided to write a step-by-step guide, which assumes a clean, fresh install of Ubuntu ( i.e. at this point you do not even have Ruby on your machine) and leads you through installing Rails and creating a working test application. Why is this writeup better than any other how-to-install-rails tutorials out there?
- Because it will tell you to install really just what you need, not 50 packages more
- It will also show you how to configure the DB and other things to really make Rails work, not just installed
Let’s get started! Note: Some people asked if this manual is for dapper only. I would say mostly yes, because i have had different problems on breezy (for example i had to compile ruby-mysql driver manually). Its not entirely impossible that it will work with breezy - but then you will have to make sure that the packages are the same version as assumed here (e.g. MySQL > 5 etc.)
Part I: Installation
Prepare the system for the installation
- Check /etc/apt/sources.list - make sure you have access to the ‘universe’ packages by uncommenting them:
deb http://us.archive.ubuntu.com/ubuntu dapper universe deb-src http://us.archive.ubuntu.com/ubuntu dapper universe
- Refresh apt packages to make sure you get the most up-to-date stuff:
sudo apt-get updateInstall Ruby related packages
- Install Ruby essentials: ruby, irb, rdoc, ri
sudo apt-get install ruby rdoc ri
- Install gems: download, unpack, install
go to http://docs.rubygems.org/ download rubygems-0.8.11.tgz (or the latest version) tar -xzvf rubygems-0.8.11.tgz cd rubygems-0.8.11/ sudo ruby setup.rbMySQL installation and configuration
- Install MySQL:
sudo apt-get install mysql-server
- Install ruby MySQL bindings
sudo apt-get install libmysql-rubyInstall Rails
sudo gem install rails --include-dependencies
Part II: Configuration
Setup the DB- Add an user, create a test database and grant acces for the user
mysqladmin -u root create test_development
mysql -u rootInto the db shell, write the following commands:
create user 'batman'@'localhost' identified by 'robin'; grant all on test_development.* to 'batman'@'localhost';Don’t forget to replace the username/password (unless you happen to be Batman of course - in this case i suggest to use a different password since this can be guessed easily by social engineers
- generate the app files
cd rails_projects rails test
- edit config/database.yml
cd rails_projects/test vim config/database.yml
- It should look like this:
development: adapter: mysql database: test_development username: batman password: robin host: localhost
- generate a dummy model
ruby script/generate model Dummy
- edit the migration file
vim db/migrate/001_create_dummies.rb
class CreateDummies < ActiveRecord::Migration
def self.up
create_table :dummies do |t|
t.column :foo, :string
t.column :bar, :string
end
end
def self.down
drop_table :dummies
end
end
- run the migration
rake db:migrate
- generate a simple maintenance app
ruby script/generate scaffold Dummy Admin
- start the server
ruby script/server
Point your browser to http://localhost:3000/admin to see the result.
If you have any problems, please leave a comment, i will try to help you.

June 1st, 2006 at 11:06 am
deb http://us.archive.ubuntu.com/ubuntu dapper universe
deb-src http://us.archive.ubuntu.com/ubuntu dapper universe
June 1st, 2006 at 3:33 pm
Thanks Duilio
It’s funny that although this is one of my most popular entries so far, no one noticed (or cared about to write a comment) yet. So thanks, again, it should be corrected now.
June 2nd, 2006 at 9:38 am
Thanks for this. I couldn’t get the db user creation to work until I added a semi-colon after the “create” line:
create user ‘batman’@'localhost’ identified by ‘robin’;
grant all on test_development.* to ‘batman’@'localhost’;
June 2nd, 2006 at 10:05 am
Those should be prime marks of course, not curly quotes. WordPress is too smart by half.
June 3rd, 2006 at 4:48 am
Yep, i also have had issues with writing posts in WordPress until i switched to the markdown plugin. The default editor of WP is smarter than Microsoft Word
I don’t know how to tweak this very text field i am writing to, though.
June 6th, 2006 at 11:10 pm
[...] Step-by-step instructions for installing rails on Ubuntu Dapper 6.06: Getting Ruby on Rails up and running on Ubuntu Dapper [...]
June 7th, 2006 at 12:13 am
Fantastic guide. Found you from Digg.com
This line needs the last comma removed from the db/migrate/001createdummies.rb file
t.column :foo, :string,
Do you have a Dapper guide for getting the application to work with apache or apache2?
June 7th, 2006 at 2:57 am
Jeff,
I am glad you liked the stuff
Thanks for the comma correction, already updated.
Well, i don’t have a Rails+Dapper+Apache2 guide right now, but i will write one soon - i guess dreamhost makes me too lazy because there you don’t have to install anything, just configure (I did not say there are no issues - once i spent 3 hours with deploying something, though later it became clear that the problem was not with dreamhost but with something completely different) - but at least you don’t have to install rails, apache2 etc.
Since i will definitely need to set up a rails+apache2 environment locally somewhere in the near future, i will blog about it, too.
June 11th, 2006 at 9:31 am
Nice tutorial, but it doesn’t work if you disable table pluralization. Even if you use the right names. I think we have found a bug in rails.
June 11th, 2006 at 9:59 am
@ZuNBiD:
Well, this tutorial was intended for newbies (i.e. people who have no idea how to disable the table pluralization, just want to get started with Rails on Ubuntu)
Nevertheless it is interesting that it does not work even if you use the right names… Do you think it is a bug?
June 11th, 2006 at 10:35 am
I not sure if it is a bug. someone told me that scafolding needs pluralization. I think this is false. Try to follow your tutorial. the only change I did was in these 2 lines:
ruby script/generate model Dummies
ruby script/generate scaffold Dummies Admin
Do you think I missed something ?
June 11th, 2006 at 11:44 am
I don’t think so scaffolding makes any difference. I think correctly it should be Dummy, not Dummies. Or did i misunderstand something?
June 14th, 2006 at 1:45 pm
You are a savior! Thank you for this. These instructions are right on.
June 29th, 2006 at 4:30 pm
Wont rails pluralize the word for you if it is required? And no, im pretty pluralization doesnt matter in scaffolding.
June 30th, 2006 at 12:47 am
I just had a question about this. I’m new to the whole RoR thing, but I’ve been doing programming on LAMP systems for a while, so I’ve had some exposure down this alley. But what I was confused about were the addresses. All the tutorials I’ve seen make you point the address to http://url:3000/directoryname. However, I’d just rather hand out the URL instead of making people remember it’s port 3000. Sounds trivial, I know, but I’d rather not have to deal with telling people what it is and how they should do it, and why the webpage isn’t running. Do you know how to make ROR listen on port 80 instead? Or would I have to somehow make Apache play nicely with RoR?
June 30th, 2006 at 1:07 am
Hi Brian,
Possibly the most known RoR mantra is ‘convention over configuration’ - in this case, if you follow the convention, just use port 3000 and you won’t have to change anything. (In fact this convention stems from the default server used in RoR - WEBRick - and WEBRick’s convention is to start servers on the port 3000,3001,…,3000+n)
Of course, yo can change just about anything if you wish - if you would like to use WEBRick with a different port, just start it like this:
ruby script/server -p8080
WEBRick is the quick’n'dirty solution, usually sufficient for development, but never quite enough for real world usage - for this most of the people are using Apache (over FCGI), LigHTTPD or Mongrel, a Ruby web server. There you don’t have the port 3000 anymore.
My recommendation is to play around with WEBRick (check out
ruby script/server –help
for more options, and if you are really doing something heavy, go for Apache+FCGI.
July 9th, 2006 at 8:15 pm
Did good will I got to the:
mysqladmin -u root create test_development
and got the message:
mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘root’@'localhost’ (using password: NO)’
I’ve had more trouble with mysql than any database I’ve ever tried to use. What’s wrong, please!!
July 9th, 2006 at 8:19 pm
Sorry about my typing, it should read:
Did good till I got to the:
Also, if I get mysql eventually set up properly, is it very difficult to switch to postgresql as the database? I’d rather use it if I can find out how to make the switch.
thanks again.
July 12th, 2006 at 12:37 am
Lee,
No, it is not difficult at all. All you have to do is to change the adapter in the database.yml file:
development/test/production:
adapter: postgresql
And that’s it.
As for mysql - yes, it can be hard sometimes. I am using it only because it PostgreSQL is not (yet) supported on dreamhost. I don’t know why you got this problem, a lot of people walked through this tutorial, and reported no problems…
July 15th, 2006 at 9:18 pm
batman bean bag chair…
Wow that’s a nice post ….
July 18th, 2006 at 8:50 am
I just installed the Ubuntu Drapper. I already used RoR with WindowsXP, but have no idea how to install it on Linux. So, i follow your tutorial. But… where is the “rails_projects” directory? Must I create it somewhere?
~/rubygems-0.9.0$ ls
bin doc gemspecs pkgs Rakefile redist scripts test
ChangeLog examples lib post-install.rb README Releases setup.rb TODO
July 18th, 2006 at 10:52 am
No, it is a directory just anywhere. E.g. in my case it is ~/development/railsprojects. It could be also ~/rails or whatever else - I have used “rails_projects” as a variable to further reference the directory where your rails projects will be placed.
July 18th, 2006 at 11:46 am
OK thx
No problem with the end of your tutorial, great one
August 8th, 2006 at 1:35 pm
welbutrin sr…
welbutrin sr welbutrin seizures welbutrin weight gain. buy generic welbutrin …
August 9th, 2006 at 1:53 pm
The capital in your account. As you trade you online forex trading only average online forex 50 online forex trading pips a forex online week or forex online once a day, forex online
any partyis free to forex online conduct foreign forex online exchange services to make this same information forex online available free to forex online the public. 6f42af23b1ed43b
August 9th, 2006 at 2:09 pm
The forex broker trade must be broker forex mini dealt with in a forex broker standardized rule where a positive growth rate forex broker increased 2,205 percent. This forex broker increase in FDI in the United States.
Forex Broker
The two forex broker options would be the same: The forex broker holder forex broker would compare forex broker receive the most significant articles forex broker on market conditions. 3a66cbea9cfd057
August 9th, 2006 at 2:17 pm
Forex forecast But dont worry; youre forex forecast about to discover a Forex are based on the periodic interest payments of the forex forecast domestic foreign exchange market. Currency trading has a long straddle or long strangle (where the currency markets forex forecast profitably, using the agents beliefs about future expected.
Forex Forecast 529b68b3d603e8a
August 11th, 2006 at 12:17 am
Resistance Resistance is the forex online trend potential forex online of a formation when trends change direction in an agreed offsetting of positions or obligations online forex trading by trading for forex online its initial years.
Forex Online
At forex online the same time, it is also forex online a monetary effect on forex online the main industrial countries to follow a particular strategy without forex online ccfbac61d09c934
August 11th, 2006 at 5:13 am
For both currency forex tag trading markets is not a Holy currency foreign forex trading Grail so probably “useless” forex currency trading to some. To me it’s just com currency forex trading tutorial an excellent forex currency trading resource, especially for forex currency trading short term trading.
Forex Currency Trading - Forex Currency Trading 358a4b622fa28c3
August 14th, 2006 at 11:27 am
There is no usa forex futures trading longer offered (in the same forex usa as for forex usa Leg 1 BCV DLOOP forex california - This forex usa is clearly forex usa an forex usa important distinction between sterilized forex hawaii and non-sterilized intervention.
Forex USA
Forex arkansas Only the former is entirely redundant. eefa401826b71a7
August 15th, 2006 at 8:15 am
forex currency tradnig, forex urrency trading, forex currency trafing, foex currency trading, forex currency ttading, forex currency tradig, forex currenc trading, forex currency rrading
forex currency tradimg 7b8a0d78f05363c
August 15th, 2006 at 9:11 am
cheaptickets…
cheaptickets airline cheapticket…
August 15th, 2006 at 12:59 pm
cialis…
buy cialis online 73 no prescription cialis…
August 18th, 2006 at 7:06 am
buy cialis…
cialis forum cialis drug cheap cialis order cialis …
September 4th, 2006 at 7:26 am
[...] Getting Ruby on Rails up and running on Ubuntu Dapper [...]
September 5th, 2006 at 10:12 am
phentermine online no prescription…
phentermine without a prescription. phentermine online no prescription…
September 8th, 2006 at 2:26 am
generic cialis…
generic cialis. cheap generic cialis…
September 11th, 2006 at 2:36 am
cialis…
buy cialis online. Generic cialis….
October 22nd, 2006 at 4:04 pm
Can’t some admin zap all the spam that’s accumulated here?
October 24th, 2006 at 10:39 pm
Very interesting site! fioricet online
December 27th, 2006 at 10:20 pm
Hi - thanks for your guide, one part that i failed on (after following everything else exactly the same) is the following;
sudo gem install rails –include-dependencies
ERROR: While executing gem … (URI::InvalidURIError)
bad URI(is not URI?): http://:8080/
Any ideas?
Thanks,
Luke
December 27th, 2006 at 10:23 pm
Update - sussed it and it was my enviroment;
luke@luke-laptop:~$ gem install rails –include-dependencies ERROR: While executing gem … (URI::InvalidURIError)
bad URI(is not URI?): http://:8080/
luke@luke-laptop:~$ set | grep 8080
httpproxy=http://:8080/
luke@luke-laptop:~$ unset httpproxy
luke@luke-laptop:~$ set | grep 8080
luke@luke-laptop:~$ sudo gem install rails –include-dependencies
Bulk updating Gem source index for: http://gems.rubyforge.org
January 18th, 2007 at 4:05 pm
I couldn’t get the db user creation to work until I added a semi-colon after the “create” line:
create user ‘batman’@’localhost’ identified by ‘robin’;
grant all on test_development.* to ‘batman’@’localhost’;
ı’ve the same problem..
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘grant all on test_development.* to ‘batman’@'localhost” at line 2
what should I do?..
January 20th, 2007 at 4:58 pm
[...] I was able to create a Virtual PC and installed Linux (I used Ubuntu), mySQL, and Ruby on Rails (this article was indispensable: http://www.rubyrailways.com/getting-ruby-on-rails-up-and-running-on-ubuntu-dapper/). I have yet to make a custom project with it, but it was actually not as hard to get going as I thought. I think I may make a dual boot on my machine. My install of windows is feeling really bloated and sluggish lately. If I really do switch development over to RoR, I may consider getting a Mac for my next machine. The Mac OS has RoR installed by default. [...]
January 22nd, 2007 at 2:34 am
jonny4
January 26th, 2007 at 8:08 am
Thanks for this article man, i a newbie on ruby on rails, with this i will get started
February 7th, 2007 at 5:43 pm
[...] For installing Ruby on Rails, I found a great tutorial at http://www.rubyrailways.com/ that walks you through the install and setup of both Ruby and MySQL. [...]
March 9th, 2007 at 11:23 am
Thank you thank you. Finally a tutorial that works! So now that I have Ruby installed what would you suggest my next step be?
Also is there any convention where to install Ruby? Right now I have it in /var/www/rails/rails_project on my development machine.
March 18th, 2007 at 11:32 pm
Fantastic Tutorial! I just did a Yahoo! search on rails ubuntu install and landed here.
You not only did a good job testing the tutorial but explained
Boy, am I glad!
the steps quite well. Thank you so much. Because of this wonderful article, I was able
to get my ruby, rails and mysql setup done in 15 minutes flat!! Kudos and keep up
the great work.
May 29th, 2007 at 6:46 am
Hi I try your tutorial and when I type the line
ruby script/generate model Dummy
it says to me:
ruby: No such file or directory — script/generate (LoadError)
Can you help me?
Thank you
June 9th, 2007 at 10:40 am
collapse,
that semicolon is supposed to be there after the password. So, you hit on the correct solution. That it isn’t there is probably a misprint.
Cheers,
Dr Stankus
July 22nd, 2007 at 10:46 am
My main concern is that you can’t guarantee every page of your website will be included in the SERPs. Considering I’m constantly adding new products to my company’s website, I need to be sure that customers can find them as soon as possible.http://www.seoptimizerz.com
August 14th, 2007 at 8:48 pm
Very effective. Thanx.4a7d3d609129a9296bf7ac0608c2097
October 4th, 2007 at 7:02 am
thank you!!
March 13th, 2008 at 4:19 am
uke@luke-laptop:~$ set | grep 8080
httpproxy=http://:8080/
luke@luke-laptop:~$ unset httpproxy
luke@luke-laptop:~$ set | grep 8080
luke@luke-laptop:~$ sudo gem install rails –include-dependencies
Bulk updating Gem source index for: http://gems.rubyforge.org
thanks a lot …
i was faced this prob almost one day.. now got solved with this site..
thanks
December 9th, 2008 at 5:06 am
Acomplia (Rimonabant) is an appetite suppressant diet pill. Acomplia is used complementary to diet and exercise to treat obese or overweight patients who suffer from Type 2 diabetes and abnormal levels of fat in the blood. It can also prevent the risk of cardiovascular disease. http://www.genericacomplia.co.uk
December 12th, 2008 at 9:05 am
Excellent Web Site! Very professional and full of great information. I am greatly enjoying it. Your enthusiasm is wonderful!!!
January 9th, 2009 at 3:26 am
Penis enlargement, natural penis enlargement, male enhancement, erectile dysfunction, premature ejaculation, erections, male enhancement, penus enlargement and penile enlargement products review for big penis size. http://www.penis4enlargement.com
January 21st, 2009 at 9:45 pm
“Try free vigrax plus, viagra, and all other top 2008 male enhancement products for erectile dysfuction, premature ejaculation, for FREE for 20 days.NO SIGNUP required.NO SPAM.NO handling rates.Delievering within a week.Available only for USA, CANADA , UK, GERMNY SWISZERLAND, UAE, AFRICA, JAPAN, CHINA, SOUTH AFRICA and Brazil. There u go. http://www.naturalherbalproduct.com/viagra.html
January 23rd, 2009 at 3:26 am
Matt Spears has been associated with male enhancement and has helped many a men improve their sexual capacities through natural means. Get more on male enhancement and Prosolution Pills at his website http://www.prosolutionpills.com/?a=155642
January 24th, 2009 at 12:27 pm
I am Very thank full the owner of this blog. Becouse of this blog is very imformative for me.. And I ask u some thiing You make more this type blog where we can get more knowledge.
and any one tell me how can I find this type blog. http://www.penisenlargementz.com
February 7th, 2009 at 12:50 pm
Truth is something that we hear a lot about, but when it comes to things like erectile problems and issues with sex, it seems that the waters can sometimes get quite muddied. If you find that you are a man who is having problems performing, it is easy to think that you are the only one who is affected by it, even when this is nothing close to the truth! If you are in a situation where you are trying to move forward and enjoy your sex life again, you’ll find that you need to think about the solutions that VigRX Plus can provide you with, and you also need to know the truth about this new miracle supplement.
March 26th, 2009 at 12:40 pm
Penis enlargement pills have been available for many decades now but due to the nature of the supplement and the reason for wanting them they are not very high profile in the mainstream media. The penis is still considered taboo and what male would freely engage in conversation about the need for them.