Tuesday, 9th February 2010.

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)

Posted on Sunday, 29th November 2009 by Balazs

Problem

It is necessary for some users to have all their traffic directed through the OpenVPN concentrator. The number one reason for such a configuration is to protect the HTTP traffic over unsecured WiFi (a.k.a. hotspots).

Solution

Add to the bottom of the connecting client’s configuration file (typically under /etc/openvpn/clients.d the following line:
push "redirect-gateway"

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

Posted on Friday, 6th November 2009 by Balazs

Summary

The AIX NIM server allows a very flexible automated installation process to deploy hundreds or AIX nodes as well as LPARs in a matter of hours. It is possible to achieve similar results using the RHEL kickstart system. This article is about a way of automating the RHEL 5 deployment directly from AIX 6.1 NIM.

Process

  • Copy the RHEL 5 DVD to an NFS file system. E.g. /nfs/rhel5
  • Configure the NIM server to offer the correct boot image in /etc/bootptab:

    rhel-host1.domain.com:bf=/nfs/rhel5/images/netboot.img:ip=xxx.xxx.xxx.xxx:ht=ethernet::sa=xxx.xxx.xxx.yyy:sm=255.255.255.0:
    rhel-host2.domain.com:bf=/nfs/rhel5/images/netboot.img:ip=xxx.xxx.xxx.zzz:ht=ethernet::sa=xxx.xxx.xxx.yyy:sm=255.255.255.0
  • Configure TFTP on the NIM server in /etc/tftpaccess.ctl:

    # NIM access for network boot
    allow:/usr/lpp/sysback/netinst/boot
    allow:/tftpboot
    allow:/nfs/rhel5/images
  • Restart TFTP and reload INETD:

    stopsrc -s tftpd
    startsrc -a -n -s tftpd
    refresh -s inetd
  • Boot the network client with SMS: remote ip setup (with client ip, server ip, router ip, subnet mask, ping test), multiboot setup (with ethernet as first boot device)
  • Follow the regular RHEL install process. (This is where you can get kickstart going.)
  • Reboot the system and reset the boot order.

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