Installing RadRails on Ubuntu Linux

From Aptana

This page describes how to get started with your RadRails installation on Linux. Both Ubuntu and Debian users should follow the instructions on this page to get their installations up and running.

Contents

Introduction

For non-Linux users, Aptana RadRails will prompt you to install any needed Ruby gems for your system. If you're a Linux user on Ubuntu or Debian, however, you'll need to perform a few more manual installation steps to get RadRails running smoothly. The instructions below give the commands that you'll need to use to install Ruby, Ruby Gems, Rails, and Mongrel.

Note: Much of the information on this page originally appeared on the Ubuntu Community Documentation site: https://help.ubuntu.com/community/RubyOnRails

Instructions

The instructions below describe how to install Rails and its dependencies as both a root and non-root user.

Installing as root

Note: Make sure that you have the Universe repository enabled in your /etc/sources.list. See https://wiki.ubuntu.com/AddingRepositoriesHowto for instructions.

In Ubuntu 6.06LTS or newer, you can install the "rails" package then skip to creating your first rails app; however , this can cause some annoying issues with ubuntu's package management (apt-get) and the rails gem manager.

Installing Ruby

Type the following command on the command line to install the Ruby language:

sudo apt-get install ruby rdoc irb libyaml-ruby libzlib-ruby ri libopenssl-ruby ruby1.8-dev 

Installing Ruby Gems via source

Type the following to install the gem executable to /usr/bin/gem1.8.

wget http://rubyforge.org/frs/download.php/29548/rubygems-1.0.1.tgz 
tar xzvf rubygems-1.0.1.tgz
cd rubygems-1.0.1
sudo ruby setup.rb
sudo gem update --system

You can add a symbolic link so that the rest of your commands will work:

sudo ln -s /usr/bin/gem1.8 /usr/bin/gem

Installing as a non-root user

You can install rubygems in your home directory, which doesn't require root rights and is possibly safer (it doesn't install or modify files outside of your home directory).

Installing Ruby

To install Ruby, type the following at the command line:

sudo apt-get install ruby rdoc irb libyaml-ruby libzlib-ruby ri libopenssl-ruby 

Installing Ruby Gems

To install Ruby Gems, type the following commands on your command line:

wget http://rubyforge.org/frs/download.php/17190/rubygems-0.9.2.tgz 
tar xzvf rubygems-0.9.2.tgz
cd rubygems-0.9.2
PREFIX=$HOME
export GEM_HOME=$PREFIX/lib/ruby/gems/1.8 
export RUBYLIB=$PREFIX/local/lib/ruby:$PREFIX/local/lib/site_ruby/1.8
ruby setup.rb all --prefix=$PREFIX

Next, add GEM_HOME and RUBYLIB into your ~/.profile file to automatically load on login (otherwise some scripts will complain of not finding rubygems).

Installing Rails and its dependencies

To install the Rails framework and its dependencies, type the following at your command line:

~/bin/gem install rails -y 

Creating your first Rails application

You can create your first Rails application as the current user without using "sudo". To create your first Rails application, type the following at the command line:

$ ~/lib/ruby/gems/1.8/bin/rails/path/to/new/railsapp 

Note: Make sure that you replace /path/to/new/railsapp with your own path to where you want your app source code to live (e.g. /home/myhome/rails/myapp.)

Installing Mongrel

To install Mongrel, type the following at the command line:

sudo apt-get install build-essential 
sudo apt-get install ruby1.8-dev
sudo gem install mongrel

To install the mysql gem, type the following at the command line:

sudo apt-get install libmysqlclient15-dev

and then run the following:

sudo gem install mysql

Installing SQLite3

The instructions in this section originally appeared on the Plan A blog:

http://theplana.wordpress.com/2007/05/11/install-sqlite3-on-ubuntu/

To install SQLite3 on Ubuntu:

  1. Type the following on the command line to install SQLite:

    sudo apt-get install sqlite3 libsqlite3-dev
    sudo gem install sqlite3-ruby
    

  2. Create a database by creating an empty file, using the following code:

    touch database_name_dev.db
    touch database_name_test.db
    touch database_name_prod.db

  3. Configure the following files as described:
    • development:
      • adapter: sqlite3
      • database: db/database_name_dev.db
    • test:
      • adapter: sqlite3
      • database: db/database_name_test.db
    • production:
      • adapter: sqlite3
      • database: db/database_name_prod.db

Related Topics