Top News Search Software X Window System Documentation Support Home

How to run Oracle for Linux on FreeBSD

Marcel Moolenaar

1.   Installing a Linux environment

The Linux libraries and Linux development tools in the ports collection are not suitable to run Oracle. Instead, the appropriate Red hat packages are being installed. Before you install the Red hat packages, you are advised to deinstall the linux_lib and linux_devel ports. Make sure nothing is left behind in the /compat/linux directory.

To install the Red hat packages, you need the Red hat Package Manager. You can find it in the misc category (/usr/ports/misc/rpm). Make sure you have initialized the RPM database. Initialize the RPM database as follows:

        mkdir -p /compat/linux/var/local/lib/rpm
        rpm --initdb --dbpath /compat/linux/var/local/lib/rpm
The following packages are needed for Oracle to run. Note that the version numbers are important. Minor version differences can result in failure to install the packages. Worse, the contents of a packages can differ even if it has the same version number. I've included the md5 checksum for the packages I've been using, but that's all I can do :-(br> Install the packages in the order shown (or any order that respects dependencies [which is not guaranteed to be non-cyclic]):

        package                          md5 checksum
        -------------------------------- --------------------------------
        setup-1.9.1-2.noarch.rpm         6d79ec35042e9b4b43a2f640c8c8d1e5
        filesystem-1.3.1-3.noarch.rpm    9ae78dcceb23f80c41fba5ed96f0aa4e           240b50efe2606407283979087938d03a
        ldconfig-1.9.5-3.i386.rpm        4ec6e36ad260702db7fcce6fb7d32e18
        glib-1.0.1-3.i386.rpm            0211ac35d93ebc7b1b1f52400f81a587
        glibc-2.0.7-17.i386.rpm          de94c58d261f588ddcb3b1f709588c6d
        termcap-9.12.6-11.noarch.rpm     040274564e5b0c609c4c9ae6d768383d
        libtermcap-2.0.8-9.i386.rpm      be9c0449b84c22102f65e1237e2d4e79
        grep-2.2-2.i386.rpm              6369a42a9cacdb273b143688db076c7b
        fileutils-3.16-9.i386.rpm        cdb521c066dfcb54d784dc68f997da4c
        bash-2.02-1.i386.rpm             fe7f8a1254554083fe5090f856ecb977
        libc-5.3.12-27.i386.rpm          152dc8e473d06b078cd195d33c0859b3
        zlib-1.1.2-2.i386.rpm            f5a2ad4ecbbb7780ec89ce07ae2997f7
        ncurses-4.2-6.i386.rpm           bb9366bf387a1732325bba58000e0b63
        info-3.12-6.i386.rpm             4e7fe70af59c8a4f35e3f01dec9eb576
        make-3.76.1-3.i386.rpm           4b001425cd44489bda51fe1c6f384982
        binutils-    e2d11591fd3de8110215d6685ba9c9ac
        gcc-          8f17ca42c17192b757b9586770180cbb
        kernel-headers-2.0.34-3.i386.rpm 11910a1b787f669eb4092082a122566e
        glibc-devel-2.0.7-17.i386.rpm    ef341e3c8a68c36691bf249b386256fb
        tcl-8.0.2-17.i386.rpm            45b1391af27d06f6ed3128c87d33558a
The general command for installing packages is:
        rpm -i --ignoreos --root /compat/linux 
Some packages may generate errors when you install them. We only suggest to brandelf ldconfig directly after installing the ldconfig package. Use the following command to do that:
        brandelf -t Linux /compat/linux/sbin/ldconfig
Note that you only need the tcl package when you want to use the intelligent agent. After you have installed the above mentioned packages, you need to brandelf everything, to make sure the emulator knows they are Linux binaries:
        brandelf -t Linux /compat/linux/bin/*
        brandelf -t Linux /compat/linux/sbin/*
        brandelf -t Linux /compat/linux/usr/bin/*
        brandelf -t Linux /compat/linux/usr/sbin/*
Furthermore, make some links:
        ln -s /compat/linux/usr/src/linux-2.0.34 /compat/linux/usr/src/linux
        rmdir /compat/linux/tmp; ln -s /tmp /compat/linux/tmp
        rmdir /compat/linux/var/tmp; ln -s /var/tmp /compat/linux/var/tmp
And, last but not least, remove conflicting files:
rm /compat/linux/etc/exports
rm /compat/linux/etc/group
rm /compat/linux/etc/passwd
rm /compat/linux/etc/hosts.allow
rm /compat/linux/etc/hosts.deny
rm /compat/linux/etc/motd
rm /compat/linux/etc/printcap
rm /compat/linux/etc/protocols
rm /compat/linux/etc/services
rm /compat/linux/bin/df

2.   Creating the Oracle environment

Before you can install Oracle, you need to set up a proper environment. This document only describes what to do *specially* to run Oracle for Linux on FreeBSD, not what has been described in the Oracle installation guide.

2.1   Kernel tuning

As described in the Oracle installation guide, you need to set the maximum size of shared memory. Don't use SHMMAX under FreeBSD. SHMMAX is merely calculated out of SHMMAXPGS and PGSIZE. Therefor define SHMMAXPGS. All other options can be used as described in the guide. For example:

options         SHMMAXPGS=10000
options         SHMMNI=100
options         SHMSEG=10
options         SEMMNS=200
options         SEMMNI=70
options         SEMMSL=61
Set these options to suit your intended use of Oracle.

2.2   Oracle account

Create an Oracle account just as you would create any other account. The Oracle account is special only that you need to give it a Linux shell. Add /compat/linux/bin/bash to /etc/shells and set the shell for the Oracle account to /compat/linux/bin/bash.

2.3   Environment

Besides the normal Oracle variables, such as ORACLE_HOME and ORACLE_SID you must set the following environment variables:

        PATH=/compat/linux/bin:/compat/linux/sbin:/compat/linux/usr/bin: \
                compat/linux/usr/sbin:/bin:/sbin:/usr/bin:/usr/sbin: \
It is advised to set all the environment variables in .profile. A complete example is:
        ORACLE_BASE=/oracle; export ORACLE_BASE
        ORACLE_HOME=/oracle; export ORACLE_HOME
        export LD_LIBRARY_PATH
        ORACLE_TERM=386x; export ORACLE_TERM
        CLASSPATH=$ORACLE_HOME/jdbc/lib/; export CLASSPATH

        export PATH

3.   Installing Oracle

When you have met all requirements as described in the installation guide and followed the instructions in this document, you should be able to install Oracle without any problems. After you have installed Oracle, apply the patches described in the next two subsections.

3.1.   Patching

When installing Oracle, some actions, which need to be performed as root, are recorded in a shell script called is written in the orainst directory. Apply the following patch to, to have it use to proper location of chown:

        *** orainst/        Tue Oct  6 21:57:33 1998
        --- orainst/     Mon Dec 28 15:58:53 1998
        *** 31,37 ****
          #  This is the default value for CHOWN
          #  It will redefined later in this script for those ports
          #  which have it conditionally defined in ss_install.h
        ! CHOWN=/bin/chown
          # Define variables to be used in this script
        --- 31,37 ----
          #  This is the default value for CHOWN
          #  It will redefined later in this script for those ports
          #  which have it conditionally defined in ss_install.h
        ! CHOWN=/usr/sbin/chown
          # Define variables to be used in this script
When you don't install Oracle from CD, you can path the source for It is called and is located in the orainst directory in the source tree.

3.2.   Patching genclntsh

The script genclntsh is used to create a single shared client library. It is used when building the demos. Apply the following patch to comment out the definition of PATH:

        *** bin/genclntsh.orig  Wed Sep 30 07:37:19 1998
        --- bin/genclntsh       Tue Dec 22 15:36:49 1998
        *** 32,38 ****
          # Explicit path to ensure that we're using the correct commands
          #PATH=/usr/bin:/usr/ccs/bin   export PATH
        ! PATH=/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin      export PATH
          # each product MUST provide a $PRODUCT/admin/shrept.lst
        --- 32,38 ----
          # Explicit path to ensure that we're using the correct commands
          #PATH=/usr/bin:/usr/ccs/bin   export PATH
        ! #PATH=/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin     export PATH
          # each product MUST provide a $PRODUCT/admin/shrept.lst

4.   Running Oracle

When you have followed the instructions, you should be able to run Oracle as if it was run on Linux itself. Wether that is good or bad, depends on how you value Linux :-) Until we have a native FreeBSD version of Oracle supported by Oracle, I think Oracle for Linux is a good alternative.