This manual to install Ruby on Rails 3.1 with SQLite3 on Ubuntu 11:10 (but it is valid also for previous versions of Ubuntu 11.04, 10.10, 10.04 etc). I've chosen to install all the packages manually in a way That you can exactly know what you're installing and where.
1. INSTALL THE NEEDED LIBRARIES
Open the Synaptic Package Manager: Ubuntu 11.10 has the Unity desktop manager, you can find the Package Manager into the menu, searching for "software". If synaptic is not installed you can search it into the Ubuntu Software Center. This is the software manager (in my language):
- search and install the following packages (if they're not already installed) zlib1g, zlib1g-dev, build-essential, sqlite3, libsqlite3-dev, openssl, libssl-dev
2. DOWNLOAD AND INSTALL RUBY 1.9.2
- Download the last version Ruby 1.9.2 in the "Compiling Ruby" section of the web page
- Unzip the archive
- Install running:
- $ ./configure
- $ make
- $ sudo make install
- Check the successful installation running ruby -v: it should answer with "ruby 1.9.2p290..."
3. DOWNLOAD RUBY GEM: THE STANDARD RUBY PACKAGE MANAGER
- Download ruby gem version 1.8.10 (rubygems-1.8.10.tgz)
- Unzip the archive somewhere
- Put the console in the unzipped folder
- Install running: $ sudo ruby setup.rb
- Check the successful installation running gem -v: it should reply "1.8.10"
4. INSTALL RAILS
- Install Rails running on the console: $ sudo gem install rails
- (it takes a while, don't worry)
- Check if everything's ok using the commands "rails -v" (you should get "rails 3.1.0") or "gem list"
5. INSTALL SQLITE3 GEM
- Install the sqlite3 gem running: $ sudo gem install sqlite3
6. CREATE A NEW RAILS PROJECT
- $ rails new myapp
- Wait a bit after the message run bundle install
7. CREATE THE BLANK DATABASE
- Put the console in myapp folder (cd myapp) and run: $ rake db:create
in order to create the databases test.sqlite3 and development.sqlite3: (you can see them in db folder).
- !!! If you receive some error jump to the session : 9. !! COMMON ISSUES THAT MIGHT OCCUR !!!
8. RUN YOUR RAILS APP
- Put the console in myapp folder and run $ rails server
- Open the browser
- http://localhost:3000
- and you should see the Ruby on Rails: welcome page;-)
I suggest you to continue the ROR learning on the official documentation, in particular on the getting started page.
9. !! COMMON ISSUES THAT MIGHT OCCUR !!
- Running rake db:create or rake db:migrate you could get the error: uninitialized constant Rake::DSL. The solution is to put in the first line of your Rakefile: require 'rake/dsl_definition'
- In the browser at localhost:3000 you could get the error: "no such file to load -- openssl". The solution is to go through the installation directory of ruby: ruby-1.9.2-p180/ext/openssl and run:
ruby extconf.rb
make
sudo make install
- Running rake db:create the first time could generate this error:
rake aborted!
Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes.
The error should be fixed adding in the Gemfile (in the root folder of your app) the lines:
gem 'execjs'
gem 'therubyracer'
- and run sudo bundle
- Put again the console in myapp folder and run: $ rake db:create
Description: Install Ruby on Rails 3.1 with SQLite3 on Ubuntu 11 Rating: 4.5 Reviewer: Zein Okeh - ItemReviewed: Install Ruby on Rails 3.1 with SQLite3 on Ubuntu 11
1 komentar:
I haven't yet thought about this :)
Thank You For this App I am using in my UBUNTU !
Post a Comment
Sorry if my english is bad