Topic: Ruby on Rails Tutorial Software Installation Ubuntu 10.10

Ruby on Rails Tutorial Software Installation Instructions For Ubuntu 10.10

Do this before starting the tutorial.



Updating Ubuntu

From a terminal window execute:

sudo apt-get update

This will update Ubuntu 10.10 to the latest level.



Installing Git

These instructions come from:
http://progit.org/book/ch1-4.html

From your home directory execute the following (Don't type the "$"):

$ sudo apt-get install libcurl4-gnutls-dev

$ sudo apt-get install libexpat1-dev

$ sudo apt-get install gettext

$ sudo apt-get install libssl-dev

In your browser navigate to: http://git-scm.com/download
Click on "Source".
Save the tar.bz2 file to your Downloads directory.
Run the Nautilus file system explorer by clicking "Places" and then
"Downloads". From the Downloads directory right-click on the
git-x.x.x.tar.bz2 file that you just downloaded and then click
"Open With Archive Manager". Next click "Extract". Check the boxes
labeled "Re-create folders" and "Overwrite existing files" then
click the "Extract" button. This should produce a folder named
git-x.x.x where the x's are the version number.

Open a terminal window and navigate to your Downloads folder.
Change directory to the newly created git folder, git-x.x.x .
Execute the following:

$ sudo ./configure

$ sudo make prefix=/usr/local all

$ sudo make prefix=/usr/local install

$ git --version

If everything went well, the latest version of Git is now installed on
your computer.



Checking Curl Protocols

From your home directory execute the following:

$ curl --version

Look at the line that begins with "Protocols:". Does it contain a
protocol "https"? If so, you can skip this section and go to the
next one titled "Installing RVM"

In your browser navigate to: http://curl.haxx.se/download.html
Under "Source Archives" locate the latest version of curl, and download its
tar.bz2 file to your Downloads directory. Extract the contents of this file
to a folder in your Downloads directory just like you did for "git" in the
previous section.

Open a terminal window and navigate to your Downloads folder.
Change directory to the newly created curl folder, curl-x.x.x .
Execute the following:

$ sudo ./configure

$ sudo make prefix=/usr/local all

$ sudo make prefix=/usr/local install

$ curl --version

Now you should see the "https" protocol on the protocols line.



Installing RVM

These instructions come from:
https://rvm.beginrescueend.com/rvm/install/

Open a terminal window, navigate to your home directory and execute the
following:

$ bash < <(curl https://rvm.beginrescueend.com/install/rvm)

You may have noticed that I removed the -s (silent) parameter from the
command line given on the web site. If you run in silent mode, you won't
know if you get and error such as "no https protocol."

Also notice that I didn't use sudo. We want to install RVM under your
home directory to match the Rails Tutorial.

Now we need to make changes to the .bashrc file in your home directory.
Open it with gedit or your favorite editor.

Near the top of the .bashrc file is a line that says:

if [ -z "$PS1" ] && return

Comment out this line by placing a "#" at the beginning.

Insert a new line beneath the comment that says:

if [[ -n "$PS1" ]]; then

Now go to the end of the .bashrc file, and add the following three lines:

fi
# This loads RVM into a shell session.
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

Note: These instructions assume that you have not already added something
to the end of the .bashrc file. If you have, put the "fi" in an
appropriate spot.

You may also want to do some indenting of the lines between the "if" and
the "fi". This will make the .bashrc script easier to read, but it's not
necessary.

Now save the .bashrc file, exit gedit, and close the terminal window. Then
open a new terminal window. You should be in your home directory. Execute
the following command (Note: it's minus one not dash el):

type rvm | head -1

If all went well, you should see "rvm is a function."

Optional Step 1:

Edit the file .rvmrc which is in your home folder. Add the following
line to the bottom of that file:

set 'export rvm_pretty_print_flag=1' in ~/.rvmrc

Save and exit. This will add color to the RVM output.

Optional Step 2:

Just for fun we can update our copy of RVM by executing the following:

$ rvm get latest

$ rvm reload



Installing Two Versions of Ruby

These instructions come from the tutorial.

Open a terminal window. From your home folder execute the following:

$ rvm install 1.8.7-p302

$ rvm install 1.9.2-p180

Note: These are the versions used in the tutorial. If you feel brave you may
want to install the latest versions.

Next, execute the following from your home folder:

$ rvm --create 1.8.7-p302@rails2tutorial
$ rvm --create use 1.9.2-p180@rails3tutorial
$ rvm --default use 1.9.2-p180@rails3tutorial



Installing Ruby Gems

In your browser navigate to:
http://rubyforge.org/frs/?group_id=126

Under rubygems right-click on the latest version of a rubygems .tgz
file. Download the file to your Downloads directory, and extract the
contents.

From a terminal window navigate to the newly created folder, and execute:

$ sudo ruby setup.rb



Installing Rails

From a terminal window navigate to your home folder, and execute:

$ gem install rails --version 3.0.7

$ rails --version

If you got a version number from that last command, your rails installation
was successful.



Installing Sqlite3

From a terminal window navigate to your home folder, and execute:

$ sudo apt-get install sqlite3 libsqlite3-dev

$ sqlite3 --version

If all went well, you have a usable Sqlite3 installation.



Making Final Modifications To .bashrc

These lines came from the tutorial.

From your home directory open .bashrc with gedit or your favorite editor.
Add these lines to the end of .bashrc. Save and exit.

# git tab completion
source ~/git-completion.bash
# Show branch in status line
PS1='[\W$(__git_ps1 " (%s)")]\$ '
export PROMPT_COMMAND='echo -ne "\033]0;${PWD/#$HOME/~}\007"'

Optional Step:

Add these lines to the end of .bashrc if you may want to make changes
to PATH:

# Put any path changes for a terminal window in the line below.
export PATH=$PATH: # Add your new path after the colon.

For these changes to take effect you must close the terminal window
and reopen it.

Doug Witmer

Re: Ruby on Rails Tutorial Software Installation Ubuntu 10.10

I have heard that Ubuntu has now a cloud security firm that handles their updates and other online things. Is that true? I like Ubuntu because it is the most accessible version of Linux but because of some security problems I had to change it.