FreeBSD Handbook
Prev | Chapter 11 Linux® Binary Compatibility | Next

# 11.6 Installing Oracle®

Contributed by Marcel Moolenaar.

This document describes the process of installing Oracle® 8.0.5 and Oracle 8.0.5.1 Enterprise Edition for Linux® onto a FreeBSD machine.

## 11.6.1 Installing the Linux® Environment

Make sure both `emulators/linux_base` and `devel/linux_devtools` are installed from the Ports Collection.

To run the intelligent agent, install the Red Hat Tcl package: `tcl-8.0.3-20.i386.rpm`. The general command for installing RPMs with the `archivers/rpm` port is:

    # rpm -i --ignoreos --root /compat/linux --dbpath /var/lib/rpm package

This command should not generate any errors.

## 11.6.2 Creating the Oracle Environment

Before installing Oracle, set up a proper environment. This section only describes how to install Oracle for Linux on FreeBSD, not what has been described in the Oracle installation guide.

### 11.6.2.1 Kernel Tuning

As described in the Oracle installation guide, the maximum size of shared memory needs to be set. Do not use `SHMMAX` under FreeBSD as it is calculated from `SHMMAXPGS` and `PGSIZE`. Therefore, 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 the intended use of Oracle.

Also, make sure the following options are in the kernel configuration file:

    options SYSVSHM #SysV shared memory
    options SYSVSEM #SysV semaphores
    options SYSVMSG #SysV interprocess communication

### 11.6.2.2 Oracle Account

Create a user account to be used as the `oracle` account. Add `/compat/linux/bin/bash` to `/etc/shells` and set the shell for the `oracle` account to `/compat/linux/bin/bash`.

### 11.6.2.3 Environment

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

Variable | Value
--- | ---
`LD_LIBRARY_PATH` | `$ORACLE_HOME/lib`
`CLASSPATH` | `$ORACLE_HOME/jdbc/lib/classes111.zip`
`PATH` | `/compat/linux/bin /compat/linux/sbin /compat/linux/usr/bin /compat/linux/usr/sbin /bin /sbin /usr/bin /usr/sbin /usr/local/bin $ORACLE_HOME/bin`

It is advised to set all the environment variables in `~/.profile` as follows:

    ORACLE_BASE=/oracle; export ORACLE_BASE
    ORACLE_HOME=/oracle; export ORACLE_HOME
    LD_LIBRARY_PATH=$ORACLE_HOME/lib
    export LD_LIBRARY_PATH
    ORACLE_SID=ORCL; export ORACLE_SID
    ORACLE_TERM=386x; export ORACLE_TERM
    CLASSPATH=$ORACLE_HOME/jdbc/lib/classes111.zip
    export CLASSPATH
    PATH=/compat/linux/bin:/compat/linux/sbin:/compat/linux/usr/bin
    PATH=$PATH:/compat/linux/usr/sbin:/bin:/sbin:/usr/bin:/usr/sbin
    PATH=$PATH:/usr/local/bin:$ORACLE_HOME/bin
    export PATH

## 11.6.3 Installing Oracle

Before starting the installer, create a directory named `/var/tmp/.oracle` which is owned by the `oracle` user. The installation of Oracle should work without any problems. If errors are encountered, check the Oracle distribution and configuration. Once Oracle is installed, apply the patches described in the next two subsections.

A frequent error is that the TCP protocol adapter is not installed correctly. As a consequence, no TCP listeners can be started. The following actions help to solve this problem:

    # cd $ORACLE_HOME/network/lib
    # make -f ins_network.mk ntcontab.o
    # cd $ORACLE_HOME/lib
    # ar r libnetwork.a ntcontab.o
    # cd $ORACLE_HOME/network/lib
    # make -f ins_network.mk install

Do not forget to run `root.sh` again.

### 11.6.3.1 Patching `root.sh`

When installing Oracle, some actions, which need to be performed as `root`, are recorded in a shell script called `root.sh`. This script is found in `orainst`. Apply the following patch to `root.sh` so that it can find the FreeBSD location of `chown`. Alternatively, run the script under a Linux native shell.

    *** orainst/root.sh.orig Tue Oct 6 21:57:33 1998
    --- orainst/root.sh 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

If Oracle is not installed from CD, patch the source for `root.sh`. It is called `rthd.sh` and is located in `orainst` in the source tree.

### 11.6.3.2 Patching `genclntsh`

The script `genclntsh` is used to create a single shared client library 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 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: export PATH
    #
    # each product MUST provide a $PRODUCT/admin/shrept.lst

## 11.6.4 Running Oracle

After following these instructions, Oracle should run as if it was running on Linux.

Prev | Home | Next
Installing MATLAB® | Up | Advanced Topics