lost and found ( for me ? )

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

install dnsperf 2.0 on Linux Mint 12


dnsperf is DNS stressing tool provide by Nominum.

You can get it from the following URL.
http://www.nominum.com/resources/measurement-tools

As for RHEL , there are RPM packages for RHEL4 i386 , RHEL 5 i386 , RHEL6 x86 64.
As for Debian based , there are no deb packages.
I’ll install this on Linux Mint 12 from the source.
# tail -1 /etc/lsb-release
DISTRIB_DESCRIPTION="Linux Mint 12 Lisa"

# uname -ri
3.0.0-17-generic x86_64


download the source
dnsperf-src-2.0.0.0-1.tar.gz
# tar xzvf dnsperf-src-2.0.0.0-1.tar.gz
# cd dnsperf-src-2.0.0.0-1/


Seen from README , BIND 9.4.0 or greater need to be installed to compile dnsperf 2.0
1. Make sure that BIND 9 (9.4.0 or greater) is installed, including libraries
  and header files, and that the isc-config.sh program distributed with BIND
  is in your path.


Befre installing dnsperf 2.0 , I’ll install BIND 9.9.0
# tar xzvf bind-9.9.0.tar.gz bind-9.9.0/
# cd bind-9.9.0/
# ./configure
# make
# make install
# /usr/local/sbin/named -V
BIND 9.9.0 built with defaults
using OpenSSL version: OpenSSL 1.0.0e 6 Sep 2011


install dnsperf 2.0
# cd dnsperf-src-2.0.0.0-1/
# sh configure


nnn , error .. there’s no hmacsha.h: ..
# make
gcc -g -O2 -I/usr/local/include -D_GNU_SOURCE -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DHAVE_LIBNSL=1 -DHAVE_PTHREAD=1 -pthread -c dnsperf.c
dnsperf.c: In function ‘main’:
dnsperf.c:1041:7: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
dnsperf.c: In function ‘do_send’:
dnsperf.c:668:7: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
dnsperf.c: In function ‘handle_sigint’:
dnsperf.c:197:7: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
gcc -g -O2 -I/usr/local/include -D_GNU_SOURCE -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DHAVE_LIBNSL=1 -DHAVE_PTHREAD=1 -pthread -c datafile.c
gcc -g -O2 -I/usr/local/include -D_GNU_SOURCE -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DHAVE_LIBNSL=1 -DHAVE_PTHREAD=1 -pthread -c dns.c
dns.c:46:25: fatal error: isc/hmacsha.h: No such file or directory
compilation terminated.
make: *** [dns.o] Error 1


Senn from README , it describes that:
Note: many versions of bind do not correctly install the <isc/hmacsha.h>
  header file, so if the compilation fails, obtain this file from the BIND
  source distribution, and install it in the appropriate place.


where is hmacsha.h …
# locate hmacsha.h
/home/zzz/my_works/bind-9.9.0/lib/isc/include/isc/hmacsha.h


and which directory should I put it ??

under /usr/local/include/isc directory ?
# ls /usr/local/include/isc/
app.h            hex.h            netaddr.h        sha2.h
assertions.h     hmacmd5.h        netdb.h          sockaddr.h
atomic.h         httpd.h          offset.h         socket.h
base64.h         int.h            once.h           stdio.h


copy hmacsha.c to /usr/local/include/isc directory.
# cp /home/zzz/my_works/bind-9.9.0/lib/isc/include/isc/hmacsha.h /usr/local/include/isc


try again
# sh configure


okay.
# make
gcc -g -O2 -I/usr/local/include -D_GNU_SOURCE -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DHAVE_LIBNSL=1 -DHAVE_PTHREAD=1 -pthread -c dns.c
gcc -g -O2 -I/usr/local/include -D_GNU_SOURCE -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DHAVE_LIBNSL=1 -DHAVE_PTHREAD=1 -pthread -c log.c
gcc -g -O2 -I/usr/local/include -D_GNU_SOURCE -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DHAVE_LIBNSL=1 -DHAVE_PTHREAD=1 -pthread -c net.c
gcc -g -O2 -I/usr/local/include -D_GNU_SOURCE -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DHAVE_LIBNSL=1 -DHAVE_PTHREAD=1 -pthread -c opt.c
gcc -g -O2 -I/usr/local/include -D_GNU_SOURCE -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DHAVE_LIBNSL=1 -DHAVE_PTHREAD=1 -pthread -c os.c
ar rv libperf.a datafile.o dns.o log.o net.o opt.o os.o
ar: creating libperf.a
a - datafile.o
a - dns.o
a - log.o
a - net.o
a - opt.o
a - os.o
ranlib libperf.a
gcc -pthread dnsperf.o  libperf.a -lnsl  -L/usr/local/lib -lbind9 -ldns -lcrypto -lisccfg -lisc -ldl  -lm -o dnsperf
gcc -g -O2 -I/usr/local/include -D_GNU_SOURCE -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DHAVE_LIBNSL=1 -DHAVE_PTHREAD=1 -pthread -c resperf.c
gcc -pthread resperf.o  libperf.a -lnsl  -L/usr/local/lib -lbind9 -ldns -lcrypto -lisccfg -lisc -ldl  -lm -o resperf
#

# make install
mkdir -p /usr/local/bin
mkdir -p /usr/local/share/man/man1
/usr/bin/install -c  dnsperf /usr/local/bin
/usr/bin/install -c  resperf /usr/local/bin
/usr/bin/install -c  resperf-report /usr/local/bin
/usr/bin/install -c -m 644  dnsperf.1 /usr/local/share/man/man1
/usr/bin/install -c -m 644  resperf.1 /usr/local/share/man/man1


get things done :)
# ls /usr/local/bin/*perf
/usr/local/bin/dnsperf  /usr/local/bin/resperf

Linux KVM : connect to a Linux Mint12 VM via virsh console


small tips


how to use virsh console.

KVM host : Ubuntu 11.10
VM : Linux Mint 12

[ on the KVM host (Ubuntu 11.10 ) ]

confirm the VM has serial ports.
# virsh dumpxml Mint12-64-1 | less
   <serial type='pty'>
     <source path='/dev/pts/5'/>
     <target port='0'/>
     <alias name='serial0'/>
   </serial>
   <console type='pty' tty='/dev/pts/5'>
     <source path='/dev/pts/5'/>
     <target type='serial' port='0'/>
     <alias name='serial0'/>


[ on the VM ( Linux Mint 12 ) ]

make /etc/init/ttyS0.conf file
# cat /etc/init/ttyS0.conf
start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]

respawn
exec /sbin/getty -L 115200 ttyS0 vt 102


“start ttyS0”
# start ttyS0
ttyS0 start/running, process 703


edit /boot/grub/grub.cfg

By default , grub.cfg is read-only permission.
add write permission.
# chmod u+w /boot/grub/grub.cfg


edit grub.cfg ( add red lines )
menuentry 'Linux Mint 12 64-bit, 3.0.0-16-generic (/dev/vda1)' --class linuxmint
--class gnu-linux --class gnu --class os {
       recordfail
       set gfxpayload=$linux_gfx_mode
       insmod gzio
       insmod part_msdos
       insmod ext2
       set root='(hd0,msdos1)'
       search --no-floppy --fs-uuid --set=root e1679c23-ba3c-4d9f-9d02-b2a3d69b
5af4
       linux   /boot/vmlinuz-3.0.0-16-generic root=UUID=e1679c23-ba3c-4d9f-9d02
-b2a3d69b5af4 ro   quiet splash vt.handoff=7 console=ttyS0,115200n8
       initrd  /boot/initrd.img-3.0.0-16-generic


reboot the VM.

connect to the VM via virsh console
virsh # console Mint12-64-1
Connected to domain Mint12-64-1
エスケープ文字は  ^] です

Compile QEMU-KVM on Linux Mint 12 64bit ver.


Here’s an explanation of how to switch from the KVM installed via apt-get to the KVM building from the source.
I’ve installed the KVM ( kvm , libvirtd , virt-manager ) via apt-get and it works well.

This explanation is:

Use KVM kernel modules installed via apt-get ( kvm , kvm_intel or kvm_amd )
Use qemu-kvm built from the source.
# uname –ri
3.0.0-14-generic x86_64

# tail -1 /etc/lsb-release
DISTRIB_DESCRIPTION="Linux Mint 12 Lisa"

# kvm –version  <- installed via apt-get
QEMU emulator version 0.15.0 (qemu-kvm-devel), Copyright (c) 2003-2008 Fabrice Bellard

# libvirtd –version <- installed via apt-get
libvirtd (libvirt) 0.9.2

# virt-manager –version <- installed via apt-get
0.9.0


- the preparation before building qemu-kvm from source

Install the following packages via apt-get to build qemu-kvm.
# LANG=C apt-get install gcc gcc-4.6 libsdl1.2-dev make libz-dev uuid-d
ev libasound2-dev gcc libc6-dev zlib1g-dev linux-headers-3.0.0-14
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'zlib1g-dev' instead of 'libz-dev'
gcc is already the newest version.
gcc-4.6 is already the newest version.
libc6-dev is already the newest version.
make is already the newest version.
zlib1g-dev is already the newest version.
The following extra packages will be installed:
 libaa1-dev libaudio-dev libaudiofile-dev libavahi-client-dev
 libavahi-common-dev libcaca-dev libdbus-1-dev libdrm-dev libesd0-dev
 libgl1-mesa-dev libglu1-mesa-dev libkms1 libncurses5-dev libpulse-dev
 libslang2-dev libtinfo-dev libxt-dev mesa-common-dev
Suggested packages:
 libasound2-doc ncurses-doc
The following NEW packages will be installed:
 libaa1-dev libasound2-dev libaudio-dev libaudiofile-dev libavahi-client-dev
 libavahi-common-dev libcaca-dev libdbus-1-dev libdrm-dev libesd0-dev
 libgl1-mesa-dev libglu1-mesa-dev libkms1 libncurses5-dev libpulse-dev
 libsdl1.2-dev libslang2-dev libtinfo-dev libxt-dev mesa-common-dev uuid-dev
0 upgraded, 21 newly installed, 0 to remove and 0 not upgraded.
Need to get 5447 kB of archives.
After this operation, 25.2 MB of additional disk space will be used.
Do you want to continue [Y/n]? y


Get the latest KVM source ( qemu-kvm-1.0.tar.gz ) from http://sourceforge.net/projects/kvm/files/
# ls
qemu-kvm-1.0.tar.gz


- compile qemu-kvm

qemu-kvm does not include kvm-kmod ( KVM kernel modules )
I use KVM kernel modules which I have installed via apt-get.
# tar xzvf qemu-kvm-1.0.tar.gz
# cd qemu-kvm-1.0/

# ./configure --prefix=/usr/local/kvm
KVM support       yes
# make
# make install

# ls /usr/local/kvm/*
/usr/local/kvm/bin:
qemu-ga  qemu-img  qemu-io  qemu-nbd  qemu-system-x86_64

/usr/local/kvm/etc:
qemu

/usr/local/kvm/share:
qemu

# /usr/local/kvm/bin/qemu-system-x86_64 --version
QEMU emulator version 1.0 (qemu-kvm-1.0), Copyright (c) 2003-2008 Fabrice Bellard


make sure your OS has loaded KVM kernel modules.
# lsmod | grep kvm
kvm_intel              61643  0
kvm                   383781  1 kvm_intel


- start the VM with qemu-kvm 1.0

I’ve already had the VM ( CentOS 6.2 ) , so I’ll fly this VM with qemu-kvm 1.0.
# /usr/local/kvm/bin/qemu-system-x86_64 -m 1024 -hda /var/disk1/libvirt/images/centos6-vm1.img -monitor telnet::4444,server,nowait -vnc :0 –daemonize


- Connect to the VM via VNC

check the PID of the VM.
# ps aux | grep qemu-system | grep centos
/usr/local/kvm/bin/qemu-system-x86_64 -m 1024 -hda /var/disk1/libvirt/images/centos6-vm1.img -monitor telnet::4444,server,nowait -vnc :0 –daemonize

check the listen ports
# lsof -np 25904 | grep -i tcp
qemu-syst 25904 root    3u  IPv4 2434434         0t0      TCP *:4444 (LISTEN)
qemu-syst 25904 root   14u  IPv4 2432962         0t0      TCP *:5900 (LISTEN)


TCP port 5900 is for VNC access ( -vnc :0 )
TCP port 4444 is for qemu-monitor access. (-monitor telnet::4444,server,nowait )

start VNC viewer
$ vncviewer 127.0.0.1::5900  ( or vncviewer 127.0.0.1:0 )



- access to the qemu monitor via telnet
# telnet 127.1 4444
Trying 127.0.0.1...
Connected to 127.1.
Escape character is '^]'.
QEMU 1.0 monitor - type 'help' for more information
(qemu) info vnc
Server:
    address: 0.0.0.0:5900
       auth: none
Client:
    address: 127.0.0.1:49941
 x509_dname: none
   username: none
(qemu) info version
1.0.0 (qemu-kvm-1.0)
(qemu) info status
VM status: running
(qemu) info kvm
kvm support: enabled
(qemu) system_powerdown
(qemu) Connection closed by foreign host.


- memo

The binary file of qemu-kvm installed via apt-get is /usr/bin/kvm which is the symbolic link file of /usr/bin/qemu-system-x86_64.
# ls –l /usr/bin/kvm  ( install via apt-get )
lrwxrwxrwx 1 root root  /usr/bin/kvm -> qemu-system-x86_64

# ls -l /usr/bin/qemu-system-x86_64 ( install via apt-get )
-rwxr-xr-x 1 root root  /usr/bin/qemu-system-x86_64


The binary file of qemu-kvm built from the source is /usr/local/kvm/bin/qemu-system-x86_64
# ls /usr/local/kvm/bin/qemu-system-x86_64 ( built from the source )
/usr/local/kvm/bin/qemu-system-x86_64