Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

2008-04-23

Part 2: Drupal 6.2 and DB2 Express-C 9.5 on Ubuntu 7.10

This is part 2 in my series on getting Drupal 6.2 and DB2 Express-C 9.5 to play nicely with each other. In the first part, I installed DB2 Express-C 9.5. In this part, I'll look at getting Apache/PHP5 setup and DB2 working from within PHP.

Step 1: Configuring DB2. There were some additional configuration steps needed for DB2, which are detailed on the developerWorks forum. There were some superfluous steps, but the worst you're going to do is overwrite something with the same thing. In particular, all the user accounts were set up already. If you're not familiar with DB2, you can issue commands from the shell, in the form of:

db2 "create database testdb"
but just make sure you're running these commands as the user db2inst1, or you source db2inst1's db2profile. If you can create `testdb`, then DB2 is working correctly.

Step 2: Install Apache httpd 2.2 and PHP 5.2. The Ubuntu Guide has information on setting up Apache and PHP, but the quick and dirty steps are:
sudo apt-get install apache2
sudo apt-get install php5 libapache2-mod-php5
sudo /etc/init.d/apache2 restart
Step 3: Install DB2 support for PHP. There is a PECL module for IBM DB2, which can be installed with PHP's PEAR (PHP Extension and Application Repository, like apt-get for Ubuntu).
sudo apt-get install php-pear
sudo pecl install ibm_db2
When I first ran this, I got the error: "sh: phpize: not found". After doing a quick search, I realized that I needed the PHP development files to be able to compile the DB2 driver:
sudo apt-get install php5-dev
After the module is compiled, it will ask you where your installation of DB2 is. In my experience, it wouldn't believe me when I told it where DB2 was installed to. Luckily, it ended up not mattering. When you get to this part of the PECL install, just hit Ctrl-C.

Next, I needed to configured PHP to use the IBM DB2 driver. In `/etc/php5/apache2/php.ini`, go to the extension section and add:
extension_dir="/opt/ibm/db2/V9.5/dsdriver/php32"
extension="extension=ibm_db2_5.2.1.so"
Note: correct the path if you have your module installed somewhere else; do a `locate ibm_db2_5.2.1.so`)

After making the changes, I reloaded Apache:
sudo /etc/init.d/apache2 reload
Verify that the module is loaded by making a quick PHP page in /var/www/ with the content:
<?php phpinfo(); ?>
and make sure there's a DB2 driver loaded. I started playing around with DB2 in PHP, but it was getting late and I decided to put that off for another day. IBM has some information on developing PHP5 for DB2, but it's barebones at best. I'll post a sample script next time.

Ok, so at this point, I have Apache, PHP, and DB2 Express-C 9.5 all installed and playing well with each other. In the next article in this series, I'll look at getting Drupal 6.2 to use DB2 on the back end.

2008-04-22

Part 1: Drupal 6.2 and DB2 Express-C 9.5 on Ubuntu 7.10

DrupalFinally! It's been far too long since I've had an interesting project to work on. With a couple of sites I might have to make in the foreseeable future, it's time to investigate what I can do with stuff available today. There's a couple of reasons I've hit upon Drupal 6.2 and DB2 Express-C 9.5:


  • Silicon Valley Lab had it's inaugural meeting of the SVL Linux Users Group this morning. I recognize that this is extremely nerdy, and even nerdier to be so excited about it. But the turnout for the SVLLUG's first, unstructured, sort of planning event was about 50 people. Now, to put this in perspective, at any one point in time, I've had about five friends interested in Linux. 50? All of which who are guaranteed to be on campus eight hours a day, five days a week? I'm certainly going to take advantage of it!

  • Seriously, I work for DB2. If I can't get this database to work with Drupal, I will pester people until I have it working, and then I'll blog about it.

  • With MySQL drifting away from open source (come back MySQL! Come back!), I don't see a whole lot of reason to use it. MySQL doesn't exactly have the most cutting edge features (native XML support), and if it's free in the same sense as DB2, why not? IBM has always supported Drupal (15 part series!)

  • I recently read an article comparing Django and Drupal. I've used Drupal for a couple of web sites in the past, and been happy overall. The problem always ended up being with 3rd party modules, but I'd rather have an architecturally sound framework than something flashy that won't last.
Anyway, first thing's first:
  1. Download DB2 Express-C V9.5 for Ubuntu: it's as easy as `sudo apt-get install db2exc`, but you can find more information on Ubuntu's DB2 Virtual Appliance Page

  2. Download Drupal 6.2

  3. Install Apache httpd with PHP support

  4. Install DB2 driver for PHP
Ok, in the time it took to write that post, DB2 Express-C has downloaded and installed. Time to start playing; next post will be how to do steps 3 and 4.

2007-12-16

LaCie Ethernet Big Disk and Linux

With graduation impending, I wanted to get as much out of college as possible -- that is, of media from the local network. I bought a LaCie Ethernet Big Disk because of it's capacity (1 TB), it's accessibility (both USB 2.0 and Gigabit Ethernet), and the name of LaCie (I seemed to remember them being good from back in my hardware days. To boot, they claim "full Linux Support" (see link to their product page).

As soon as I got it, I tried the USB connection and got:

[ 5565.628000] usb 5-3: new high speed USB device using ehci_hcd and address 5
[ 5565.764000] usb 5-3: configuration #1 chosen from 2 choices
[ 5565.764000] eth1: register 'cdc_ether' at usb-0000:00:1d.7-3, CDC Ethernet Device, 00:d0:4b:9d:82:e4

I didn't really want to bother with understanding that, so I got the MAC registered on the network, mounted it with cifs, and went to town.

Flash forward to two weeks later: I'm at my parents house with no sort of network to speak of, am bored, and want to start accessing all of the goodies on my Ethernet Big Disk. I started poking around in Wireshark to see what was going on over eth1; here is the dump file. Some things I noticed:

  • The first thing I got from it was: `BROWSER Host Announcement GADGET, Workstation, Server, Print Queue Server, Xenix Server, NT Workstation, NT Server, Potential Browser`, so it remembers the hostname I set on it (Gadget). It broadcasted that from 10.208.75.100, so I figured that would be it's IP address. Tried connecting to it... no dice.

  • The next thing I got were some malformed ARP broadcast packets from LaCieGro_9d:82:e4 (00:d0:4b:9d:82:e4). That matches the MAC address on the real Ethernet port, so I suppose that makes sense.



Anyway, 10.208.75.100 seems to be the magic keyword to find out more about using this device in Linux. In the meantime, I'm going to post resources I found that have been useful:



The Storage Review site turned up two interesting bits of information I didn't know about the device:
Connect hidden page [https://IP_LACIE/ssh_controlF.cgi

User: root
Pass: storage [or defaulf of your LaCie]


I'm going to try these addresses in Windows (the SSH Control could be particularly useful -- I was using a Metasploit attack on the ProFTPd 1.30 server on board to root the box. This may be easier!)

Update:
I couldn't get the ssh_controlF.cgi page to work, nor the root/storage account. Interestingly enough, I don't have permission to STOR or MKDIR from my admin account when I FTP into it.

I did get connectivity working in Linux! From Windows, I went to the admin site for the drive and changed the IP address to 192.168.0.100 (192.168.2.* is my other network), and gave myself a static IP of 192.168.0.99 on that interface. Then, from Linux, the drive showed up as eth1, so I set eth1 to 192.168.0.99 as well, and was able to successfully mount it over CIFS. I think had I just gave myself a static IP for eth1 from the first place, it would have worked (maybe LaCie could put this on their support page?)