Recipe for Ubuntu 14.04

Red text means instance specific values and green text content in a file, rest could be run in command prompt.

Internet

sudo gedit /etc/hosts
127.0.0.2 oracle

sudo gedit /etc/network/interfaces
auto lo:0
iface lo:0 inet static
address 127.0.0.2
netmask 255.0.0.0
auto lo:1
iface lo:1 inet static
address 127.0.1.1
netmask 255.0.0.0

sudo gedit /etc/resolvconf/resolv.conf.d/base
nameserver 127.0.0.1
nameserver 127.0.0.2

sudo apt-get install -s libnss-myhostname

java

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default

Swap

sudo dd if=/dev/zero of=/swapfile bs=1024 count=2097152
sudo mkswap /swapfile
sudo swapon /swapfile

Shared memory

sudo rm -rf /dev/shm
sudo mkdir /dev/shm
sudo mount -t tmpfs shmfs -o size=2048m /dev/shm

sudo gedit /etc/rc2.d/S01shm_load
#!/bin/sh
case "$1" in
start) mkdir /var/lock/subsys 2>/dev/null
touch /var/lock/subsys/listener
rm /dev/shm 2>/dev/null
mkdir /dev/shm 2>/dev/null
mount -t tmpfs shmfs -o size=2048m /dev/shm ;;
*) echo error
exit 1 ;;
esac

sudo chmod 755 /etc/rc2.d/S01shm_load

sudo cp /etc/rc2.d/S01shm_load /etc/rc5.d/

Kernel parameters

sudo gedit /etc/sysctl.conf
fs.file-max=6815744
fs.aio-max-nr=1048576
fs.suid_dumpable=1
kernel.shmmax=1073741824
kernel.shmall=524288
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
vm.hugetlb_shm_group=1001

Oracle users, groups and directories

sudo mkdir -p /u01/app/oracle
sudo mkdir -p /u02/oradata

sudo groupadd -g 502 oinstall
sudo groupadd -g 503 dba
sudo groupadd -g 504 oper
sudo groupadd -g 505 asmadmin
sudo groupadd nobody

sudo useradd -u 502 -g oinstall -G dba,asmadmin,oper -s /bin/bash -m -d /home/oracle oracle
sudo passwd oracle
sudo usermod -g nobody nobody

sudo chown -R oracle:oinstall /u01/app/oracle
sudo chown -R oracle:oinstall /u01
sudo chown -R oracle:oinstall /u01/app
sudo chown -R oracle:oinstall /u02/oradata
sudo chown -R oracle:oinstall /u02

Other files and directories

sudo gedit /sbin/chkconfig
#!/bin/bash
# Oracle 11gR2 XE installer chkconfig hack for Ubuntu
file=/etc/init.d/oracle-xe
if [[ ! `tail -n1 $file | grep INIT` ]]; then
echo >> $file
echo '### BEGIN INIT INFO' >> $file
echo '# Provides: OracleXE' >> $file
echo '# Required-Start: $remote_fs $syslog' >> $file
echo '# Required-Stop: $remote_fs $syslog' >> $file
echo '# Default-Start: 2 3 4 5' >> $file
echo '# Default-Stop: 0 1 6' >> $file
echo '# Short-Description: Oracle 11g Express Edition' >> $file
echo '### END INIT INFO' >> $file
fi
update-rc.d oracle-xe defaults 80 01

sudo chmod 755 /sbin/chkconfig

sudo mkdir /etc/sysconfig

Limits

sudo gedit /etc/security/limits.d/oracle.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240

sudo gedit /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240

sudo gedit /etc/pam.d/common-session
session required pam_limits.so

sudo gedit /etc/pam.d/common-session-noninteractive
session required pam_limits.so

“fake” installer, sudo and runlevel

sudo gedit /etc/redhat-release
Red Hat Linux release 5

sudo visudo -f /etc/sudoers.d/oracle
%oinstall ALL=(ALL) ALL

sudo gedit /etc/init/rc-sysinit.conf
env DEFAULT_RUNLEVEL=5 #changed from 2

 

Softlinks

sudo ln -s /usr/bin/basename /bin/basename
sudo ln -s bin/bash /usr/bin/bash
sudo ln -s /usr/bin/rpm /bin/rpm
sudo ln -s /usr/bin/awk /bin/awk

sudo ln -s /usr/lib/x86_64-linux-gnu /usr/lib64

sudo ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /lib64/libstdc++.so.6
sudo ln -s /lib/x86_64-linux-gnu/libgcc_s.so.1 /lib64/libgcc_s.so.1
sudo ln -s /usr/lib/i386-linux-gnu/libpthread_nonshared.a /usr/lib/libpthread_nonshared.a

sudo ln -s /lib/lsb/init-functions /etc/init.d/functions

 

install packages

sudo apt-get install libc6-i386
sudo apt-get install libc6-i386 gcc-multilib g++-multilib libc6-dev-i386 libstdc++6:i386
sudo apt-get install alien autoconf automake autotools-dev elfutils rpm rpm-common
sudo apt-get install build-essential debhelper expat gawk gsfonts-x11 html2text sysstat
sudo apt-get install unixodbc unixodbc-dev doxygen ksh openssh-server pax perl-doc pdksh rlwrap
sudo apt-get install lsb lsb-core lsb-cxx lsb-rpm lsb-desktop zlibc
sudo apt-get install lib32z1-dev lib32ncurses5 lib32bz2-1.0 lib32bz2-dev libaio1 libaio-dev
sudo apt-get install libelf-dev libbeecrypt7 libmotif4 libodbcinstq4-1 libpth-dev libpthread-stubs0-dev libpthread-workqueue0 libpthread-workqueue-dev
sudo apt-get install libtiff5-dev libzthread-dev libqt4-opengl:i386 libodbcinstq4-1:i386 libglu1-mesa:i386 openssh-server libtiff4-dev

sudo apt-get install -s cabextract
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install wimtools wimlib-dev

The database install

sudo gedit /etc/environment
PATH="/u01/app/oracle/product/11.2.0/xe/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin"
ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
LSNR=/u01/app/oracle/product/11.2.0/xe/bin/lsnrctl
SQLPLUS=/u01/app/oracle/product/11.2.0/xe/bin/sqlplus
ORACLE_OWNER=oracle
ORACLE_UNQNAME=XE
ORACLE_SID=XE
LOG=/u01/app/oracle/diag/tnslsnr/
hostname /listener/trace/listener.log
CLASSPATH=/u01/app/oracle/product/11.2.0/xe/jlib:/u01/app/oracle/product/11.2.0/xe/rdbms/jlib

NLS_LANG=SWEDISH_SWEDEN.AL32UTF8

or using .profile/.bashrc
sudo gedit /home/user/.profile
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export ORACLE_HOME_LISTNER=/u01/app/oracle/diag/tnslsnr/hostname/listener/trace/
export LSNR=$ORACLE_HOME/bin/lsnrctl
export SQLPLUS=$ORACLE_HOME/bin/sqlplus
export ORACLE_OWNER=oracle
export LOG="$ORACLE_HOME_LISTNER/listener.log"
export ORACLE_UNQNAME=XE
export ORACLE_SID=XE
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`
export PATH=$ORACLE_HOME/bin:$PATH


Test script, checking parameters etc

More details about installation and some little discussion