Rod McLaughlin


How to install Rails 4 on a Celeron 4GB netbook (21 aug 13)

I'm finding out how  you can create a useable web application on minimal hardware, in contrast to the J2EE monster I am currently contributing to at work.

First, get a 4GB USB stick, and, from a computer already running Ubuntu, make it into an Ubuntu installation disk:

http://www.ubuntu.com/download/desktop/create-a-usb-stick-on-ubuntu

Put the USB drive into a spare slot on the netbook
Reboot the netbook and hit F2
Navigate throught the menus using the arrow keys, and choose USB drive as your startup disk
Exit by hitting F10 and answering Yes

Now hit ESC a few times, and using the arrow keys, choose 'Removable dev' as the primary boot device from the startup menu, and hit Enter

Now the computer will start up from the USB drive, and you should choose to install Ubuntu

It's mostly straightforward, but a tricky bit is when a dialog entintled 'Preparing to Install Ubuntu' appears which is too big for the screen
Guessing the buttons at the bottom, hit tab FOUR times and hit the space bar

This should take you on to the rest of the installation process; all of the other dialog buttons are visible

Choose a user name and password, and wait for Ubuntu to install
Remove the USB drive and restart the computer

You may have to go into the menus by hitting F2 again (see above) and choosing "HDD" as the primary boot device instead of 'Removable dev'

Now you have Ubuntu. Open a terminal window by clicking on the box at the top left entitled 'Dev Home', typing the word 'Terminal', and hitting Enter

Edit file .bashrc, like this

pico .bashrc

add the following three lines to the bottom of the file

export GEM_PATH=~/.gem
export GEM_HOME=$GEM_PATH
export PATH=$PATH:~/.gem/bin

then enter ctrl-O, Enter, ctrl-X, and run the following command

source .bashrc

Create a file called myscript.sh like this

pico myscript.sh

and add the following lines, then enter ctrl-O, Enter, ctrl-X

 

#!/bin/sh
sudo apt-get -y update
sudo apt-get -y install build-essential zlib1g-dev libssl-dev
sudo apt-get -y install libreadline6-dev libyaml-dev
cd /tmp
wget http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz
tar -xvzf ruby-2.0.0-p247.tar.gz
rm ruby-2.0.0-p247.tar.gz
cd ruby-2.0.0-p247/
./configure --prefix=/usr/local
make
sudo make install
cd /tmp
rm -Rf *
cd
sudo apt-get -y install libsqlite3-dev sqlite3
sudo apt-get -y install rubygems
sudo apt-get clean
sudo apt-get autoclean
sudo apt-get autoremove
sudo rm -Rf /var/cache/man/*
sudo rm -Rf /usr/local/man/*
sudo rm -Rf /usr/share/man/*
gem install bundler --no-ri --no-rdoc
gem install therubyracer --no-ri --no-rdoc
gem install rails --no-ri --no-rdoc
rails new my-app
cd my-app
#-------------------------------------

 
Then run the script, like this:
bash myscript.sh

When it asks for a password, enter your password.

You may see a dialog box warning about running out of disk space. Click 'ignore'.
Later, you can use 'sudo apt-get remove' to remove unused programs. You can also delete the "rdocs" which come with Ruby gems - find folders called 'rdoc' in various gems, e.g.

actionmailer-4.0.0/rdoc

and delete the contents of these folders.


Edit the Gemfile:
 pico Gemfile

Ensure line beginning
 gem 'therubyracer'
has no # at the beginning

Enter

 bundle install
 rails server&

and point your browser at http://localhost:3000

 



Back
Portland London