Friday, 12th March 2010.

Posted on Tuesday, 16th February 2010 by Balazs

Problem

In order to manage the 3ware raid controller under Linux, an embedded web server needs to be installed. 3ware provides a download-able tarball on their site, however, the installation on Lenny is problematic. The following steps explain how to get the install and the configuration done.

Solution

  • Edit /etc/apt/sources.list and add the following lines:
    # 3Ware
    deb http://jonas.genannt.name/debian lenny restricted
  • # wget -O - http://jonas.genannt.name/debian/jonas_genannt.pub | apt-key add -
  • # apt-get update
  • # apt-cache search 3ware
  • # aptitude install 3ware-3dm2-binary 3ware-cli-binary
  • # cd /etc/3dm2
  • # cp 3dm2.conf 3dm2.conf-dist
  • Edit 3dm2.conf set :
    RemoteAccess 1
  • # /etc/init.d/3dm2 restart
  • Browse to https://yourhost:888/
  • Select 3DM 2 Settings and change the default password 3ware to something secure. If you lock yourself out, you can copy the original config file back in place as it has the default password.

References

Tags: , , ,
Posted in Linux | Comments (Comments)

Posted on Wednesday, 10th February 2010 by Balazs

Problem

An OpenVZ host can share any part of its filesystem with any guest operating system running on it. This post describes how to manually mount a filesystem tree from the host OpenVZ box to a guest, and how to automate the process. We will also address an error that can happen with a correctly configured file preventing the automated mount process.

Solution

Manual mount

To mount a filesystem tree to any guest from the host, run the following:
mount --bind /path/to/tree/on/host ${VE_ROOT}/path/to/tree/on/guest

You need to replace ${VE_ROOT} with /var/lib/vz/root/<guest id>

Automate the mount

There is two options to automate the mount: automation for each guest and automation for a specific guest. The file looks the same either way. For setting up a mount on each guest, use vps.mount and vps.umount as the file names. To use automated mount for a specific guest, use the the filename that is <guest id>.mount and <guest id>.umount. For example, if your container id for your virtual private server (guest) is 123, then the specific files to set the mount and unmount code for are 123.mount and 123.umount. This is how the .mount file needs to look:

#!/bin/bash
source /etc/vz/vz.conf
source ${VE_CONFFILE}
echo "Starting ${VEID}.mount..."
mount --bind /path/to/tree/on/host ${VE_ROOT}/path/to/tree/on/guest
echo "...${VEID}.mount complete"

And this is how the .umount file needs to look:

#!/bin/bash
source /etc/vz/vz.conf
source ${VE_CONFFILE}
echo "Starting ${VEID}.umount..."
umount ${VE_ROOT}/path/to/tree/on/guest
echo "...${VEID}.umount done"

Note that the echo is necessairy, otherwise, the filesystem will most likely not mount correctly. This is due to the fact that on start and restart the vzctl program will call umount first, and if that script fails (returns a non zero exit code) the .mount script isn’t called. Thus, if the directory isn’t mounted and there isn’t an echo at the end of the script, the script returns the exit code of the last command which in this case is the exit code from the failed umount command.

References

Tags: , , ,
Posted in Linux | Comments (Comments)

Posted on Monday, 25th January 2010 by Balazs

Summary

Patching AIX can be intimidating at first for someone coming from the Windows / Linux world. AIX has capabilities that natively support production quality operations. One of these qualities is that one can install patches on an alternative volume, make that volume bootable for testing and allowing an easy way out if something doesn’t work right. Since AIX 5.3, it is also possible to install patches on the same volume as the boot volume and define boot profiles to boot at a certain patch level. In this post we will just look at the basics of patching, emulating the equivalent of “yum update” or the “windows express update” (taking Linux / Windows as analogy).

Steps

  • Download available patches for current technology level:
    smitty suma <Enter>
    Download Updates Now (Easy) <Enter>
    Download All Latest Fixes <Enter> <Enter>
  • Install patches:
    smitty update_all
    specify INPUT device: /usr/sys/inst.images/installp/ppc <Enter>
    go down to "ACCEPT new license agreements?" <Tab> (to switch to "yes") <Enter> <Enter>

That’s it. You can reboot in case there were kernel updates or APARs that recommend a reboot. To check the current patch level, you can run oslevel -s.

Tags: , , , , ,
Posted in AIX | Comments (Comments)

Posted on Friday, 22nd January 2010 by Balazs

Introduction

Cacti is a great tool to graph performance of the various hardware components of a network. With the use of the yum repository manager, it is very simple to install on Red Hat Enterprise Linux 5 or CentOS 5.

Install steps

  • First make sure that you have the dag repository configured in yum. Edit or create the file /etc/yum.repos.d/dag.repo:
    [dag]
    name=Dag RPM Repository for Red Hat Enterprise Linux
    baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
    gpgcheck=0
    enabled=1
    protect=0
  • Now install the required packages:
    sudo yum install net-snmp mysql mysql-server cacti
  • Edit the /etc/httpd/conf.d/cacti.conf file to allow access to cacti as needed.
  • Make sure Apache and MySQL are started and set to start automatically:
    sudo service mysqld start
    sudo service httpd start
    sudo chkconfig –level 345 mysqld on
    sudo chkconfig –level 345 httpd on
  • Set up the cacti database in MySQL:
    sudo mysqladmin –user=root create cacti
    cd /var/www/cacti
    sudo mysql cacti < cacti.sql
    sudo mysql --user=root mysql
    mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY ‘cactiuser’;
    mysql> SET PASSWORD FOR cactiuser = PASSWORD('my_super_secret_cacti_password');
    mysql> flush privileges;
    mysql> exit
    sudo mysqladmin –user=root password "my_super_secret_root_password"
  • Setup the cacti poll schedule in /etc/crontab:
    */5 * * * * cacti php /var/www/cacti/poller.php > /dev/null 2>&1
  • Run the cacti installer in the browser:
    http://your.server.com/cacti/index.php
    provide the user and password for the database, you can accept all defaults and just click next
  • That is it, you are good to go.

References

Installing Cacti on CentOS with yum

Tags: , ,
Posted in Linux | Comments (Comments)

Posted on Thursday, 21st January 2010 by Balazs

Summary

DB2 Express C 9.5 is now available on OS X. As a result OS X developers do not need to use a virtual machine any longer to be able to run DB2 in their favorite development environment. And what more, the latest version available for download also works on Snow Leopard (OS X 10.6).

Installation Steps

Antonio Cangiano (see below) has created very good step by step instructions, as well as a demo of the install process. Here are a couple of issues one might encounter:

  • I recommend setting up a separate DB2 user to own the db2 install, for example db2inst1
  • After the install or the first start, DB2 might freeze, and prevent any connections. You might need to kill the db2* processes and start DB2 again.
  • Remember to source the environment required to run DB2 command line tools:
    . sqllib/db2profile
  • Profile can be loaded automatically by adding the above line to .bash_profile in your home directory
  • Allow all admin users to access the DB2 instance:
    db2 update dbm cfg using sysadm_group Admin
  • When trying db2fs, it will crash on Firefox 3, the easiest fix is to download and old version of Firefox, and give the path to that version when prompted by db2fs
  • Make sure TCP/IP service in correctly configured in /etc/services and in DB2:
    db2 update dbm cfg using SVCENAME db2c_db2inst1
    db2set DB2COMM=tcpip
  • Add catalog entries for your remote databases:
    db2 catalog tcpip node DBNAME remote db2box.domain.com server 5000X

References

Tags: , , ,
Posted in DB2, Mac OS X | Comments (Comments)

Posted on Thursday, 21st January 2010 by Balazs

Problem

How to view folders from the Mac that hosts the VMWare Fusion guest operating system CentOS or Red Hat Linux?

Solution

  • First, make sure that the VMWare Tools are installed. That always helps.
  • Next, in the WMWare configuration menu of the guest, set up the desired shared folders. There might be already a default shared folder pointing to the user’s home directory.
  • Next, in the guest OS, ls -ld /mnt/hgfs will display the available shared folders.

References

[CentOS-virt] CentOS 5.1 guide for VMware Fusion

Tags: , , , , ,
Posted in Linux, Mac OS X | Comments (Comments)

Posted on Thursday, 21st January 2010 by Balazs

Problem

On Max OS X, when trying to connect to an OpenVPN gateway, you may encounter the following error:
2010-01-21 05:14:59 write UDPv4: Can't assign requested address (code=49)
2010-01-21 05:15:01 write UDPv4: Can't assign requested address (code=49)
...

The error would repeat itself indefinitely.

Root Cause

The TCP stack of the Mac has a bug that can cause the routing table to get corrupted.

Solution

The routing table needs to be flushed on the interface used to connect to the Internet. Typically,

  • en0: ethernet (wired) interface
  • en1: wlan (wireless) interface

The easiest way is to flush the routes is to reboot. The elegant way however is to shut down the interface connecting the Mac to the Internet, flush the routing table, and bring the interface back up. For example, assuming a wired connection, open a terminal or an X11 xterm window and issue the following commands:
sudo ifconfig en0 down
sudo route flush
sudo ifconfig en0 up

In case the command line hangs after the flush command, just open a new terminal and run the last command from there. When you are done, you can close all terminals. If you are connecting with wireless, replace en0 with en1.

References

OpenVPN error: write UDPv4: Can’t assign requested address (code=49)

Tags: , ,
Posted in Mac OS X | Comments (Comments)

Posted on Monday, 18th January 2010 by Balazs

Joshua Kramer has an article in LJ about Qpid and AMQP. One of the most compelling aspects of Qpid is its cross plaform and cross language capability. Finally there is a message broker that is easy to use and has ready to go clients for C++, Java, Python, Ruby and .Net. Take a look and let me know what you think.

Tags: , ,
Posted in Java | Comments (Comments)

Posted on Tuesday, 29th December 2009 by Balazs

I have posted a number of tips to use DB2. If you haven’t used DB2 before, it is one of the best databases out there, and best of all, it is available completely free from IBM. Get your DB2 discovery kit from IBM. As Grant Allen puts it in Beggining DB2, “IBM has even thought of those of you who can’t get to their website to obtain DB2. You can e-mail or telephone IBM’s DB2 team to arrange to have the Discovery Kit shipped to you.”



Tags: ,
Posted in DB2 | Comments (Comments)

Posted on Thursday, 17th December 2009 by Balazs

Problem

Even though XML schema has been around for a decade, still many APIs reference a DTD in the XML documents sent back and fourth. Such is the OpenSRS API. DB2 requires an XML schema or a DTD to be registered before it will process XML documents that refer to an XML Schema or a DTD. The process of registering such XSROBJECTs with DB2 has changed in DB2 since version 8.

Solution

  • register a DTD using the DB2 9.7 command line:
    db2 CONNECT TO SAMLE
    db2 REGISTER XSROBJECT 'dtd-file-name.dtd' FROM /path/to/dtd/file AS sample.dtd-name DTD

    If the command is successful, the output is
    DB20000I The REGISTER XSROBJECT command completed successfully.
  • Register a DTD from a Java program:
    String schemaName = "SAMPLE";
    String dtdName = "dtd-name";
    String dtdFile = "dtd-file-name.dtd";
    Reader fis = new FileReader(dtdFile);
    byte[] contentDtd = FileIO.readerToString(fis).getBytes();
    String registerProcQuery = "CALL SYSPROC.XSR_DTD (?,?,?,?,?)";
    PreparedStatement registerProcStatement = conn.prepareCall(registerProcQuery);
    registerProcStatement.setString(1, schemaName);
    registerProcStatement.setString(2, dtdName);
    registerProcStatement.setString(3, dtdFile);
    registerProcStatement.setString(4, "PUBLIC ID");
    registerProcStatement.setObject(5, contentDtd, java.sql.Types.BLOB);
    registerProcStatement.execute();

    The FileIO class can be found in Java Cookbook, Second Edition

References


Tags: , , , , , ,
Posted in DB2 | Comments (Comments)