Sunday, September 11, 2011

xen image on CentOS 5

yum install xen
vi /boot/grub/menu.lst change default=0

Install Hudson

yum install java
java -version
cd /usr/share/
mkdir hudson
cd hudson/
java -jar hudson.war

Monday, June 20, 2011

Install Sun Java on Ubuntu 11.04

1. sudo add-apt-repository "deb lucid partner"

2. sudo apt-get update

3. sudo apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk

4. set JAVA_HOME=/usr/lib/jvm/java-6-sun

5. set PATH=$JAVA_HOME/bin:$PATH

6. java -version

Sunday, April 24, 2011

Mount NTFS disk to CentOS 5.5

1. Find out the hardware platform:
uname -i

2. Download the rpmforge-release package.

i386 -
x86_64 -

3. Install GPG key:
rpm --import

4. Install the package.
rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm

5. Install fuse-ntfs-3g packages.
yum install fuse fuse-ntfs-3g

6. Check the NTFS partition.
fdisk -l

7. Create the mount point.
mkdir /mnt/windows

8. Mount the NTFS disk.
mount /dev/sdb1 /mnt/windows

Saturday, April 16, 2011

Use At to run repeated task

Following is an example,, to run script at /home/pwong every 3 minutes within 12 hours period.


if [ ! -f off_time ]; then
date --date="+12 hours" +"%k" > off_time

if [ `date +%k` -eq `cat off_time` ]; then
rm off_time
exit 1

sleep 60

cd $WorkDir

at -f +3 minutes

exit 0

Install and Test SNMP on CentOS 5.5

1. Install net-net-snmp and net-snmp-utils
# yum install net-snmp-utils

2. Create /etc/snmp/snmpd.conf. Following is a very simple example for the testing.

rocommunity public
syslocation "ABC, ABC Inc."

3. Startup snmpd server
# /etc/init.c/snmpd start

4. Ues snmpwalk to test SNMP setup.
# snmpwalk -v 1 -c public -O e 127.0.0

# snmpwalk -v 1 -c public localhost system

If something similar to the following show up on the screen, the SNMP is working.

SNMPv2-MIB::sysDescr.0 = STRING: Linux localhost.localdomain 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:35 EDT 2010 i686
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (977) 0:00:09.77
SNMPv2-MIB::sysContact.0 = STRING:
SNMPv2-MIB::sysName.0 = STRING: localhost.localdomain
SNMPv2-MIB::sysLocation.0 = STRING: "ABC, ABC Inc."

5. If someting is wrong, check /etc/snmpd/snmpd.conf for error. Following commands can be used for troubleshooting as well. If everything is fine, then firewall settings should be checked.
# /etc/init.d/snmpd status
# snmpd -f -Le

6. Enable the snmpd starts up when the system reboot.
# chkconfig snmpd on

Friday, April 15, 2011

Mysqldump Performance Issue

When dumping really big tables, mysqldump was using up large amounts of memory, so it may cause no-response problem. To overcome this, --quick and --single-transaction options can used. Following are the sections for these options in the mysqldump man page.

--quick, -q
This option is useful for dumping large tables. It forces mysqldump to retrieve rows for a table from the server a row at a time rather than retrieving the entire row set and buffering it in memory before writing it out.

To dump big tables, you should combine this option with --quick.

Sunday, April 3, 2011

Use Remote Variables with Rsh or Ssh

Followng are the difference between local and remote variables. $PWD is the local variable passed to remote system, but \$PWD is the variable defined in the remote system.

/home/patrickw/tools $ sudo ssh host "echo $PWD"

/home/patrickw/tools $ sudo ssh host "echo \$PWD"

Therefore, backslashes in the following example is necessary. Without the backslashes, awk will complain syntax error since the variables are blank.

sudo ssh host "top -b -n 1 | egrep sudo\|ssh\|xinet | awk '{print \$1, \$9, \$10, \$12}'"

Thursday, March 10, 2011

Xen on CentOS

yum install xen yum install xen

yum install xen


Monday, February 28, 2011

Install OpenNMS with postgreSQL 9 on CentOS 5.5

  1. yum install yum-fastestmirror
  2. rpm -Uvh
  3. wget
  4. rpm -i pgdg-centos-9.0-2.noarch.rpm
  5. yum install postgresql90-server postgresql90-devel
  6. /etc/init.d/postgresql-9.0 initdb
  7. vi /var/lib/pgsql/9.0/data/pg_hba.conf, to change ident to trust for all local, IPv4, and IPv6.
  8. vi /var/lib/pgsql/9.0/data/postgresql.conf to modify work_mem, vacuum_cost_delay, wal_buffer, checkpoint_segment, etc to meet your need.
  9. /etc/init.d/postgresql-9.0 restart
  10. createdb -U postgres opennms
  11. wget
  12. tar xfz iplike-2.0.0.tar.gz
  13. cd iplike-2.0.0
  14. ./configure --with-pgsql=/usr/pgsql-9.0/bin/pg_config
  15. make
  16. make install
  17. /usr/local/sbin/
  18. psql -U postgres -h localhost -d opennms -c '\df+ iplike|head'
  19. yum install opennms --nogpgcheck
  20. /opt/opennms/bin/runjava -s
  21. /opt/opennms/bin/install -dis
  22. /etc/init.d/opennms start
The OpenNMS page is at http://localhost:8980/opennms/login.jsp. Both initial user name and password are admin.

Friday, January 28, 2011

Add local disk to Xenserver 5.5 running under VMware

1. Find the new disk name.
fdisk -l

2. Create physical volume.
pvcreate /dev/hdb

3. Find out the name of the disk.
ll /dev/disk/by-id/
lrwxrwxrwx 1 root root 9 Jan 28 22:18 ata-VMware_Virtual_IDE_Hard_Drive_01000000000000000001 -> ../../hdb

4. Create SR.
xe sr-create type=lvm content-type=user device-config:device=/dev/disk/by-id/ata-VMware_Virtual_IDE_Hard_Drive_01000000000000000001 name-label=”LOCAL DISK

After the running above command, the LOCAL DISK will be in Xenserver's Storage Repositories.

Note: You can name your own name-label.