Howto Install Windows XP / Vista on Xen

This short guide describes how to install Windows XP or Windows 2003 Server on Xen. It provides an overview of the Debian Linux Etch installation, and detailed steps for installing and configuring Xen and starting the Windows XP or Windows 2003 Server
installation.

Requirements

  • CPU with either Intel’s Vanderpool (IVT – Intel Virtualization Technology) orAMD’s Pacifica Technology (AMD virtualization)
  • Windows iso-image

First you need to install Xen on Debian Etch:

sudo apt-get install xen-linux-system-2.6.18-4-xen-686 libc6-xen bridge-utils

Boot into the newly installed Xen enabled Linux kernel

sudo reboot

Then adjusted the network settings in /etc/xen/xend-config.sxp. Enabling the network bridge:

(network-script network-bridge)

Install Xen IO Emulation tools:

sudo apt-get install xen-ioemu-3.0.3-1

Create a directory for the virtual machine files e.g. /home/xen/domains/win01 and create a disk image for the virtual machine’s primary disk.

mkdir /home/xen
mkdir /home/xen/domains
mkdir /home/xen/domains/win01
sudo dd if=/dev/zero of= /home/xen/domains/win01/disk.img bs=1M count=4096

Establish a Xen machine Configuration file (/etc/xen/win01.cfg) like this

kernel = '/usr/lib/xen/boot/hvmloader'
builder = 'hvm'
memory = '256'
device_model='/usr/lib/xen/bin/qemu-dm'

# Disks
disk = [ 'file:/home/xen/domains/win01/disk.img,ioemu:hda,w',
'file:/home/cc/iso-images/WindowsXP-SP2/image.iso,ioemu:hdc:cdrom,r' ]

# Hostname
name = ‘win01′

# Networking
vif = ['type=ioemu, bridge=xenbr0']

# Behaviour
boot='d'
vnc=1
vncviewer=1
sdl=0

The ready to fire up the new machine and start the Windows installation in a vnc terminal.

xm create win01.cfg

After the virtual machine is started – a VNC server port should be available on port 5900 at the Xen server’s IP, e.g. 192.168.1.102 – A VNC XEN Client session is depicted here.

If an error like this shows up

Error: Device 0 (vif) could not be connected. Backend device not found.

You should check your that you have enabled the network bridge, “(network-script network-bridge)”, in /etc/xen/xend-config.sxp and restarted the xen deamon by /etc/init.d/xend restart

For more on creating Xen virtual machines read this guide, which outlines the features of the xen-tools package.

Comments

MySQL Optimization and Performance Tips

    • Store IP addresses as INT, not CHAR – by using INET_ATON to convert from a string to an integer and by using INET_NTOA to convert from an integer to a string
    • Use non-persistent connection, since they are light-weight – much faster create than compared Oracle or PostgreSQL
    • Use the right storage engine; this means for example the ARCHIVE-engine for logs and other kind of INSERT-only operations, and the MEMORY-engine for fast in-memory data that should go away on server restart

More general MySQL optimization and performance tips are available in this Slideshow.

Comments off

Howto: Create your own Debian or Ubuntu package repository

The Debian package management system (called Advanced Packaging Tool or APT) is by far the most well-designed and is one of the top killer features on the Linux platform.

This short Howto describes howto establish a Debian package repository for home-grown deb-packages or like (could be used for Ubuntu as well, since Ubuntu uses the Debian package management system).

Establish repository structure
Create the repository structure in a directory. E.g. in ~/public_html directory exposed to the web.


cd public_html
mkdir my-repository
cd my-repository
mkdir binary
mkdir source

Copy your deb-packages into the repository

Like this
cp src/bzr_0.11-1.1_all.deb public_html/my-repository/binary/

Install the tools to be able to create a repository index

sudo aptitude install dpkg-dev

Create a repository index
cd my-repository
dpkg-scanpackages binary /dev/null | gzip -9c > binary/Packages.gz
dpkg-scansources source /dev/null | gzip -9c > source/Sources.gz

Using the repository


# Add these two lines into the /etc/apt/sources.list
deb http://mediakey.dk/~cc/my-repository binary/
deb-src http://mediakey.dk/~cc/my-repository source/

Feel free to comment – easier methods and tips are more than welcome ;)

For a more professional package management setup, use reprepro

Comments

Ubuntu Howto: Install Oracle

Installing Oracle on Ubuntu is fairly easy, since Oracle has created a Debian and Ubuntu package repository, so it is possible to download and install the Oracle database softwareusing apt-get and aptitude.

Howto use the Oracle Debian and Ubuntu Repository:

Add the following lines to the /etc/apt/sources.list

# Oracle Repository
deb http://oss.oracle.com/debian unstable main non-free

Update the package repository database with:

cc@ray:~$ sudo apt-get update

Now you should be able to install the following Oracle software:

  • libaio
  • oracle-xe-client
  • oracle-xe
  • oracle-xe-universal

Install the Oracle Express packages

sudo aptitude install oracle-xe oracle-xe-client

Configure using:

sudo /etc/init.d/oracle-xe configure

Access the nice Oracle web interface by pointing your Firefox to:

http://127.0.0.1:8080/apex

 

Updated:
The installation process might report that the Oracle packages are not gpg signed, but you should be able to install the packages anyway.

You can avoid this report by added the Oracle gpg-public key to your apt-key chain

wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle -O- | sudo apt-key add -

Read more on Oracle and Debian and Ubuntu here

Comments off

Xen Howto: Install Windows

This short guide describes how to install Windows XP orWindows 2003 Server on Xen. It provides an overview of theDebian Linux Etch installation, and detailed steps for installing and configuring Xenand starting the Windows XP or Windows 2003 Server
installation.

Requirements

  • CPU with either Intel’s Vanderpool (IVT – Intel Virtualization Technology) orAMD’s Pacifica Technology (AMD virtualization)
  • Windows iso-image

First you need to install Xen on Debian Etch:

sudo apt-get install xen-linux-system-2.6.18-4-xen-686 libc6-xen bridge-utils

Boot into the newly installed Xen enabled Linux kernel

sudo reboot

Then adjusted the network settings in /etc/xen/xend-config.sxp. Enabling the network bridge:

(network-script network-bridge)

Install Xen IO Emulation tools:

sudo apt-get install xen-ioemu-3.0.3-1

Create a directory for the virtual machine files e.g. /home/xen/domains/win01 and create a disk image for the virtual machine’s primary disk.

mkdir /home/xen
mkdir /home/xen/domains
mkdir /home/xen/domains/win01
sudo dd if=/dev/zero of= /home/xen/domains/win01/disk.img bs=1M count=4096

Establish a Xen machine Configuration file (/etc/xen/win01.cfg) like this

kernel = '/usr/lib/xen/boot/hvmloader'
builder = 'hvm'
memory = '256'
device_model='/usr/lib/xen/bin/qemu-dm'

# Disks
disk = [ 'file:/home/xen/domains/win01/disk.img,ioemu:hda,w',
'file:/home/cc/iso-images/WindowsXP-SP2/image.iso,ioemu:hdc:cdrom,r' ]

# Hostname
name = ‘win01′

# Networking
vif = ['type=ioemu, bridge=xenbr0']

# Behaviour
boot='d'
vnc=1
vncviewer=1
sdl=0

The ready to fire up the new machine and start the Windows installation in a vnc terminal.

xm create win01.cfg

After the virtual machine is started – a VNC server port should be available on port 5900 at the Xen server’s IP, e.g. 192.168.1.102 – A VNC XEN Client session is depicted here.

If an error like this shows up

Error: Device 0 (vif) could not be connected. Backend device not found.

You should check your that you have enabled the network bridge, “(network-script network-bridge)”, in /etc/xen/xend-config.sxp and restarted the xen deamon by /etc/init.d/xend restart

For more on creating Xen virtual machines read this guide, which outlines the features of the xen-tools package.

Comments off

Optimize MySQL for Low Memory Use

MySQL is a light database engine compared tomany of it’s rivals, but for some reason theDebian MySQL-server package contains a setup that makes it very heavy and memory consuming. The Debian version of becomes memory consuming because it comes with config file where MySQL’s most memory consuming and seldom used storage engine InnoDB is enable. As result of this the MySQL server instance uses around 100MB of memory while almost idle.

And here comes the optimization tip.

Since the InnoDB storage engine is used very seldom it can be disable in most cases and let the server save almost about 100MB of memory.

To disable to InnoDB storage engine add this to my.cnf (the default MySQLconfiguration files) in /etc/mysql/
skip-innodb

More on MySQL and Apache optimization and here

Comments off

Installing Xen on Debian Etch 4.0

For a long time I have tested many different virtualization techniques; Xen, VMWare, and Microsoft VM. Until now I’m able to conclude that all of them are usable on my desktop machine, but bothVMWare and Microsoft’s VM are more sluggish that Xen. This weekend I deployed my first server based on the upcoming Debian Etch andXen. Everything worked out of the box.

Here is what I did to install Xen on Debian Etch:

sudo apt-get install xen-linux-system-2.6.18-4-xen-686 libc6-xen bridge-utils

Boot into the newly installed Xen enabled Linux kernel

sudo reboot

Then adjusted the network settings in /etc/xen/xend-config.sxp. Enabling the network bridge:

(network-script network-bridge)

Install xen-tools:

apt-get install xen-tools

Xen tools is a collection package containing different tools related to Xen, a virtual machine creator etc.

Edit adjust the kernel and initrd parameters in /etc/xen-tools/xen-tools.conf to match the ones on your system:

Find out what the kernel image and initrd is named by:

ls /boot/vmlinuz*
/boot/vmlinuz-2.6.18-4-686 /boot/vmlinuz-2.6.18-4-xen-686

and

ls /boot/initrd*
/boot/initrd.img-2.6.18-4-686 /boot/initrd.img-2.6.18-4-686.bak /boot/initrd.img-2.6.18-4-xen-686

Adjust the lines

#
# Default kernel and ramdisk to use for the virtual servers
#
kernel = /boot/vmlinuz-2.6.18-4-xen-686
initrd = /boot/initrd.img-2.6.18-4-xen-686

Further adjust the xen-tools.conf to this settings:

dir = /home/xen
debootstrap = 1
size = 4Gb # Disk image size.
memory = 128Mb # Memory size
swap = 128Mb # Swap size
fs = ext3 # use the EXT3 filesystem for the disk image.
dist = etch # Default distribution to install.
image = sparse # Specify sparse vs. full disk images.

Create a home for all the coming virtual Xen guests:

mkdir /home/xen
mkdir /home/xen/domains

And then ready to create a virtual machine – guest, simply by:

xen-create-image -hostname=mailserver -ip=10.0.0.21 -netmask=255.255.255.0 -gateway=10.0.0.1 -passwd

Afterwards I was able to fire up the newly created virtual machine with:

xm create mailserver.cfg

If an error like this shows up

Error: Device 0 (vif) could not be connected. Backend device not found.

You should check your that you have enabled the network bridge, “(network-script network-bridge)”, in /etc/xen/xend-config.sxp and restarted the xen deamon by /etc/init.d/xend restart

When up and running either “xm list” or “xentop” can be used to get an overview of what instance are currently running

debian5:# sudo xm list
Name                                      ID Mem(MiB) VCPUs State   Time(s)
Domain-0                                   0      874     1 r-----    657.9
mailserver                                 3      128     1 -b----      8.0

Based on my experiences so far with virtualization and deploying virtualization in a enterprise setup, I really think that Xen is a very strong asset for Linux and Linux based distributions to show the world what they are up to. Virtualization is really a technique for enterprise server and data center managers to make a more robust and simplified setup, and I think that virtualization could play a significant role within the server market the coming years.

Comments

Howto PHP / Java bridge on Debian

Updated 20. Marts 2007

The PHP / Java Bridge makes it possible to run use java objects within your PHP code. For example; let’s say you have a jar-file containing some functionality you may want to use in a PHP application.

To use this you must have a Java installed – either the latest version of Java (JDK) or a black hawk version installed.

Get the source code php-java-bridge_3.0.4.tar.bz2 from the PHP / Java bridge website and unpack it with

wget http://switch.dl.sourceforge.net/sourceforge/php-java-bridge/php-java-bridge_3.0.8.tar.bz2


tar xvjf php-java-bridge_3.0.4.tar.bz2


cd php-java-bridge-3.0.4


phpize - in order to use this you'll need to have the php5-dev package installed


./configure --with-java=/usr/lib/j2sdk1.5-sun - be sure to set this to the path where the Java installation is located

If the ./configure command fails because the automake version is less than 1.6 try this

apt-get install automake1.6
update-alternatives --config automake

Select version 1.6 of automake in the update-alternatives dialog and then try to run ./configure again

Now we just need to compile and install, this is done by:

make
make install-modules

Add this line to php.ini in order to enabled the PHP/Java bridge extension:

extension=java.so

Comments off

BisonCam ( ALi M5603C ) Linux driver round up

I have written this as a round up on my search for a Linux driver for the built-in webcam in my Asus A3N series notebook. The built-in webcam in my book is built on a micro chip from Ali and it is named m5603c, more in general the chip is sometimes refered to as m560x. I found that this m560x chip is used in a lot of different devices and even other notebooks like the Asus A6 series.

Right now – it seems that there are a few projects focusing on creating a driver for m560x chip, currently I have noticed these ones.

  • SANE m5603c backend
  • Ali M560x Linux Driver Project
  • ALi USB2 M5603C Video Camera Controller – Seems stalled

Until now I have assembled this list of devices that are build upon the m560x chip.

  • Asus Z9100G notebook series
  • Sweex webcam
  • Asus A6 notebook series
  • Q-TEC Webcam 300 USB 2.0
  • Trust SpaceC@m 360
  • Creative Live Pro
  • USB 2.0 Webcam 1.3 Megapixel
  • Genius VideoCam Slim USB2

Please leave a comment – if you know a device or driver project not listed here

Comments