So apparently I needed to install Oracle 10g to Ubuntu, and ran through a lot of hassles. I found a guide that’s well written but had some trouble with 64-bit server, and am writing for this for others who will encounter some trouble as well.
I’m breaking this down the following sections:
- Installing Required Libraries
- Setting Up Users and Groups
- Setting Kernel Parameters
- Emulating SUSE and Red Hat
- Setting Up the Oracle Environment
- Installing Oracle
- Creating the Listener
- Creating a Database
- Creating Startup/Shutdown Scripts
Installing Required Libraries
Since Ubuntu is not an officially supported OS, we need to emulate those that are, and since Oracle mixes 32-bit and 64-bit libraries, we need to install i386, and even ia32 libraries. Run the following:
In addition, doesn’t come with LIBSTDC++5, so you have to install manually installing the package. Run the following:
ar vx libstdc++5_3.3.6-17ubuntu1_amd64.deb
tar zxvf data.tar.gz
sudo install usr/lib/libstdc++.so.5.0.7 /usr/lib32/
sudo ln -s libstdc++.so.5.0.7 libstdc++.so.5
sudo ln -s /usr/lib32/libstdc++.so.5
Setting Up Users and Groups
We need to create the group oinstall, dba, and nobody, and create a user named oracle. Run the following:
sudo groupadd dba
sudo groupadd nobody
sudo useradd -m oracle -g oinstall -G dba -s /bin/bash
And don’t forget to change the password.
Take note of the oinstall group ID as you will need this in setting the Kernel Parameters later. Do this by running the code below:
The ID should be in the format 10XX. If it’s a newly installed system, it should be 1002.
Setting Kernel Parameters
We need to override the kernel parameters by running the following:
And add the settings below at the bottom of the file. Take note that the [oinstall_group_id] should be replaced with what you got in the steps above (1002).
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
Reload the parameters by running the following:
We also need to edit limits of the system. Edit the limits.conf file by running:
Add add the settings below to the bottom of the file.
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536
Emulating SUSE and Red Hat
We emulate SUSE by creating symbolic links of the following:
sudo ln -s /usr/bin/rpm /bin/rpm
sudo ln -s /lib/libgcc_s.so.1 /lib/libgcc_s.so
sudo ln -s /usr/bin/basename /bin/basename
We emulate Red Hat by creating the redhat-release file to trick the Oracle Installer that we are using Red Hat. =) Edit the file:
And add the following:
Setting Up the Oracle Environment
I normally install my oracle database inside /opt so from hereon, you have to take note that /opt/oracle/10g will be the oracle home, and /opt/oracle will be the oracle base. The SID I will be using here will be orcl. Run the following:
sudo chown -R oracle:oinstall /opt/oracle
sudo chmod -R 775 /opt/oracle
Update environment profile by editing the global profile.
And add the following settings at the bottom.
Proceed with installation. My install directory is in /home/installers Unpack the downloaded oracle installer:
cpio -id < 10201_database_linux_x86_64.cpio
sudo chown -R oracle:oinstall .
Normally, Ubuntu Server doesn’t have X server installed, so you will have problems running the installer as it actuallly has GUI. The easiest way to install this is to access a desktop with X server, and create a connection with SSH forwarding.
From there, fire up the installer:
The GUI should come out on your client machine. Once the installer is up, uncheck the “Create Starter Database” option, and keep clicking on Next to accept the defaults.
If you encounter some error about the “collector” you can just ignore this as Ubuntu is not supported.
After the installation, the installer will ask you to run two scripts as root. Run them as is.
Oracle is Installed! X_X
Creating the Listener
We create the listener by running the Network Configuration Assistant (needs X server). As with the installer, we need to have X forwarding enabled. The command should be in the oracle path, if not, there might have been a problem with setting up the oracle environment. Run the following as oracle user:
Just use the defaults and create the listener.
Creating the Database
We create a database by running the Database Configuration Assistant (needs X). We also need X forwarding enabled here. Run the assistant with the following:
Create the database as you please. Although you have to take note of the Database Name/SID, and it should match the ORACLE_SID environment variable you set on the /etc/profile file.
Creating Startup/Shutdown Scripts
First, we need to edit the /etc/oratab file.
My oratab file contains the following:
Change the last character, N, to Y.
Next, we edit dbstart as oracle user. Run the following:
Look for the following line:
Just change that to your ORACLE_HOME (/opt/oracle/10g) and save the file.
Create a startup script found in /etc/init.d/ named dbora. The following script is taken here. Take note of the ORACLE_HOME and ORACLE_SID variables.
# Startup script for Oracle databases
case "$1" in
echo -n "Starting Oracle: "
su oracle -c $ORACLE_HOME/bin/dbstart
su oracle -c "$ORACLE_HOME/bin/emctl start dbconsole"
echo -n "Shutdown Oracle: "
su oracle -c $ORACLE_HOME/bin/dbshut
rm -f /var/lock/oracle
echo "Usage: 'basename $0' start|stop"
Modify the file so it is executable
Register it in Ubuntu’s startup script by running the following:
Everything should be working as is. Try to access Enterprise Manager by accessing port 1158 (default) through HTTP.