Community Dashboard

10
Apr

Princess and the ClearOS Module - Part 2 of 4

Posted by on in ClearFoundation
  • Font size: Larger Smaller
  • Hits: 9302
  • 0 Comments
  • Print

In Part 1, we found an ideal solution in Philesight for determining where our disk space usage is being consumed.  In part 2, we'll get this software installed on our ClearOS server and functioning.

Put on your developer hat (no, not that kind of developer), and let's get started. Unfortunately, due to this being a 4 part blog, at some point, I'm going to have to assume a base level of technical knowledge.  Accessing the Unix command line, basic shell commands and using a text editor falls into that 'required knowledge' category.  If you're really new to Linux and have yet to jump into to the command line, you'll find some useful resources here, here and here.

Most software for Linux will have dependencies.  A dependency means the software you are intent on installing requires (or is dependent on) other software having been installed correctly, and of a compatible version.  Rather than re-writing a library to perform some task that's already been written, developers are naturally lazy beings and will jump through hoops not to create work for themselves.  Hence, they rely on other software libraries, applications or even languages to be installed, in order for their 'widget' to function properly.

Installing software on a Linux distribution can really be a quick turn-off to a new user coming from the Windows world when one gets into dependency hell.  In part 4 of this series, our goal will be to make installing this module simple (i.e. one click on a page in Webconfig). For now, because we're breaking new ground on this module, we need to follow the installation requirements listed on the Philesight website so that it will function correctly.

The Philesight webpage indicates the following recommendation for a RedHat/CentOS (and hence, ClearOS) Linux distro (note - I don't actually recommend following the instructions quoted directly below since there are alternatives to adding repositories, which I do detail further along in the post):

"I've been told the following should work on RedHat/Centos"

# yum -y update
# cd /etc/yum.repos.d/
# wget http://centos.karan.org/kbsingh-CentOS-Extras.repo
# wget http://ruby.gfd-dennou.org/products/rpm/RPMS/CentOS/CentOS-DennouRuby.repo
# yum -y --enablerepo=kbs-CentOS-Testing install ruby bitmap-fonts ruby-bdb ruby-cairo

The first four commands above essentially add repositories (software equivalent of your public library) that contain the packages required by the Philesight program.

A package is an efficient way of 'wrapping up' a software module.  In fact, our ultimate goal in this blog series is to create a package for ClearOS that will remove all the brain-damage we're about to go through to get Philesight installed on ClearOS.

As ClearOS is based on CentOS (no room for confusion there, eh?), and CentOS is based from source code from RedHat, all three distributions share the same file format for package management, the RPM.  The fifth and final line of the instructions indicates four packages (or RPMs) are required:

  • ruby
  • bitmap-fonts
  • ruby-bdb
  • ruby-cairo

ClearOS has a significant number of packages mirrored from the CentOS project - but not all, since it's a designated server platform, with no interest in desktop functions.  Our first goal is to see which ones we can install immediately from our native repository.  YUM is a package manager...it makes installing modules much easier because it has the AI to figure out which packages have dependencies - and which of those have dependencies and so on, and so on.  You can see how easily you could slip into dependency hell doing this manually.  So, using YUM, let's try installing ruby:

 yum install ruby
Loading "protect-packages" plugin
Loading "kmod" plugin
base-kernels                                             |  951 B     00:00
 ...~~~...
 Total download size: 1.9 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): ruby-libs-1.8.5-5.el5_4.8.i386.rpm               | 1.6 MB     00:08
(2/2): ruby-1.8.5-5.el5_4.8.i386.rpm                     | 274 kB     00:01
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: ruby-libs                    ######################### [1/2]
Installing: ruby                          ######################### [2/2]
Installed: ruby.i386 0:1.8.5-5.el5_4.8
Dependency Installed: ruby-libs.i386 0:1.8.5-5.el5_4.8
Complete!

As Borat would say, "Great success!".

Let's press our luck...No Whammies!

 yum install bitmap-fonts
Loading "protect-packages" plugin
Loading "kmod" plugin
Setting up Install Process
Parsing package install arguments
 ...~~~...
 (1/1): bitmap-fonts-0.3-5.1.1.noarch.rpm                 | 906 kB      00:10
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: bitmap-fonts                 ######################### [1/1]
Installed: bitmap-fonts.noarch 0:0.3-5.1.1
Complete!

Too easy.  Alas, our reality check hits with the last two RPMs which we'll need to do a bit of work for.  True, we could follow the instructions exactly and add the repository, but since we're going to eventually add any required packages to the ClearOS default (or at the very least, 'extras', repository), we'll try downloading and installing these packages manually.

The package ruby-cairo was part of the CentOS-DennouRuby repository.  I downloaded and installed the RPM by doing the following:

cd /tmp
wget http://ruby.gfd-dennou.org/products/rpm/RPMS/CentOS/5/i386/ruby-cairo-1.4.1-1dc.i386.rpm
rpm -ivh ruby-cairo-1.4.1-1dc.i386.rpm

Similarly, the package ruby-bdb was part of the kbsingh-CentOS-Extras repository, so I ran:

wget http://centos.karan.org/el5/extras/testing/i386/RPMS/ruby-bdb-0.6.0-1.el5.kb.i386.rpm
rpm -ivh ruby-bdb-0.6.0-1.el5.kb.i386.rpm

In theory, those two RPM's could have had dependencies which we'd need to go track down and install, but fortunately, it wasn't the case.  The end result means we'll need to submit two packages (ruby-cairo and ruby-bdb) for inclusion into the ClearOS repository in order make this module a one click install.

With the dependencies out of the way, we can now get to the business of installing Philesight.
Staying in the /tmp directory, we grab the tgz (compressed archive) file and extract its contents in our temporary directory:

wget http://zevv.nl/play/code/philesight/philesight-20091214.tgz
tar -xzvf philesight-20091214.tgz

Almost time for a beer - we've got some celebrating to do.  Reading the README file, let's try creating a database file of our directory starting at the root path using the philesight tool:

cd /tmp/philesight-20091214
./philesight --db test.db --index /

I peeked at the configuration lines in philesight.cgi, so I know it's looking for a database file in /tmp/ps.db.  Let's move our newly created database file there:

mv test.db /tmp/ps.db

Now to view it...we know we're going to want to use Webconfig's Apache engine since our ultimate goal is to display the tool in Webconfig.  Let's copy the required Philesight files to Webconfig's CGI directory:

cp philesight.* /var/webconfig/htdocs/cgi/

The moment of truth...a drum roll please (note, your 'system.lan' might vary, depending on your server configuration - use the internal IP, if necessary) while we add the following URL into our browser address bar:

https://system.lan:81/cgi/philesight.cgi

Whoa!  Forget a beer...better make that a two-four.

When I've recovered from my hang over...part 3 of Princess and the ClearOS - integrating what we've accomplished so far into Webconfig.

Cheers,

Ben 

0
Df43e790f3b1e7a2e9fcde4024b123ce Medium
Ben Chambers has not set their biography yet

Message Author | Add as friend | View author's profile | Show more posts from author | Subscribe to updates from author

Achievements

  • Bookworm
  • The Voice

Overall Rating (0)

0 out of 5 stars
  • No comments found