Sunday, June 29, 2008

Installing Oracle 10g on Ubuntu Hardy Heron

I'm now working in a client site. One of the differences is that each development desktop bears a smug "Ubuntu - Linux for human beings" sticker. This is the first time I have really tangled with Linux. I'm not going to risk the wrath of Verity Stob by detailing my journey into the heart of the penguin. But I thought it would be worthwhile documenting my experiences with installing Oracle 10gR2 on Ubuntu 8.04 (AKA Hardy Heron).

Ubuntu is touted as a user-friendly flavour of Linux, and certainly the graphical desktop is welcoming to people used to Windows. However things get pretty gnarly pretty quickly as soon as you want to do anything off piste. And Oracle is not supported on Ubuntu ( the supported distros are Suse, RHEL, Asialux and Oracle's own Unbreakable Linux) things go very off piste indeed. In the absence of official documentation we're thrown on the resources of the internet. There is lots of information out there - the sort of people who love Linux are the sort of people who love the web - but it is often written with a presumption of familiarity in Linux. In amongst the shedloads of helpful advice there are opaque sentences such as this): "to install lesstif2 you will need to use 'Adept' to enable the universe repository or edit /etc/apt/source.list" (unfairly quoting Todd Trichler out of context). I know I should have devoted myself to studying the Linux architecture before I started but I really needed to install Oracle now.

The first guide Google turned up was Luca Mearelli's Installazione di Oracle 10g su Ubuntu Linux which as you might have guessed is written in Italian. I found this quite distracting as anything in that language sounds like opera.
Madame Butterfly. Act 2. Scene 1.Whilst she awaits the return of Lt Pinkerton Koko-chan amuses herself by installing Oracle on different Linux distros. She sings the aria Impostazione dei parametri del kernel.
It was the setting of kernel parameters which drew me up short. There was no explanation (and even if there had been, my Italian would not have been up to translating it). Should I be changing kernel values on the say-so of a random Google hit?

So I surfed a bit more and found Installing 11g on Ubuntu Hardy Heron by Pythian's Augusto Bott. This article is so good that it has been ripped off by plagiarising sites. Augusto's guide included the same changes to the same kernel parameters as Luca's guide but it included explanations (through a link to his earlier article about installing Oracle 11g on Ubuntu Feisty Fawn). Although he wrote his guide for 11g it works just as well for 10g. There were still a few things which caused me some puzzlement and I will discuss those below.

I wasted a lot of time trying to install 64-bit Oracle (because we have 64-bit desktops). I could download it and run the Installer but I couldn't get OUI to link the database packages. The problem is:


INFO: /usr/bin/ld: skipping incompatible
/u01/app/oracle/product/10.2.0/db_2/lib/libsql10.a
when searching for -lsql10


After a couple of hours fruitlessly downloading further packages I gave up and tried 32-bit, which worked first time without a hitch.

Annotations for Augusto Bott's guide


Step 3 applied because I was installing on the Ubuntu desktop. The gotcha is in the innocuous statement "You will have to restart your Xserver for this change to take effect." The Ubuntu desktop environment is X so the simplest way of doing this is to logout and login again. However I only discovered this fact after I issued the following command in a terminal window:
sudo /etc/init.d/gdm stop
Theoretically this should have just dumped me out to a text-mode command prompt. It didn't quite work that way so I had to resort to a hard reboot. Incidentally, another way to get out of the graphical environment is ALT+CTRL+F1 while ALT+CTRL+F7 gets you back again.

In Step 8 the wise man will take a backup of these files just in case. The suggested values seem to be common across all the install guides I read, so I trusted them :) Given that I was only installing locally I didn't bother setting the network parameters.

Step 9 is the actual install of the software. Oracle's Universal Installer is a Java applet, which is why we need to change the X Windows settings. If you have trouble with this step first make sure you have done Step 3 properly. However I still got the OUI-10025 message. More Googling threw up this piece of voodoo, which solved the problem:


clarkea@clarkea-desktop:~$ export DISPLAY=:0.0
clarkea@clarkea-desktop:~$ sudo su - oracle
Your account has expired; please contact your system administrator
su: User account has expired
(Ignored)
oracle@clarkea-desktop:~$ export DISPLAY=:0.0
oracle@clarkea-desktop:~$ xhost +
access control disabled, clients can connect from any host
oracle@clarkea-desktop:~$

If xhost or xclock works then you can run OUI.

The OUI wizard is slightly different in 10g. In particular it doesn't prompt for ORACLE_BASE and it defaults the paths to hang off your $HOME directory. You may want to change the location to /u01/app.

For me the actual install and linking process did not take nearly as long as Augusto suggests it will. Obviously our machines are a lot more powerful than his :)

Finally, if you apply the scripts Augusto suggests you will need to change the paths to point to 10.2.0 instead of 11.1.0.

To apply the 10.2.0.4 patch you just need to repeat the process.

Further References


Augusto's earlier article on installing on Ubuntu Feisty Fawn (which has some additional explanation of the parameter tweaking)

Oracle Release for 10gR2 on Linux note

Oracle Install Guide for RHEL4 and SLES9

6 comments:

Anonymous said...

I take the easy way out and, unless you need all of the enterprise features, just use XE on my Ubuntu machine. The installation instructions are even provided by Oracle, you can find them here.

Unknown said...

It got mentioned in the comments on Augusto's blog, but not in the instructions: make sure that you run apt-get install xorg on your server. This provides a x server for the Universal Installer to send a UI to your console machine. Without it, you get a lot of java errors about libXtst.so.6 not found. Don't ask ...

mystang said...

One of the package names is misleading because of the font. It looks like it begins and ends with an l (or lower case L)but the final character is actually a 1 (the digit representation of the number one).

The package name is:

libaio1

mystang said...

The step 9 help didn't seem to work for me. I used the following link to solve the "unable to open display issue"

http://rossov.com/2006/02/10/xhost-unable-to-open-display/

here is the answer incase the link "dies":

#
# vmware - user running GUI
#
vmware@ubuntu:~$ xauth extract /tmp/xauth.key $DISPLAY && chmod 644 /tmp/xauth.key
vmware@ubuntu:~$ su - oracle
Password:
oracle@ubuntu:~$ xauth merge /tmp/xauth.key
xauth: creating new authority file /home/oracle/.Xauthority
oracle@ubuntu:~$ xhost +
access control disabled, clients can connect from any host

mystang said...

Ran into another issue:

INFO: Creating /opt/oracle/product/10gR2/lib/liborasdkbase.so.10.2
INFO: gcc:
INFO: /usr/lib/libstdc++.so.5: No such file or directory
INFO:
INFO: /opt/oracle/product/10gR2/bin/genorasdksh: Failed to link liborasdkbase.so.10.2
INFO: make: *** [liborasdkbase] Error 1
INFO: End output from spawned process.
INFO: ———————————-
INFO: Exception thrown from action: make
Exception Name: MakefileException
Exception String: Error in invoking target ‘all_no_orcl ihsodbc’ of makefile ...

found the solution here:

http://blog.fekw.de/2008/06/10/oracle-database-10g-r2-on-kubuntu-804-32bit/

which was that you MUST have this exact package installed or you get the error above:

libstdc++5

Anonymous said...

Thanks for the great tutorial. I followed Augusto's tutorial, which you reference, to the letter - including using the defaults - and it worked perfectly. Installed 11gR1 on Hardy 8.04 Server.

I used the startup scripts you so graciously provided. Also worked perfectly.

I like the Enterprise Manager Web UI to start at boot-time, so a few simple mods will start it up at boot time:

1.) Set your ORACLE_SID environment variable at the top of the script, just under the commented-out header:
export ORACLE_SID=your_oracle_sid_here

2.) In the "start)" section, just below the other two lines starting with "su $ORACLE_OWNR..." place the following line:
su $ORACLE_OWNR -c "$ORACLE_HOME/bin/emctl start dbconsole"

3.) In the "stop)" section, just *above* the other two "su $ORACLE_OWNR..." lines, place the following line:
su $ORACLE_OWNR -c "$ORACLE_HOME/bin/emctl stop dbconsole"

That'll give you a clean startup and shutdown of the EM Web UI every boot/restart.

Cheers!
Dave