Monday, 22 June 2015

How to install Oracle 11gR2 Enterprise Edition (11.2.0.4) on Ubuntu 14.04

So as I'm sitting in the Goodwood Hotel bar drinking my favorite full fat Latte waiting to hack my way round the Park Course I thought I'd start this blog after my son asked me if I could install Oracle 11gR2 on Ubuntu 14.04 for him.

Ubuntu 14.04, I laughed, get a free supported enterprise quality Linux distribution I told him. Alas his service provider didn't offer that option so I've had to hack my way trough the process.

I've found lots of good references to installing Oracle XE in Ubuntu 12.10 but nothing about 14.04 so hopefully this will provide you with some pointers.

Remember that I said hack this is truly that, I'm sure there are steps in here that are not necessary but I'm revisit the process after I've finished 18 holes.

So let's set the scene; this is the starting point of the VM that was provided by OVH.
# uname -a
Linux xxxxxxxxx.ovh.net 2.6.32-042stab106.4 #1 SMP Fri Mar 27 15:19:28 MSK 2015 x86_64 x86_64 x86_64 GNU/Linux
# ls -ltr /etc/*release*
-rw-r--r-- 1 root root 105 Feb  3 10:06 /etc/lsb-release
-rw-r--r-- 1 root root 249 Feb  3 10:14 /etc/os-release
 
# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.2 LTS"
 
# cat /etc/os-release
NAME="Ubuntu"
VERSION="14.04.2 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.2 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
And the list of packages installed.
# dpkg --get-selections
adduser                                         install
apt                                             install
apt-utils                                       install
apt-xapian-index                                install
aptitude                                        install
aptitude-common                                 install
base-files                                      install
base-passwd                                     install
bash                                            install
bc                                              install
bind9                                           install
bind9-host                                      install
bind9utils                                      install
binutils                                        install
bsdmainutils                                    install
bsdutils                                        install
busybox-initramfs                               install
bzip2                                           install
ca-certificates                                 install
console-common                                  install
console-data                                    install
console-setup                                   install
coreutils                                       install
cpio                                            install
cracklib-runtime                                install
cron                                            install
dash                                            install
db-util                                         install
db5.3-util                                      install
debconf                                         install
debconf-i18n                                    install
debconf-utils                                   install
debianutils                                     install
dh-python                                       install
dialog                                          install
diffutils                                       install
dnsutils                                        install
dpkg                                            install
dselect                                         install
e2fslibs:amd64                                  install
ed                                              install
expat                                           install
fetchmail                                       install
file                                            install
findutils                                       install
finger                                          install
fontconfig                                      install
fontconfig-config                               install
fonts-dejavu                                    install
fonts-dejavu-core                               install
fonts-dejavu-extra                              install
fonts-freefont-ttf                              install
ftp                                             install
gawk                                            install
gcc-4.8-base:amd64                              install
gcc-4.9-base:amd64                              install
geoip-database                                  install
gettext                                         install
gettext-base                                    install
gnupg                                           install
gpgv                                            install
grep                                            install
groff-base                                      install
gzip                                            install
hostname                                        install
ifupdown                                        install
info                                            install
init-system-helpers                             install
initramfs-tools                                 install
initramfs-tools-bin                             install
initscripts                                     install
insserv                                         install
install-info                                    install
iproute2                                        install
iptables                                        install
iputils-arping                                  install
iputils-ping                                    install
iputils-tracepath                               install
iso-codes                                       install
kbd                                             install
keyboard-configuration                          install
klibc-utils                                     install
kmod                                            install
landscape-common                                install
ldap-utils                                      install
less                                            install
libacl1:amd64                                   install
libapr1:amd64                                   install
libaprutil1:amd64                               install
libaprutil1-dbd-sqlite3:amd64                   install
libaprutil1-ldap:amd64                          install
libapt-inst1.5:amd64                            install
libapt-pkg4.12:amd64                            install
libasn1-8-heimdal:amd64                         install
libasprintf0c2:amd64                            install
libattr1:amd64                                  install
libaudit-common                                 install
libaudit1:amd64                                 install
libavahi-client3:amd64                          install
libavahi-common-data:amd64                      install
libavahi-common3:amd64                          install
libbind9-90                                     install
libblkid1:amd64                                 install
libboost-iostreams1.54.0:amd64                  install
libbsd0:amd64                                   install
libbz2-1.0:amd64                                install
libc-bin                                        install
libc6:amd64                                     install
libcap2:amd64                                   install
libcgmanager0:amd64                             install
libck-connector0:amd64                          install
libclass-accessor-perl                          install
libcomerr2:amd64                                install
libcrack2:amd64                                 install
libcroco3:amd64                                 install
libcups2:amd64                                  install
libcwidget3                                     install
libdb5.3:amd64                                  install
libdbi1:amd64                                   install
libdbus-1-3:amd64                               install
libdebconfclient0:amd64                         install
libdns100                                       install
libdrm-intel1:amd64                             install
libdrm-radeon1:amd64                            install
libdrm2:amd64                                   install
libedit2:amd64                                  install
libept1.4.12:amd64                              install
libesmtp6                                       install
libestr0                                        install
libevtlog0:amd64                                install
libexpat1:amd64                                 install
libffi6:amd64                                   install
libfile-copy-recursive-perl                     install
libfontconfig1:amd64                            install
libfreetype6:amd64                              install
libgcc1:amd64                                   install
libgcrypt11:amd64                               install
libgdbm3:amd64                                  install
libgeoip1:amd64                                 install
libglib2.0-0:amd64                              install
libgmp10:amd64                                  install
libgnutls-openssl27:amd64                       install
libgnutls26:amd64                               install
libgomp1:amd64                                  install
libgpg-error0:amd64                             install
libgpm2:amd64                                   install
libgssapi-krb5-2:amd64                          install
libgssapi3-heimdal:amd64                        install
libgssglue1:amd64                               install
libhcrypto4-heimdal:amd64                       install
libhdb9-heimdal:amd64                           install
libheimbase1-heimdal:amd64                      install
libheimntlm0-heimdal:amd64                      install
libhiredis0.10:amd64                            install
libhx509-5-heimdal:amd64                        install
libidn11:amd64                                  install
libio-string-perl                               install
libisc95                                        install
libisccc90                                      install
libisccfg90                                     install
libivykis0:amd64                                install
libjson-c2:amd64                                install
libjson0:amd64                                  install
libk5crypto3:amd64                              install
libkdc2-heimdal:amd64                           install
libkeyutils1:amd64                              install
libklibc                                        install
libkmod2:amd64                                  install
libkrb5-26-heimdal:amd64                        install
libkrb5-3:amd64                                 install
libkrb5support0:amd64                           install
libldap-2.4-2:amd64                             install
libldb1:amd64                                   install
liblocale-gettext-perl                          install
liblockfile-bin                                 install
liblockfile1:amd64                              install
libltdl7:amd64                                  install
liblwres90                                      install
liblzma5:amd64                                  install
libmagic1:amd64                                 install
libmongo-client0:amd64                          install
libmount1:amd64                                 install
libmpdec2:amd64                                 install
libncurses5:amd64                               install
libncursesw5:amd64                              install
libnet1:amd64                                   install
libnfnetlink0:amd64                             install
libnih-dbus1:amd64                              install
libnih1:amd64                                   install
libnl-3-200:amd64                               install
libnl-genl-3-200:amd64                          install
libntdb1:amd64                                  install
libodbc1:amd64                                  install
libp11-kit0:amd64                               install
libpam-modules:amd64                            install
libpam-modules-bin                              install
libpam-runtime                                  install
libpam0g:amd64                                  install
libpaper1:amd64                                 install
libparse-debianchangelog-perl                   install
libpcap0.8:amd64                                install
libpci3:amd64                                   install
libpciaccess0:amd64                             install
libpcre3:amd64                                  install
libperl5.18                                     install
libpipeline1:amd64                              install
libplymouth2:amd64                              install
libpng12-0:amd64                                install
libpopt0:amd64                                  install
libprocps3:amd64                                install
libpython-stdlib:amd64                          install
libpython2.7:amd64                              install
libpython2.7-minimal:amd64                      install
libpython2.7-stdlib:amd64                       install
libpython3-stdlib:amd64                         install
libpython3.4-minimal:amd64                      install
libpython3.4-stdlib:amd64                       install
libreadline6:amd64                              install
libroken18-heimdal:amd64                        install
libsasl2-2:amd64                                install
libsasl2-modules-db:amd64                       install
libselinux1:amd64                               install
libsemanage-common                              install
libsemanage1:amd64                              install
libsensors4:amd64                               install
libsepol1:amd64                                 install
libsigc++-2.0-0c2a:amd64                        install
libsigsegv2:amd64                               install
libslang2:amd64                                 install
libsnmp-base                                    install
libsnmp30:amd64                                 install
libsqlite3-0:amd64                              install
libssl1.0.0:amd64                               install
libstdc++6:amd64                                install
libsub-name-perl                                install
libsystemd-daemon0:amd64                        install
libtalloc2:amd64                                install
libtasn1-6:amd64                                install
libtdb1:amd64                                   install
libtevent0:amd64                                install
libtext-charwidth-perl                          install
libtext-iconv-perl                              install
libtext-wrapi18n-perl                           install
libtimedate-perl                                install
libtinfo5:amd64                                 install
libtirpc1:amd64                                 install
libudev1:amd64                                  install
libunistring0:amd64                             install
libusb-0.1-4:amd64                              install
libusb-1.0-0:amd64                              install
libustr-1.0-1:amd64                             install
libuuid1:amd64                                  install
libwbclient0:amd64                              install
libwind0-heimdal:amd64                          install
libwrap0:amd64                                  install
libxapian22                                     install
libxml2:amd64                                   install
libxtables10                                    install
locales                                         install
login                                           install
logrotate                                       install
lsb-base                                        install
lsb-release                                     install
lshw                                            install
lsof                                            install
lynx                                            install
lynx-cur                                        install
lzma                                            install
m4                                              install
make                                            install
makedev                                         install
man-db                                          install
manpages                                        install
memtester                                       install
mime-support                                    install
mktemp                                          install
mlocate                                         install
module-init-tools                               install
mount                                           install
mountall                                        install
mtools                                          install
multiarch-support                               install
ncurses-base                                    install
ncurses-bin                                     install
ncurses-term                                    install
net-tools                                       install
netbase                                         install
odbcinst                                        install
odbcinst1debian2:amd64                          install
openssh-blacklist                               install
openssh-client                                  install
openssh-server                                  install
openssh-sftp-server                             install
openssl                                         install
openssl-blacklist                               install
passwd                                          install
patch                                           install
pciutils                                        install
perl                                            install
perl-base                                       install
perl-modules                                    install
plymouth                                        install
procinfo                                        install
procmail                                        install
procps                                          install
psmisc                                          install
psutils                                         install
pwgen                                           install
python                                          install
python-apt                                      install
python-apt-common                               install
python-chardet                                  install
python-configobj                                install
python-crypto                                   install
python-debian                                   install
python-dnspython                                install
python-gdbm                                     install
python-ldb                                      install
python-minimal                                  install
python-ntdb                                     install
python-openssl                                  install
python-pam                                      install
python-pkg-resources                            install
python-samba                                    install
python-serial                                   install
python-six                                      install
python-talloc                                   install
python-tdb                                      install
python-twisted-bin                              install
python-twisted-core                             install
python-xapian                                   install
python-zope.interface                           install
python2.7                                       install
python2.7-minimal                               install
python3                                         install
python3-apt                                     install
python3-minimal                                 install
python3.4                                       install
python3.4-minimal                               install
quota                                           install
readline-common                                 install
rpcbind                                         install
rsync                                           install
samba-dsdb-modules                              install
samba-libs:amd64                                install
screen                                          install
sed                                             install
sensible-utils                                  install
sharutils                                       install
snmp                                            install
ssl-cert                                        install
sudo                                            install
syslinux                                        install
syslinux-common                                 install
syslog-ng                                       install
syslog-ng-core                                  install
syslog-ng-mod-amqp                              install
syslog-ng-mod-geoip                             install
syslog-ng-mod-json                              install
syslog-ng-mod-mongodb                           install
syslog-ng-mod-redis                             install
syslog-ng-mod-smtp                              install
syslog-ng-mod-sql                               install
syslog-ng-mod-stomp                             install
sysv-rc                                         install
sysvinit-utils                                  install
tar                                             install
tcpdump                                         install
tcsh                                            install
tdb-tools                                       install
telnet                                          install
tofrodos                                        install
traceroute                                      install
ttf-dejavu                                      install
ttf-dejavu-core                                 install
ttf-dejavu-extra                                install
ttf-freefont                                    install
tzdata                                          install
ubuntu-keyring                                  install
ucf                                             install
udev                                            install
unixodbc                                        install
unzip                                           install
update-inetd                                    install
update-motd                                     install
update-notifier-common                          install
upstart                                         install
usbutils                                        install
util-linux                                      install
uuid-runtime                                    install
vim                                             install
vim-common                                      install
vim-runtime                                     install
wget                                            install
whois                                           install
wide-dhcpv6-client                              install
xinetd                                          install
xkb-data                                        install
xz-utils                                        install
zlib1g:amd64                                    install
So lets update the VM and then install a whole bunch of packages (this is the bit that I need to revisit as I'm sure I don't need 90% of them);
# apt-get update
# apt-get install \
alien \
autoconf \
automake \
autotools-dev \
binutils \
build-essential \
doxygen \
elfutils \
expat \
g++-multilib \
gawk \
gcc \
gcc-4.4 \
gcc-multilib \
ksh \
less \
lib32z1 \
libaio-dev \
libaio1 \
libc6-dev \
libc6-dev-i386 \
libc6-i386 \
libelf-dev \
libglapi-mesa:i386 \
libglu1-mesa:i386 \
libglu1-mesa:i386 \
libltdl-dev \
libmotif3 \
libmotif4 \
libodbcinstq4-1 \
libodbcinstq4-1:i386 \
libpth-dev \
libpthread-stubs0-dev \
libpthread-workqueue-dev \
libpthread-workqueue0 \
libqt4-opengl:i386 \
libstdc++5 \
libstdc++6:i386 \
libtiff4-dev \
libtool \
libzthread-2.3-2 libzthread-dev \
lsb-cxx \
make \
openssh-server \
pdksh \
rlwrap \
rpm \
sysstat \
unixodbc \
unixodbc-dev \
x11-utils \
zlibc 
Next install libstdc++5;
# wget http://nl.archive.ubuntu.com/ubuntu/pool/universe/g/gcc-3.3/libstdc++5_3.3.6-27.2ubuntu1_amd64.deb
# dpkg -i libstdc++5_3.3.6-27.2ubuntu1_amd64.deb 
and create some links for 64 bit libraries (this might not be necessary, yet another hack I need to verify);
# mkdir -p /usr/lib64
# ln -sf /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a /usr/lib64/libpthread_nonshared.a
# ln -sf /usr/lib/x86_64-linux-gnu/libc_nonshared.a /usr/lib64/libc_nonshared.a
Oracle 11gR2 needs gcc version 4.4 so fix that;
# cd /usr/bin
# rm gcc
# ln -s gcc-4.4 gcc
Now do the usual Oracle stuff for users and groups (http://docs.oracle.com/cd/E11882_01/install.112/e24324/toc.htm#CHDIDEFH);
# groupadd oinstall
# groupadd dba
# useradd -g oinstall -G dba -d /home/oracle -s /bin/bash oracle
# id oracle
uid=1000(oracle) gid=1000(oinstall) groups=1000(oinstall),1001(dba)
 
# mkdir /home/oracle
# chown -R oracle:oinstall /home/oracle
# mkdir -p /u01/app/oracle
# chown -R oracle:oinstall /u01/app
There are a bunch of symbolic links that are needed as Oracle expects some files in a different directory;
#  ln -s /usr/bin/awk /bin/awk
#  ln -s /usr/bin/rpm /bin/rpm
#  ln -s /usr/bin/basename /bin/basename
Now edit the following files as recommended by Oracle (http://docs.oracle.com/cd/E11882_01/install.112/e24324/toc.htm#CHDJHADA);
  • /etc/sysctl.conf 
  • /etc/security/limits.conf 
  • /etc/pam.d/login
  • /etc/profile
#  vi /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152

kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576

#  vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
#  vi /etc/pam.d/login
session required pam_limits.so
# vi /etc/pam.d/login
if [ $USER = "oracle" ]; then
    if [ $SHELL = "/bin/ksh" ]; then
        ulimit -p 16384
        ulimit -n 65536
    else
        ulimit -u 16384 -n 65536
    fi
fi
Now we're almost ready to get going.  We just need to get the software for which you'll need a My Oracle Support Account.  11.2.0.4 is actually a full install patch (13390677) and if all you want is the database and not grid infrastructure or 11gR2 client then you can just download parts 1 & 2 of the zip file.
p13390677_112040_Linux-x86-64_1of7.zip
p13390677_112040_Linux-x86-64_2of7.zip
Once you have both of these files unzip them in the same directory and run the installer.
# cd /tmp# unzip p13390677_112040_Linux-x86-64_1of7.zip
# unzip p13390677_112040_Linux-x86-64_2of7.zip
# cd /tmp/database/ 
# runInstaller -ignoreSysPrereqs
During this process you will still have to ignore errors on the prerequisites screen. Part way through the installation you will receive an error regarding "Error invoking target 'agent nmhs'...." at this point you need to jump into a terminal session and do the following;
# vi /u01/app/oracle/product/11.2.0/dbhome_1/sysman/lib/ins_emagent.mk
and change
$(SYSMANBIN)emdctl:
        $(MK_EMAGENT_NMECTL)
to
$(SYSMANBIN)emdctl:
        $(MK_EMAGENT_NMECTL) -lnnz11
Then back in the UI choose retry.

The installation should continue to the end and you will have successfully hacked your way to an 11gR2 (11.2.0.4) installation of Oracle Enterprise Edition on Ubuntu 14.04.

Finally for those of you that are interested I went round in 2 over net par.