I’ve just downloaded the DBI for MySQL. I have Ruby installed on my
Ubuntu system, but I don’t know how to install the DBI package. (I’m
new to Linux) Can someone give me a step-by-step list on how to do it,
including how to unzip the tar.gz file? I’d really appreciate the help.
Peter V. wrote:
I’ve just downloaded the DBI for MySQL. I have Ruby installed on my
Ubuntu system, but I don’t know how to install the DBI package. (I’m
new to Linux) Can someone give me a step-by-step list on how to do it,
including how to unzip the tar.gz file? I’d really appreciate the help.
Peter (welcome to Unix, by the way)
I am not an expert on this, but I had to do it (on a Mac) and I can
help.
Let me tell you that you picked up to start on Linux an installation
that is not the easiest because of 3 layers of interdependency between
components. But if you have a bit of pacience, it should work (all other
installations that you will need to do will be a piece of cake after
this).
First: there are 3 components to be able to work with the Ruby DBI, that
you should install in this order (I assume you have a recent Ruby
version installed):
-
install MySql (5.0 or later); this will generate something called the
“MySql C Client Api” (I mention it as you will find references to it). -
install the Ruby-MySql module, from
MySQL/Ruby.
This is a MySql Ruby Client Api (a wrapper around the MySql C client Api
mentioned above). This install will provide the DRIVER (mysql.rb).
[Note: this installation failed this June on my Mac because of a missing
C ulong define, that one has to write manually (!). I don’t think the
problem exists on Linux].
- finally install the Ruby-Dbi module which will use the Driver
installed in previous point. The best doc (all others on the web give
you only part of the story) is
http://www.kitebird.com/articles/ruby-mysql.html, written by Paul Du
Bois (MySql guru). He even shows how to untar (the equivalent of what
you called ‘unzip’) the distribution. The only thing not clearly
described in his document is step 2 above.
Of course, if somebody knows a simpler way, please let us know; in the
meantime, the above works.
Good luck
Raul
Raul,
Thanks the reply. Before I got your reply, I installed the DBI package
so that I could write Ruby scripts that access MySQL databases. When I
attempt to run a test script, I get the
following error:
/usr/local/lib/site_ruby/1.8/dbi.rb:344:in load_driver': Could not load driver (no such file to load -- mysql) (DBI::InterfaceError) from /usr/local/lib/site_ruby/1.8/dbi.rb:227:in
_get_full_driver’
from /usr/local/lib/site_ruby/1.8/dbi.rb:213:in `connect’
from /root/bin/simple.rb:6
I used the instructions at this link:
www.kitebird.com/articles/rubi-dbi.html
I noticed you mentioned something about one step you mentioned not being
clear in the kitebird article, do you think that might be my problem?
If not, do you have any idea how I’d go about figuring out what the fix
for this error is?
Thanks again,
PV
Raul P. wrote:
Peter V. wrote:
I’ve just downloaded the DBI for MySQL. I have Ruby installed on my
Ubuntu system, but I don’t know how to install the DBI package. (I’m
new to Linux) Can someone give me a step-by-step list on how to do it,
including how to unzip the tar.gz file? I’d really appreciate the help.Peter (welcome to Unix, by the way)
I am not an expert on this, but I had to do it (on a Mac) and I can
help.Let me tell you that you picked up to start on Linux an installation
that is not the easiest because of 3 layers of interdependency between
components. But if you have a bit of pacience, it should work (all other
installations that you will need to do will be a piece of cake after
this).First: there are 3 components to be able to work with the Ruby DBI, that
you should install in this order (I assume you have a recent Ruby
version installed):
install MySql (5.0 or later); this will generate something called the
“MySql C Client Api” (I mention it as you will find references to it).install the Ruby-MySql module, from
MySQL/Ruby.
This is a MySql Ruby Client Api (a wrapper around the MySql C client Api
mentioned above). This install will provide the DRIVER (mysql.rb).[Note: this installation failed this June on my Mac because of a missing
C ulong define, that one has to write manually (!). I don’t think the
problem exists on Linux].
- finally install the Ruby-Dbi module which will use the Driver
installed in previous point. The best doc (all others on the web give
you only part of the story) is
http://www.kitebird.com/articles/ruby-mysql.html, written by Paul Du
Bois (MySql guru). He even shows how to untar (the equivalent of what
you called ‘unzip’) the distribution. The only thing not clearly
described in his document is step 2 above.Of course, if somebody knows a simpler way, please let us know; in the
meantime, the above works.Good luck
Raul
Peter V. wrote:
Raul,
Thanks the reply. Before I got your reply, I installed the DBI package
so that I could write Ruby scripts that access MySQL databases. When I
attempt to run a test script, I get the
following error:/usr/local/lib/site_ruby/1.8/dbi.rb:344:in
load_driver': Could not load driver (no such file to load -- mysql) (DBI::InterfaceError) from /usr/local/lib/site_ruby/1.8/dbi.rb:227:in
_get_full_driver’
from /usr/local/lib/site_ruby/1.8/dbi.rb:213:in `connect’
from /root/bin/simple.rb:6I used the instructions at this link:
www.kitebird.com/articles/rubi-dbi.html
I noticed you mentioned something about one step you mentioned not being
clear in the kitebird article, do you think that might be my problem?
If not, do you have any idea how I’d go about figuring out what the fix
for this error is?
Thanks again,
PV
Peter, just follow the 3 steps I listed, in their order: in particular,
step 2 (which installs the DRIVER msyql.rb) is the one which will solve
the problem.
Good luck
Raul
Peter V. wrote:
Raul,
I tried this, but I got the following error in step 2:ruby extconf.rb
extconf.rb:1:in `require’: no such file to load – mkmf (LoadError)
from extconf.rb:1The error is from the require ‘mkmf’ line in the extconf.rb script. How
can I find out what that is and where to get it?
Thanks again…
Peter,
I was wondering why you were executing that command, and I now saw
that it is listed in the site.
Now, the best when you install in Unix is to read the README file (or
INSTALL, etc), because they are updated (not the instructions in the
site from where you donwload; of course, glance at them, just in case,
but go with the instructions in the distribution):
In the README file under ruby-dbi, you will see that it says to do:
ruby setup.rb config --with=dbi,dbd_pg, … # it is an example
ruby setup.rb setup
ruby setup.rb install
In your case, do this:
$ sudo ruby setup.rb config --with=dbi,dbd_mysql
$ sudo ruby setup.rb setup
$ sudo ruby setup.rb install
I hope that this helps,
Raul
Raul,
I tried this, but I got the following error in step 2:
ruby extconf.rb
extconf.rb:1:in `require’: no such file to load – mkmf (LoadError)
from extconf.rb:1
The error is from the require ‘mkmf’ line in the extconf.rb script. How
can I find out what that is and where to get it?
Thanks again…
Raul P. wrote:
Peter V. wrote:
Raul,
Thanks the reply. Before I got your reply, I installed the DBI package
so that I could write Ruby scripts that access MySQL databases. When I
attempt to run a test script, I get the
following error:/usr/local/lib/site_ruby/1.8/dbi.rb:344:in
load_driver': Could not load driver (no such file to load -- mysql) (DBI::InterfaceError) from /usr/local/lib/site_ruby/1.8/dbi.rb:227:in
_get_full_driver’
from /usr/local/lib/site_ruby/1.8/dbi.rb:213:in `connect’
from /root/bin/simple.rb:6I used the instructions at this link:
www.kitebird.com/articles/rubi-dbi.html
I noticed you mentioned something about one step you mentioned not being
clear in the kitebird article, do you think that might be my problem?
If not, do you have any idea how I’d go about figuring out what the fix
for this error is?
Thanks again,
PVPeter, just follow the 3 steps I listed, in their order: in particular,
step 2 (which installs the DRIVER msyql.rb) is the one which will solve
the problem.Good luck
Raul
Raul P. wrote:
Peter V. wrote:
Raul,
I tried this, but I got the following error in step 2:ruby extconf.rb
extconf.rb:1:in `require’: no such file to load – mkmf (LoadError)
from extconf.rb:1The error is from the require ‘mkmf’ line in the extconf.rb script. How
can I find out what that is and where to get it?
Thanks again…
Peter,
Sorry for that ‘sudo’ (it is for the Mac). On Linux, just do:
$ ruby setup.rb config --with=dbi,dbd_mysql
$ ruby setup.rb setup
$ ruby setup.rb install
Peter,
what os are you running?
sounds like you need to install the ruby1.8-dev package
should be something simple like
apt-get install ruby1.8-dev
http://rubyforge.org/forum/forum.php?thread_id=4161&forum_id=4050
I tried your latest suggestion, but I get the same error. I figure that
something probably got mixed up when I attempted the initial
installation. I don’t know how to do it, but it might be best to remove
everything related to the Ruby dbi and start over. What do you think?
I appreciate your assistance.
Raul P. wrote:
Raul P. wrote:
Peter V. wrote:
Raul,
I tried this, but I got the following error in step 2:ruby extconf.rb
extconf.rb:1:in `require’: no such file to load – mkmf (LoadError)
from extconf.rb:1The error is from the require ‘mkmf’ line in the extconf.rb script. How
can I find out what that is and where to get it?
Thanks again…Peter,
Sorry for that ‘sudo’ (it is for the Mac). On Linux, just do:
$ ruby setup.rb config --with=dbi,dbd_mysql
$ ruby setup.rb setup
$ ruby setup.rb install
try typing these two commands
sudo apt-get install build-essential
sudo apt-get install ruby1.8-dev
this should give you the mkmf.rb file in the proper location
then you can use the extconf.rb for installing the ruby-mysql module
Kristopher,
I’m running Ubuntu 7.04
PV
Windham, Kristopher R. wrote:
Peter,
what os are you running?sounds like you need to install the ruby1.8-dev package
should be something simple likeapt-get install ruby1.8-dev
http://rubyforge.org/forum/forum.php?thread_id=4161&forum_id=4050