(Windows Installer) Installation Procedure - Ruby Forum

soilkinkajouInternet and Web Development

Feb 2, 2013 (4 years and 7 months ago)

189 views

Ruby
-
Rails

(Windows Installer)

Installation Procedure

Ruby can be installed either choosing a One Click Installer
(OCI)

from this link
http://rubyforge.org

or
installing the ruby components separately as prebuilt packages from this link
http://rubyinstaller.org/downloads/
.

The
OCI

comes with a r
uby IDE that has to be employed,
against the windows command p
rompt
which
can be used
in the ruby installer pre built package version
(s)
.

I have chosen to use the pre
-
built packages and custom
-

configure the ruby components.
You can
d
ownload and install the latest version of ruby here.
http://rubyinstaller.org/downloads/
. You can check
the version installed, in the command prompt using this command: “ruby

v”


Once ruby installation is done
, we need to install the ruby components separately. Ruby calls these
packag
es using the “gems” terminology. Each ruby
component can

be installed as bundles using the
“gems” component.
But before that, we need to ensure if we have to update our copy of the gems
component, just to make sure everything will move on smoothly
: “gem u
pdate

system”


In my case (as shown above, there was nothing to update)
. Once ruby and gems are installed, it’s time to
get rails and other components installed.



Installing rails will take quite some time. But once the installation is done, you are
ready to create a rails
application and begin the application development.

Note that your version of the installation may vary
from what’s depicted in the screenshot above. The installation above is an update to the already existing
and installed rails fra
mework.

But there is something worthy of notifying at this juncture. We need a web server and a database in
order to be creating and running a valid ruby
-
rails application. Usually, the gem installation takes care of
installing the packages for us. As a ma
tter of fact
, the WEBrick web server and an
sqlite3 database are
installed by default with the gems installation package.

So once the rails installation is done, the next step would be to create a rails application. A lot of ruby
-
rails experts recommend y
ou
,

NOT to create a rails application in the ruby root folder or the windows
program files. You might be better of creating on in the safest location possible


“My Documents”.

No
matter where you chose to create you rails application, the following comm
an
d will is the kick off point
:
“rails new JobBoard” where JobBoard is the name of the rails application you intend to create.
Notice
that a lot of rails specific folders are automatically created for you. Once this command runs, your rails
application is se
t up and ready to be worked upon.


The next step is to start up our web server. This can be done by changing the path to point to the
created application directory. (“cd JobBoard” in this case), and running the web server using the
following command: “rai
ls server”. You should see something like “
Booting WEBrick
”.


If you don’t see this screen above, and rather are displayed an error message
, that says something like
the one depicted below, then you probably don’t have the sqlite3 dll file in your ruby bi
n directory.



If you are not sure why this happens, go to your application directory you created, locate (and open in
a notepad maybe) a “Gemfile”. This gem file is like a configuration file and appears in every created

rails
application.
If you notice
, there is a line in this gem file that says: “
gem 'sqlite3
-
ruby',
:require =>
'sqlite3'
”. This means,

that in order for your server
and your rails application to run, you need sqlite and
its dll files in appropriate places in your ruby installation.
You ca
n download the sqlite3 command line
and the sqlite3dll file in these links:
http://sqlite.org/sqlite
-
3_6_23_1.zip

and
http://sqlite.org/sqlitedll
-
3_6_23_1.zip

respectively.

Once downloaded, extract the zip files directly to the Ruby/bin directory.

After extracting you can use the following command to install sqlite3 onto your system.

(Note that
following these steps in i
ncongruous order is not going to affect the sqlite3 installation): “gem install
sqlite3
-
ruby”.


Now try starting the server using the “rails server” command and you should see the server starting up
this time.

You can test if the server is up and running

by
testing the following URL in your web browser
-
>
http://localhost:3000/

and you should see the following page displayed.



Now you are ready to start working on your newly created ruby
-
rails application.