After our last post about installing Oracle 11g on Ubuntu 7.10 (November, 6th), and considering Ubuntu 8.04 LTS was released on April 21st, I spent some time reviewing and putting together this new HOWTO for the installation.
Please note: I’ve used the x86 server version of Ubuntu 8.04, but the same steps should work without any problems for the Desktop version. Also notice that this whole procedure can easily take over six hours to complete, so don’t complain I didn’t warn you!
So, let’s get started, shall we?
Get the Ubuntu Linux 8.04 Hardy Heron (x86, 32-bit) image here, burn it, and install on any box you like. The only remark on the installation is that you should ask the installer to install an OpenSSH server at the end of the installation, since we’ll perform all the steps on this procedure remotely.
I’m not sure about the minimum requirements for the server, as, the last time I checked, running Oracle on Ubuntu is not officially supported by Oracle. In case you’re wondering, however, I’m using an x86 Pentium-like machine with 512M of RAM.
It’s a good idea to verify the checksum hashes of the downloaded images before burning them (especially the ISO file to install Ubuntu). You can do that with one or more of
sha1sum filename , or
cksum filename on almost any Unix-like box. Here are the pages showing the hashes:
- The MD5sums for the Ubuntu image
- The cksums of the Oracle image
(Wikipedia has pages on both these hash functions: MD5 and cksum.)
We’ll need an X server for this howto, so on your desktop computer, allow X connections from your (soon-to-be) database server to your desktop. If you happen to be using Ubuntu on the Desktop as well, go to System -> Administration -> Login Window, select the Security tab and uncheck the box next to “Deny TCP connections to the Xserver”. You will have to restart your Xserver for this change to take effect.
I’m running Ubuntu on the desktop (I call this host “
note“), so I have already an X server up and running. You can probably skip this step if you’re running the X server on the same machine you’re installing the database onto. Change
192.168.x.y to the IP address of your soon-to-be Oracle 11g database server:
bott@note:~$ hostname note user@note:~$ xhost +192.168.x.y 192.168.x.y being added to access control list
Log in to your machine via SSH and upgrade all packages.
bott@note:~$ ssh firstname.lastname@example.org email@example.com's password: Linux hardy 2.6.24-16-server #1 SMP Thu Apr 10 13:58:00 UTC 2008 i686 The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. To access official Ubuntu documentation, please visit: http://help.ubuntu.com/ Last login: Thu May 1 21:45:05 2008 from 192.168.w.z user@hardy:~$
Once you have made sure you have network connectivity, update all packages to the latest version (after all, we’re using a newly released version and updates can be expected at some point in the future). Here’s the output as of Thursday, May 4th 2008:
user@hardy:~$ hostname hardy user@hardy:~$ sudo su - [sudo] password for pythian: root@hardy:~# apt-get update Hit http://security.ubuntu.com hardy-security Release.gpg Ign http://security.ubuntu.com hardy-security/main Translation-en_US Hit http://us.archive.ubuntu.com hardy Release.gpg Ign http://us.archive.ubuntu.com hardy/main Translation-en_US (...) Fetched 7455kB in 2min36s (47.6kB/s) Reading package lists... Done root@hardy:~# apt-get dist-upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following packages will be upgraded: libldap-2.4-2 lshw 2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 498kB of archives. After this operation, 0B of additional disk space will be used. Do you want to continue [Y/n]? Get:1 http://us.archive.ubuntu.com hardy-updates/main libldap-2.4-2 2.4.7-6ubuntu4.1 [181kB] Get:2 http://us.archive.ubuntu.com hardy-updates/main lshw 02.12.01-2ubuntu1.1 [317kB] Fetched 498kB in 2s (211kB/s) (Reading database ... 18768 files and directories currently installed.) Preparing to replace libldap-2.4-2 2.4.7-6ubuntu3 (using .../libldap-2.4-2_2.4.7-6ubuntu4.1_i386.deb) ... Unpacking replacement libldap-2.4-2 ... Preparing to replace lshw 02.12.01-2ubuntu1 (using .../lshw_02.12.01-2ubuntu1.1_i386.deb) ... Unpacking replacement lshw ... Setting up libldap-2.4-2 (2.4.7-6ubuntu4.1) ... Setting up lshw (02.12.01-2ubuntu1.1) ... Processing triggers for libc6 ... ldconfig deferred processing now taking place root@hardy:~#
In case you’re wondering why we used
sudo su - instead of
sudo -s (as on the last version of this HOWTO ):
sudo su - effectively makes us
root with a new/empty session, while
sudo -s makes us
root while preserving some of our session variables from our “user” session. I chose this path in an attempt to make this whole process a bit more deterministic and less vulnerable to problems.
apt-get dist-upgrade installs a new kernel version, it’s a good idea to reboot the box before proceeding.
root@hardy:~# reboot Broadcast message from user@hardy (/dev/pts/0) at 0:04 ... The system is going down for reboot NOW! root@hardy:~# Connection to 192.168.x.y closed by remote host. Connection to 192.168.x.y closed. bott@note:~$
Once our machine is back up, we log in again and install a few extra packages needed for the installation: build-essential, libaio1, gawk, ksh, libmotif3, alien, libtool, and lsb-rpm. Please also note that our kernel has been upgraded to a newer build:
bott@note:~$ ssh firstname.lastname@example.org email@example.com's password: Linux hardy 2.6.24-16-server #1 SMP Thu Apr 10 13:58:00 UTC 2008 i686 The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. To access official Ubuntu documentation, please visit: http://help.ubuntu.com/ Last login: Thu May 1 21:45:05 2008 from 192.168.w.z user@hardy:~$ sudo su - [sudo] password for pythian: root@hardy:~# apt-get install build-essential libaio1 gawk ksh libmotif3 alien libtool lsb-rpm Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: autotools-dev binutils debhelper dpkg-dev g++ g++-4.2 gcc gcc-4.2 gettext html2text intltool-debian libbeecrypt6 libc6-dev libgomp1 libice6 libneon27 librpm4.4 libsm6 libstdc++6-4.2-dev libtimedate-perl libx11-6 libx11-data libxau6 libxcb-xlib0 libxcb1 libxdmcp6 libxext6 libxml2 libxmu6 libxp6 libxt6 linux-libc-dev make patch po-debconf rpm x11-common Suggested packages: lintian binutils-doc dh-make debian-keyring g++-multilib g++-4.2-multilib gcc-4.2-doc libstdc++6-4.2-dbg autoconf automake1.9 bison flex gcc-doc gcc-multilib gdb manpages-dev gcc-4.2-locales gcc-4.2-multilib libgcc1-dbg libgomp1-dbg libmudflap0-4.2-dbg libmudflap0-4.2-dev cvs gettext-doc glibc-doc libstdc++6-4.2-doc automaken gcj gfortran fortran95-compiler libtool-doc make-doc diff-doc Recommended packages: libltdl3-dev xml-core libmail-sendmail-perl libcompress-zlib-perl libmail-box-perl The following NEW packages will be installed: alien autotools-dev binutils build-essential debhelper dpkg-dev g++ g++-4.2 gawk gcc gcc-4.2 gettext html2text intltool-debian ksh libaio1 libbeecrypt6 libc6-dev libgomp1 libice6 libmotif3 libneon27 librpm4.4 libsm6 libstdc++6-4.2-dev libtimedate-perl libtool libx11-6 libx11-data libxau6 libxcb-xlib0 libxcb1 libxdmcp6 libxext6 libxml2 libxmu6 libxp6 libxt6 linux-libc-dev lsb-rpm make patch po-debconf rpm x11-common 0 upgraded, 45 newly installed, 0 to remove and 0 not upgraded. Need to get 22.9MB of archives. After this operation, 80.5MB of additional disk space will be used. Do you want to continue [Y/n]? (... again: downloads a bunch of packages ...) (... again: installs a bunch of packages ...) Processing triggers for libc6 ... ldconfig deferred processing now taking place root@hardy:~#
After all those packages and updates are installed, we make some adjustments on our system. First of all, we change the default replacement for
bash. Do not forget skip this step, otherwise we might get all sorts of weird errors during our installation:
root@hardy:~# cd /bin root@hardy:/bin# ls -l /bin/sh lrwxrwxrwx 1 root root 4 2008-04-28 19:59 /bin/sh -> dash root@hardy:/bin# ln -sf bash /bin/sh root@hardy:/bin# ls -l /bin/sh lrwxrwxrwx 1 root root 4 2008-05-01 22:51 /bin/sh -> bash
In case you’re wondering why Ubuntu uses
dash as default, here is a detailed explanation of why dash is the default system shell and how if differs from
Next we make some modifications to our base system (line numbers added for clarity, see below):
01 root@hardy:/bin# cd 02 root@hardy:~# pwd /root 04 root@hardy:~# addgroup oinstall Adding group `oinstall' (GID 1001) ... Done. 07 root@hardy:~# addgroup dba Adding group `dba' (GID 1002) ... Done. 10 root@hardy:~# addgroup nobody Adding group `nobody' (GID 1003) ... Done. 13 root@hardy:~# usermod -g nobody nobody 14 root@hardy:~# useradd -g oinstall -G dba -p password -d /home/oracle -s /bin/bash oracle 15 root@hardy:~# passwd -l oracle Password changed. 17 root@hardy:~# mkdir /home/oracle 18 root@hardy:~# chown -R oracle:dba /home/oracle 19 root@hardy:~# ln -s /usr/bin/awk /bin/awk 20 root@hardy:~# ln -s /usr/bin/rpm /bin/rpm 21 root@hardy:~# ln -s /usr/bin/basename /bin/basename 22 root@hardy:~# mkdir /etc/rc.d 23 root@hardy:~# for i in 0 1 2 3 4 5 6 S ; do ln -s /etc/rc$i.d /etc/rc.d/rc$i.d ; done 24 root@hardy:~# mkdir -p /u01/app/oracle 25 root@hardy:~# chown -R oracle:dba /u01 26 root@hardy:~#
- Lines 01-03: change our path back to
rootuser, not really needed)
- Lines 04-12: add the groups we need.
- Line 13: adapts Ubuntu’s
nobodyuser so the Oracle installer doesn’t get confused.
- Lines 14-18: we create the
oracleuser, lock that account so no one can log in with it, and create a
HOMEdirectory for the user (not the same as
- Lines 19-23: we create some symlinks so the Oracle installer finds the paths where it expects them to be.
- Finally, on lines 24-25 we create our
We change a few of the defaults on our system, adding the following to the end of
/etc/sysctl.conf. This will extend the total number of file descriptors on a system, the size of shared memory, and will do some tweaking on the networking subsystem. About the networking tweaks: it may bring benefits or it may not — your mileage may vary.
fs.file-max = 65535 kernel.shmall = 2097152 kernel.shmmax = 2147483648 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 1024 65535 net.core.rmem_default = 1048576 net.core.rmem_max = 1048576 net.core.wmem_default = 262144 net.core.wmem_max = 262144
Add this to the end of
oracle soft nproc 2047 oracle hard nproc 16383 oracle soft nofile 1023 oracle hard nofile 65535
And add this to the end of
/etc/pam.d/login so we enforce what we just added to
session required /lib/security/pam_limits.so session required pam_limits.so
There is some explanation for all these system modifications on the first post: Installing Oracle 11g on Ubuntu Linux 7.04.
Before continuing, you have two choices: you reboot the machine so the new values are loaded for
sysctl.conf; or you ask the box to reload them with
root@hardy:~# sysctl -p kernel.printk = 4 4 1 7 kernel.maps_protect = 1 fs.inotify.max_user_watches = 524288 vm.mmap_min_addr = 65536 net.ipv4.conf.default.rp_filter = 1 net.ipv4.conf.all.rp_filter = 1 fs.file-max = 65535 kernel.shmall = 2097152 kernel.shmmax = 2147483648 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 1024 65535 net.core.rmem_default = 1048576 net.core.rmem_max = 1048576 net.core.wmem_default = 262144 net.core.wmem_max = 262144 root@hardy:~#
For this HOWTO, I’ve unpacked the ZIP file we downloaded on Step 2 in
/home/oracle, so we
su to the
oracle user, export our
DISPLAY (change 192.168.w.z to the IP address of your X server), and start the installation. When we do
su - oracle, Ubuntu will complain about the account being expired — this is harmless. When starting the installer, please note that we pass the
-ignoreSysPrereqs command-line switch.
root@hardy:~# su - oracle Your account has expired; please contact your system administrator su: User account has expired (Ignored) oracle@hardy:~$ export DISPLAY=192.168.w.z:0.0 oracle@hardy:~$ pwd /home/oracle oracle@hardy:~$ ls -l total 4 drwxr-xr-x 6 oracle dba 4096 2007-09-18 18:50 database oracle@hardy:~$ cd database oracle@hardy:~/database$ ls -l total 28 drwxr-xr-x 11 oracle dba 4096 2007-08-06 16:02 doc drwxr-xr-x 5 oracle dba 4096 2007-08-03 13:28 install drwxr-xr-x 2 oracle dba 4096 2007-09-18 18:52 response -rwxr-xr-x 1 oracle dba 2911 2007-08-03 13:28 runInstaller drwxr-xr-x 14 oracle dba 4096 2007-08-03 13:27 stage -rw-r--r-- 1 oracle dba 4835 2007-08-06 18:19 welcome.html oracle@hardy:~/database$ ./runInstaller -ignoreSysPrereqs
After a few moments, the Oracle Universal Installer (OUI) will show you a window similar to this one (as well as a bunch of garbled text on the SSH session, no need to bother with that now unless no window pops up):
After you hit
Next, it will ask you where you want the Oracle Inventory should be installed. I’ve changed the group to
dba, but you don’t need to change it if you don’t want to
Next will make the OUI review which products are included in the package:
We’re choosing Enterprise Edition on this HOWTO, but you can choose whatever you want.
It will ask you the paths for the installation:
I chose the defaults and hit
The next step — some prerequisite checks. Some of them will fail: this is expected — after all we’re installing on an unsupported platform.
All you have to to is click on each of the unmarked the checkboxes (those on which
Status is not
Succeeded). As you click on them, the
Status will change to
Next, OUI will ask if we want to create a database. I chose “Install Software Only” as a new database can be created later with
I’ve changed all groups to
It’ll show you a Summary before starting the installation. After hitting
Install, go get yourself some coffee: this is going to take a while.
After we get to 90% of the installation (linking stage) it might seem stuck, but it isn’t: let it run, and go get yourself more coffee.
Once OUI is done with the linking, it will ask you to run two scripts as
Here’s the output on my setup:
root@hardy:~# /u01/app/oraInventory/orainstRoot.sh Changing permissions of /u01/app/oraInventory to 770. Changing groupname of /u01/app/oraInventory to dba. The execution of the script is complete root@hardy:~# /u01/app/oracle/product/11.1.0/db_1/root.sh Running Oracle 11g root.sh script... The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /u01/app/oracle/product/11.1.0/db_1 Enter the full pathname of the local bin directory: [/usr/local/bin]: Copying dbhome to /usr/local/bin ... Copying oraenv to /usr/local/bin ... Copying coraenv to /usr/local/bin ... Creating /etc/oratab file... Entries will be added to the /etc/oratab file as needed by Database Configuration Assistant when a database is created Finished running generic part of root.sh script. Now product-specific root actions will be performed. Finished product-specific root actions. root@hardy:~#
And… congratulations! You just finished installing Oracle 11g on Ubuntu 8.04 LTS (Hardy Heron)!
However, we’re not completely done yet: a few actions need to be performed to make your life easier. First, we add these lines to
export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1 export PATH=$PATH:/u01/app/oracle/product/11.1.0/db_1/bin
Also, a startup script might be useful, right? Create a file called
/etc/init.d/oracledb and put this into it:
#!/bin/bash # # /etc/init.d/oracledb # # Run-level Startup script for the Oracle Listener and Instances # It relies on the information on /etc/oratab export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1 export ORACLE_OWNR=oracle export PATH=$PATH:$ORACLE_HOME/bin if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ] then echo "Oracle startup: cannot start" exit 1 fi case "$1" in start) # Oracle listener and instance startup echo -n "Starting Oracle: " su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl start" su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME" touch /var/lock/oracle echo "OK" ;; stop) # Oracle listener and instance shutdown echo -n "Shutdown Oracle: " su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop" su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME" rm -f /var/lock/oracle echo "OK" ;; reload|restart) $0 stop $0 start ;; *) echo "Usage: `basename $0` start|stop|restart|reload" exit 1 esac exit 0
After saving this file, make it executable:
root@hardy:~# chmod a+x /etc/init.d/oracledb
If you want this script to be run at every boot, execute this:
root@hardy:~# update-rc.d oracledb defaults 99 Adding system startup for /etc/init.d/oracledb ... /etc/rc0.d/K99oracledb -> ../init.d/oracledb /etc/rc1.d/K99oracledb -> ../init.d/oracledb /etc/rc6.d/K99oracledb -> ../init.d/oracledb /etc/rc2.d/S99oracledb -> ../init.d/oracledb /etc/rc3.d/S99oracledb -> ../init.d/oracledb /etc/rc4.d/S99oracledb -> ../init.d/oracledb /etc/rc5.d/S99oracledb -> ../init.d/oracledb
Just remember: this script depends on the existence of a database on the machine, so don’t forget to run
dbca as the
oracle user, and configure it to start at boot time (edit
/etc/oratab after creating the database, and set the last column to
To make things easier, make your user part of the
dba group. This way your user will be able to interact with the database server with the
dba role. In the example below,
user is the username:
root@hardy:~# usermod -G dba -a user
When creating a database with
dbca, don’t forget to do so as the
oracle user (and to export the
DISPLAY environment variable). After creation, you should test if you can connect to it:
oracle@hardy:~$ export ORACLE_SID=heron oracle@hardy:~$ sqlplus '/as sysdba' SQL*Plus: Release 184.108.40.206.0 - Production on Mon May 5 02:39:27 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 220.127.116.11.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL>
After you get this output, we can finally say: it’s complete! Of course, I invite you to share your thoughts and your experiences with this HOWTO.
So now, dear reader, we hope we have helped you figure out something you needed to know. It turns out that you can help us here at Pythian with something we need to know! If you are aware of a DBA requirement within your organization, salaried or consulting, please pop in your email address here:
We respect your privacy and will not share your address with any third party. As a thank you for just participating, we will enter you into a monthly draw for a year’s membership in the ACM, which includes access to 600 books from the O’Reilly Bookshelf Online, 500 books from Books24x7 and 3000 online courses from SkillSoft, including tons of courseware on Oracle, SQL Server, and MySQL.
165 Responses to “Installing Oracle 11g on Ubuntu 8.04 LTS (Hardy Heron)”
Leave a Reply