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 update
Install 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
sudo ruby setup.rb
MySQL installation and configuration
sudo apt-get install mysql-server
- Install ruby MySQL bindings
sudo apt-get install libmysql-ruby
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 root
Into 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
Create and test the rails app
Lets denote your working directory (the root directory where your future rails project s will reside rails_projects).
- It should look like this:
ruby script/generate model Dummy
class CreateDummies < ActiveRecord::Migration
create_table :dummies do |t|
t.column :foo, :string
t.column :bar, :string
- generate a simple maintenance app
ruby script/generate scaffold Dummy Admin
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.
Internet contains huge number of opportunities to earn money online. Simply create a site that you think has the potential to sell hot items using ruby on rails. Register a relevant domain name and purchase a web hosting service through hostgator
, one of the better web host
out there today. Get a internet connection through one of the wireless internet providers
to upload your site. Work on search engine optimization
to get a better traffic and also use affiliate marketing program
for the same reason. Finally get a free voip
phone service to contact customers directly. The pc to phone
system is the most effective method of marketing.