First question here is: why would I want to install the Oracle database on debian? Well, there is very much to say about that, but, in essence: I very much like debian. And I could tell you, of course, about the brilliant packaging system, debian being true free software, debian being standards based, easy upgrading and security updates, the merry help from the community, but I don’t. I just happen to like debian.
Second question is: why in a xen user domain? Well, that’s very obvious for me:
-the userdomain I describe here is build in a logical volume. the logical volume can very easy and very fast being copied to a second one, and voila: I have a second, seperate machine.
-the userdomain can be snapshoted at any time, so we can have a ‘frozen’ image of a domain. comes in very handy when testing or when trailing errors.
-I can use a single piece of metal for running various versions of linux (yes, also the bsd’s and solaris, but I do not run that now), running various versions of oracle (each running different patchlevels and CPU’s (the infamous Cummulative Patch Update)). Very handy for investigating quality and stability.
-When software alters files or something, and needs to be recovered (in testing or investigation), it’s very convenient to use the snapshot possiblities of LVM.
This is how I create a debian/sarge domU in a logical volume. There are more versions of this description (in fact, that is how got to know the trick), but they have little omissions which do not give me what I want (like being unable to use swap because the block special device is missing in /dev)
nb. dom0 is called ‘server’, the domU to be created is called ‘sarge’.
nb. this version is simplified. I install the oracle software in a seperate logical volume, so I can use a single installation with different o/s installs.
1. create logical volume for the root:
frits@server:~# sudo lvcreate -n sarge-root -L 5G /dev/vg00
2. create logical volume for swap:
frits@server:~$ sudo lvcreate -n sarge-swap -L 1G /dev/vg00
3. create ext3 filesystem on the root logical volume:
frits@server:~$ sudo /sbin/mkfs.ext3 /dev/vg00/sarge-root
4. create swap:
frits@server:~$ sudo /sbin/mkswap /dev/vg00/sarge-swap
5. mount root logical volume:
frits@server:~$ sudo mount /dev/vg00/sarge-root /mnt/install
6. install sarge using debootstrap:
frits@server:~$ sudo debootstrap sarge /mnt/install http://ftp.nl.debian.org/debian
7. alter the feshly installed server:
frits@server:~$ cd /mnt/install/dev
frits@server:~$ sudo ./MAKEDEV tty1 tty2 tty3 tty4 tty5 tty6
frits@server:~$ sudo ./MAKEDEV sda
frits@server:~$ cd ../etc
frits@server:~$ sudo vi fstab
here we put the following rows, so we mount the minimal three things:
proc /proc proc defaults 0 0
/dev/sda1 / ext3 defaults,errors=remount-ro 0 1
/dev/sda2 none swap sw 0 0
frits@server:~$ cd network
frits@server:~$ sudo vi interfaces
here we put the following rows, so we activate localhost and our public ip address:
iface lo inet loopback
iface eth0 inet dhcp
next we configure the last few things before we boot our virtual host ‘sarge’:
frits@server:~$ cd ..
frits@server:~$ sudo echo "sarge" > hostname
frits@server:~$ sudo printf "127.0.0.1\tlocalhost\n192.168.0.18\tsarge\n" > hosts
As we see on the last line, 192.168.0.18 is the address I have gotten from my dhcp server.
8. The filesystem is now configured for booting as root-filesystem. Next we have to define a host for xen, which looks like this (name of the file needs to be the name of machine, in order to start it by name with xen):
kernel = "/boot/vmlinuz-126.96.36.199-xenU"
memory = 512
name = "sarge"
vif = [ 'mac=aa:00:00:00:00:15, bridge=xenbr0' ]
disk = [ 'phy:vg00/sarge-root,sda1,w','phy:vg00/sarge-swap,sda2,w' ]
root = "/dev/sda1 ro"
extra = "4"
9. Next, we start our new host ‘sarge’:
frits@server:~$ sudo xm create sarge -c
The experienced xen user will notice I have forgotten to move the /lib/tls directory. Well, I have done that on purpose! Xen will complain about the “normal” tls version and warn us.
After the complaint, our machine will boot nicely and we get a prompt. We log in as root, and set a password. (root needs to have a password, especially because we get public access shortly!) After that, we finish the configuration using ‘base-config’.
10. Next we have to modify the ‘/etc/apt/sources.list’ file. Apparently, base-config puts the following line:
deb http://ftp.nl.debian.org/debian/ testing main
Which results in downloading packages of etch, instead of sarge. So we alter the line to:
deb http://ftp.nl.debian.org/debian/ stable main non-free
(we add ‘non-free’ to it too, because we need some packages out of non-free in a short while)
Refresh the apt cache and renew our new system:
sarge:~# apt-get update
sarge:~# apt-get upgrade
11. Next we alter the sources list once more, in order to get a xen-friendly libc. Add the following line to /etc/apt/sources.list:
deb http://www.hodek.net/debian sarge roman
After that, refresh the apt cache, and get the xen-friendly libc:
sarge:~# apt-get update
sarge:~# apt-get install libc6-i686
At this point, we got a working version of debian/sarge, with the bare minimum of packages. This is a good point to save a copy of the root logical volume, in order to be able to start with an installed and configured debian/sarge installation.
Because we want to install the oracle database server on our debian host ‘sarge’, we get on configuring it.
12. Because the ssh daemon is not a part of the bare minumum packages of debian, we have to install it:
sarge:~# apt-get install ssh
After this installation, review the ssh_config and sshd_config in /etc/ssh, in order to be able to use X-tunneling. This way we are able to get a ssh session to sarge, and can conveniently tunnel our X connection through it. No messing with xhost for me 🙂
13. We need to have a X environment, because of the graphical installation of the oracle software. So we install it:
sarge:~# apt-get install x-window-system
14. There are some reports of errors during the link phase of the installations due to incorrect version of libaio. The most simple (and elegant) way to get this, is from oracle itself. We add the oracle repository to /etc/apt/sources.list by inserting the following line:
deb http://oss.oracle.com/debian unstable main non-free
Next we refresh our apt cache and install libaio:
apt-get install libaio
15. Because we got a minimized version of the install, we have installed less than a default debian/sarge installation. One of the missing things (which gives a nice little error message during linktime:)
Error in invoking target 'ntcontab.o' of makefile '/oracle/db/10201/network/lib/ins_net_client.mk'
is libc6-dev. So we install it:
apt-get install libc6-dev
16. Next a whole bunch of other needed software:
apt-get install gcc make binutils libmotif3 lesstif2 rpm
At this point, we can do the oracle installation. There are no error messages or other faults during the install. I have used a nfs share exported from dom0 with the software.
17. Follow this link to go to Graham Williams description of installing oracle on debian.