Hello, there! With another Ubuntu release, it has come the time to update our series of posts on how to install Oracle 11g on Ubuntu. If you’ve been following, we’ve been publishing updated howtos since Ubuntu 7.04:
- Installing Oracle 11g on Ubuntu 8.04 Hardy Heron LTS
- Installing Oracle 11g on Ubuntu 7.10 Gutsy Gibbon
- Installing Oracle 11g on Ubuntu 7.04 Feisty Fawn
In fact, in this article I refer several times to previous posts regarding some configuration aspects and why I chose particular values. Also, note that this series of posts is a work in progress and we were able to improve this series with your help. So please do post comment below as your collaboration is very much appreciated.
In this post, we’ll see the steps needed to install Oracle 11gR1 on an Ubuntu 8.10 Intrepid Ibex box all the way to creating your very first database. I’ve been working very hard to ensure that at every new post, the results you get when executing this procedure are as deterministic as possible, leading to a successful setup.
Please keep in mind that this is not a supported architecture, so pay special attention to the order in which I do things. Don’t rush and try to merge steps, as it took me a lot of attempts to make this setup work properly. There are some reboots and also there’s a specific order you need to do things, so please follow the instructions step-by-step and verify the the results of every single command.
Let’s get down to it, shall we? The first thing to do is to get some files. We need an ISO image of Ubuntu (a CD/DVD will do) and one of Oracle 11gR1. Get Ubuntu 8.10 Server here; and Oracle 11gR1 here. (It’s free, but you have to register on the Oracle website to download it.)
It’s a good idea to check the md5sum of each image after downloading from the Internet.
- Here is the md5sum I calculated on the Oracle package:
I’m using VMWare Server for this article, since it’s very handy when you have to repeat the whole procedure several times until you get the proper sequence; also because it is free as in “free beer” (but not as in “free speech”—see https://vmware.com/products/server/). If you prefer, you can use a physical machine, Xen (https://www.xen.org/) or VirtualBox (https://www.virtualbox.org/) but I’m not covering those here.
I’ve installed a plain-vanilla x86 Ubuntu instance with 512 MB of RAM, but instead of creating a disk with the suggested defaults, I’ve created one single virtual disk with 16 GB instead, so I can be sure not to run out of disk space. During the installation, you should choose guided partitioning and no encrypted home directory, unless you know what you’re doing. Also, as we’re going to do everything remotely in this HOWTO, you will want to request the installation of a OpenSSH server in the last steps of the installation.
On the first boot, let’s check if we have everything we need, such as connectivity and
bott@desktop:~$ ssh firstname.lastname@example.org (...) email@example.com's password: Linux ibex 2.6.27-7-server #1 SMP Fri Oct 24 07:37:55 UTC 2008 i686 (...) pythian@ibex:~$ sudo -l [sudo] password for pythian: User pythian may run the following commands on this host: (ALL) ALL pythian@ibex:~$ logout Connection to 192.168.x.y closed.
If you don’t have access to the box, review your installation, network addresses, etc. Let’s continue by updating every single package on the box:
bott@desktop:~/Desktop$ ssh firstname.lastname@example.org email@example.com's password: (...) pythian@ibex:~$ sudo su - root@ibex:~# apt-get update Hit https://security.ubuntu.com intrepid-security Release.gpg Ign https://security.ubuntu.com intrepid-security/main Translation-en_US (...) Get:7 https://security.ubuntu.com intrepid-security/multiverse Packages [14B] Get:8 https://security.ubuntu.com intrepid-security/multiverse Sources [14B] Fetched 6551B in 0s (7776B/s) Reading package lists... Done root@ibex:~# apt-get dist-upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following packages will be upgraded: (...) 5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 24.7MB of archives. After this operation, 24.6kB of additional disk space will be used. Do you want to continue [Y/n]? y (...) Running postinst hook script /sbin/update-grub. Searching for GRUB installation directory ... found: /boot/grub Searching for default file ... found: /boot/grub/default Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst Searching for splash image ... none found, skipping ... Found kernel: /boot/vmlinuz-2.6.27-7-server Found kernel: /boot/memtest86+.bin Updating /boot/grub/menu.lst ... done (...) Processing triggers for libc6 ... ldconfig deferred processing now taking place root@ibex:~#
Since we had a kernel upgrade, reboot before continuing:
root@ibex:~#reboot (...) The system is going down for reboot NOW! root@ibex:~# Connection to 192.168.x.y closed by remote host. Connection to 192.168.x.y closed. bott@desktop:~/Desktop$
After rebooting to change the kernel, let’s install all the required packages to continue:
bott@desktop:~/Desktop$ ssh firstname.lastname@example.org email@example.com's password: (...) pythian@ibex:~$ sudo su - [sudo] password for pythian: root@ibex:~# apt-get install gcc make binutils gawk x11-utils rpm alien ksh lsb-rpm Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: (... long list ...) Suggested packages: (... another long list ...) The following NEW packages will be installed: (... even longer list ...) 0 upgraded, 54 newly installed, 0 to remove and 0 not upgraded. Need to get 29.3MB of archives. After this operation, 93.0MB of additional disk space will be used. Do you want to continue [Y/n]? Get:1 https://us.archive.ubuntu.com intrepid/main gawk 1:3.1.6.dfsg-0ubuntu1 [500kB] Get:2 https://us.archive.ubuntu.com intrepid/main libdrm2 2.3.1-0build1 [260kB] (...) Setting up build-essential (11.4) ... Processing triggers for libc6 ... ldconfig deferred processing now taking place root@ibex:~#
Now we have all the packages we need, so let’s make sure we have all the requirements to run the Oracle Universal Installer as it was not designed to run on Ubuntu, but rather on Redhat-like systems). First, make sure Bash is your default replacement for
root@ibex:~# cd /bin root@ibex:/bin# ls -l /bin/sh lrwxrwxrwx 1 root root 4 2008-11-02 21:33 /bin/sh -> dash root@ibex:/bin# ln -sf /bin/bash /bin/sh root@ibex:/bin# ls -l /bin/sh lrwxrwxrwx 1 root root 4 2008-11-02 22:34 /bin/sh -> bash root@ibex:/bin#
Let’s create some users:
root@ibex:/bin# cd root@ibex:~# pwd /root root@ibex:~# addgroup oinstall Adding group `oinstall' (GID 1001) ... Done. root@ibex:~# addgroup dba Adding group `dba' (GID 1002) ... Done. root@ibex:~# addgroup nobody Adding group `nobody' (GID 1003) ... Done. root@ibex:~# usermod -g nobody nobody root@ibex:~# useradd -g oinstall -G dba -p password -d /home/oracle -s /bin/bash oracle root@ibex:~# mkdir /home/oracle root@ibex:~# chown -R oracle:dba /home/oracle root@ibex:~# ln -s /usr/bin/awk /bin/awk root@ibex:~# ln -s /usr/bin/rpm /bin/rpm root@ibex:~# ln -s /usr/bin/basename /bin/basename root@ibex:~# mkdir /etc/rc.d root@ibex:~# 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 root@ibex:~# mkdir -p /u01/app/oracle root@ibex:~# chown -R oracle:dba /u01 root@ibex:~#
Copy the unpacked Oracle 11gR1 to the box we’re working on:
bott@desktop:~/Desktop$ scp -r database firstname.lastname@example.org: email@example.com's password: (...)
And put our installation files in place:
pythian@ibex:~$ sudo su - root@ibex:~# mv /home/pythian/database /media/database root@ibex:~# chown -R oracle:oinstall /media/database root@ibex:~#
Let’s change some system-wide configuration files, starting with
root@ibex:~# cd /etc root@ibex:/etc# cp sysctl.conf sysctl.conf.original
Edit it, adding the following lines to the bottom of the file:
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 = 4194304 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 262144
Then, let’s modify
root@ibex:/etc# cd /etc/security/ root@ibex:/etc/security# cp limits.conf limits.conf.original
Add the following lines to the bottom of the file:
oracle soft nproc 2047 oracle hard nproc 16383 oracle soft nofile 1023 oracle hard nofile 65535
The last one, for now, is
root@ibex:/etc/security# cd /etc/pam.d root@ibex:/etc/pam.d# cp login login.original
login, adding to it:
session required /lib/security/pam_limits.so session required pam_limits.so
I’m not completely convinced that a reboot is needed here (you probably could get away with
sysctl -p as
root and logging in again as your user) but I do recommend it, just to make sure we are on the same page. Doing so guarantees that we’ve cleaned up our memory and loaded at boot time all the changes we just did.
Once our VM is back online. it’s time to become user
oracle and to fire up the Oracle Universal Installer. Don’t forget to allow incoming connections on your X server with
xhost +192.168.x.y. The IP address
192.168.w.z is the IP address of your X server.
pythian@ibex:~$ whoami pythian pythian@ibex:~$ sudo su - [sudo] password for pythian: root@ibex:~# su - oracle oracle@ibex:~$ export DISPLAY=192.168.w.z:0.0 oracle@ibex:~$ cd /media/database oracle@ibex:/media/database$ ./runInstaller -ignoreSysPrereqs Starting Oracle Universal Installer... Checking Temp space: must be greater than 80 MB. Actual 12037 MB Passed Checking swap space: must be greater than 150 MB. Actual 729 MB Passed Checking monitor: must be configured to display at least 256 colors. Actual 16777216 Passed Preparing to launch Oracle Universal Installer from /tmp/OraInstall2008-11-04_12-02-58AM. Please wait ...oracle@ibex:/media/database$ Oracle Universal Installer, Version 184.108.40.206.0 Production Copyright (C) 1999, 2007, Oracle. All rights reserved.
The installer may throw errors at some point:
Locking assertion failure. Backtrace: #0 /usr/lib/libxcb-xlib.so.0 [0xa35067c7] #1 /usr/lib/libxcb-xlib.so.0(xcb_xlib_unlock+0x31) [0xa3506891] #2 /usr/lib/libX11.so.6(_XReply+0x254) [0xa354e494] (...)
I ignored it and moved on with the installation. You should be able to finish your installation just as I did. The following screen will be presented:
I’ve selected group
And asked the installer to proceed with the whole Enterprise Edition:
Note that we changed the name and location of our
Some of the product-specific prerequisite checks will fail, but we check each checkbox so the last column reads “User Verified” on all unchecked rows:
We will install software only now, nothing else:
And change the privileged OS groups to
It will show us a summary, but the
Next is greyed out, so we hit
And it will begin installing:
And we get a cup of tea:
And another cup of tea:
Until it asks us to execute a couple of scripts as
In case you’ve never done this before and want to know what it looks like, here’s the output I got:
bott@desktop:~$ ssh firstname.lastname@example.org email@example.com's password: (...) pythian@ibex:~$ sudo su - [sudo] password for pythian: root@ibex:~# /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@ibex:~# /u01/app/oracle/product/11.1.0/oraibex/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/oraibex 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@ibex:~#
At the end of the installation, the Oracle Universal Installer is kind enough to ask us for confirmation before leaving (you can click on “Installed Products” and review what was installed before leaving the installer:
Now, take note of two things, our
ORACLE_BASE and our
ORACLE_HOME as we’ll use them later:
We now have only the database software, but no database created yet. Let’s get moving and install the few extra packages needed to complete our installation. Please note that on several attempts, I’ve installed all the packages in the earlier step, but all those attempts failed; that’s why we’re installing it just before we actually need it (
dbca will fail without those and the database won’t be created):
root@ibex:~# apt-get install libaio1 lesstif2 libmotif3 Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: libxp6 The following NEW packages will be installed: lesstif2 libaio1 libmotif3 libxp6 0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded. Need to get 1941kB of archives. After this operation, 4772kB of additional disk space will be used. Do you want to continue [Y/n]? Get:1 https://us.archive.ubuntu.com intrepid/main libxp6 1:1.0.0.xsf1-2 [16.7kB] Get:2 https://us.archive.ubuntu.com intrepid/multiverse libmotif3 2.2.3-2 [1283kB] (...) Setting up libaio1 (0.3.107-1ubuntu1) ... Processing triggers for libc6 ... ldconfig deferred processing now taking place root@ibex:~#
Create our startup/init script:
root@ibex:~# cat /etc/init.d/oracledb #!/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/oraibex 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
We will make it executable and tell the OS we want it started at boot time:
root@ibex:~# chmod a+x /etc/init.d/oracledb root@ibex:~# update-rc.d oracledb defaults 99 update-rc.d: warning: /etc/init.d/oracledb missing LSB style header 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 root@ibex:~#
Note: Do NOT reboot now.
Creating a database
Let’s install our first database with DBCA (DataBase Configuration Assistant).
root@ibex:~# su - oracle oracle@ibex:~$ export DISPLAY=192.168.w.z:0.0 oracle@ibex:~$ export ORACLE_HOME=/u01/app/oracle/product/11.1.0/oraibex oracle@ibex:~$ export PATH=$PATH:/u01/app/oracle/product/11.1.0/oraibex/bin oracle@ibex:~$ dbca (...some time will pass before you see anything -- be patient...) Locking assertion failure. Backtrace: #0 /usr/lib/libxcb-xlib.so.0 [0x9fc957c7] #1 /usr/lib/libxcb-xlib.so.0(xcb_xlib_unlock+0x31) [0x9fc95891] (...)
Now, wait for a few moments, as
dbca can take up to a couple of minutes to show this initial screen:
That’s right, we want to create a database:
A general Purpose or TransactionProcessing database, next:
And our SID will be
But we don’t want to configure Enterprise Manager just now:
We want to use the same password for both
Nothing fancy, just plain filesystem for storage:
Let’s use the suggested template:
But no recovery area or archiving:
We don’t want the sample schemas or to execute any custom scripts at this time:
You can tune this if you want, but I’d suggest leaving it as-is unless you know what you’re doing:
As well as sticking with the suggestion of keeping the enhanced default security settings:
I don’t want any automatic unattended tasks running:
Check your filesystem layout, then hit
Yes, we want it to go ahead and create the database. Hit
Finish this time.
It will show what it’s about to do. Check it out, then hit
OK when ready.
And it will get to work, creating your first database:
Go get another cup of tea:
And keep watching the screen until you see something like this:
At this point, you’ll have an empty database created.
Time to check it out. First test: we shut it down and restart it.
oracle@ibex:~$ export ORACLE_SID=intrepid oracle@ibex:~$ . oraenv ORACLE_SID = [intrepid] ? The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.1.0/oraibex is /u01/app/oracle oracle@ibex:~$ sqlplus '/as sysdba' SQL*Plus: Release 220.127.116.11.0 - Production on Thu Nov 6 14:35:24 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 18.104.22.168.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup nomount; ORACLE instance started. Total System Global Area 238530560 bytes Fixed Size 1299116 bytes Variable Size 125832532 bytes Database Buffers 109051904 bytes Redo Buffers 2347008 bytes SQL> alter database mount; Database altered. SQL> alter database open; Database altered. SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 22.214.171.124.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options oracle@ibex:~$
Next, we make it start on boot:
root@ibex:~# cat /etc/oratab # # This file is used by ORACLE utilities. It is created by root.sh # and updated by the Database Configuration Assistant when creating # a database. # A colon, ':', is used as the field terminator. A new line terminates # the entry. Lines beginning with a pound sign, '#', are comments. # # Entries are of the form: # $ORACLE_SID:$ORACLE_HOME:: # # The first and second fields are the system identifier and home # directory of the database respectively. The third filed indicates # to the dbstart utility that the database should , "Y", or should not, # "N", be brought up at system boot time. # # Multiple entries with the same $ORACLE_SID are not allowed. # # intrepid:/u01/app/oracle/product/11.1.0/oraibex:N root@ibex:~#
N on the line starting with
intrepid? Change it to
Here’s what happens when you run /etc/init.d/oracledb:
root@ibex:~# /etc/init.d/oracledb start Starting Oracle: LSNRCTL for Linux: Version 126.96.36.199.0 - Production on 12-NOV-2008 15:39:25 Copyright (c) 1991, 2007, Oracle. All rights reserved. Starting /u01/app/oracle/product/11.1.0/oraibex/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 188.8.131.52.0 - Production Log messages written to /u01/app/oracle/diag/tnslsnr/ibex/listener/alert/log.xml Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ibex.baia)(PORT=1521))) Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 184.108.40.206.0 - Production Start Date 12-NOV-2008 15:39:28 Uptime 0 days 0 hr. 0 min. 3 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Log File /u01/app/oracle/diag/tnslsnr/ibex/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ibex.baia)(PORT=1521))) The listener supports no services The command completed successfully Processing Database instance "intrepid": log file /u01/app/oracle/product/11.1.0/oraibex/startup.log OK root@ibex:~#
So after every reboot, you’ll be able to login to your database:
root@ibex:~# su - oracle oracle@ibex:~$ export ORACLE_SID=intrepid oracle@ibex:~$ . oraenv ORACLE_SID = [intrepid] ? The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.1.0/oraibex is /u01/app/oracle oracle@ibex:~$ sqlplus '/as sysdba' SQL*Plus: Release 220.127.116.11.0 - Production on Wed Nov 12 15:41:38 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 18.104.22.168.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> select sysdate from dual; SYSDATE --------- 12-NOV-08 SQL>
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.
Don’t forget to let us know how you make out with this. Cheers!
Interested in working with Augusto? Schedule a tech call.