March 20th, 2012
A Step by Step guide on installing Crunchbang Linux (A Debian based lightweight distro – referred to as #! from here on) and configuring it for, and installing, Oracle 11g R2 Enterprise Edition.
Downloading ISO file and Installing Crunchbang
First of all make sure the MD5 checksum given on the download page matches your downloaded file. I used MD5 for Mac OSX, Linux comes with MD5, Windows you will need to download a 3rd party MD5 checker. You can burn without doing this of course, but at least validate the data is readable and correct with your burner software. That is no substitute for MD5 though, so you have no guarantees using this method. It took me three attempts to get a valid download file, in the end using a bit torrent client for better stability.
Once you have your bootable CD (i.e. you have burned the iso image file using suitable software) then installation of #! is reasonably straightforward. Assumptions here are a clean install on an intel based x86 desktop PC/Server.
Once your selections are made re. country/language/network name/user name etc. the installation asks for partitioning information. To keep it simple, and because this is going to be my own Oracle sandpit server, I created the following partitions:
#1 primary 10GB /
#5 logical 3GB swap
#6 logical 150GB /home
But you can configure to suit your needs of course. The default partitions as recommended by the installer seemed a little tight on space to me, and I didn’t want to have to mess around with the volumes during the Oracle install, hence my simple approach.
OK, so once done, the changes are written to disk and the system installs. #! Is a lightweight distribution and it installs pretty quickly. Its a fairly hands on OS, which is why I chose it.
Once installed and rebooted, the system prompts you to run ‘cb-welcome’ which I did. NB Internet connection required. (My ASUS USB Wireless Card was detected and wireless connection was easy. I would stay away from Netgear though, if possible, which I learned from many lost days during previous Linux installations.) [UPDATE: I had to turn power management off for the ASUS USB adapter for stability of connection. I wrote 'iwconfig wlan0 power off' into the /etc/rc.local file so it is run at startup.]
cb-welcome guides you through the latest system changes and also installs things like Printer Support and Java Runtime Environment.
Crunchbang really is very easy to install. Oracle, however, is a slightly different kettle of fish…
Prerequisites for Oracle 11g
Once cb-welcome has run through the following prerequisites were checked and installed if required. Obviously, if your linux installation is missing any of the packages I have marked as ‘already installed’ just install them using apt-get as normal. Need to SUDO to root user or be root for all these.
binutils – already installed
autconf - REQUIRED – (run apt-get install autoconf)
automake - already installed
bzip2 - already installed
gcc - already installed
less - already installed
libc6-dev - already installed
make - already installed
libstdc++5 - REQUIRED (apt-get install libstdc++5)
unzip - already installed
zlibc - REQUIRED (apt-get install zlibc)
libaio1 - REQUIRED (apt-get install libaio1)
build-essential - already installed
Also, the packages unixODBC, unixODBC-dev, elfutils, sysstat, pdksh and expat are not mandatory requirements, but the installer does check for them so I recommend installing. None of them are very large.
For the x-terminal I used fluxbox as it was recommended elsewhere. Any will do though.
apt-get install fluxbox
Set Up Oracle User and Groups
useradd oracle -m -d /home/oracle -g oinstall -G dba -s /bin/bash
Kernel Settings & Limits
To keep things simple I have put these into three scripts:
ksettings.sh lists all current settings
setmin.sh sets all required parameters to the minimum required by Oracle
setlimits.sh adds the limit parameters required by Oracle
Create Directories & Permissions
Many DBAs have specific ways of creating directories, separating data types, recovery files, pfiles, striping across disks etc. This is no production database though, so I am again keeping things nice and simple and creating the minimum I require.
Firstly navigating to /home which is my largest partition.
mkdir -p u01/app/oracle
mkdir -p u02/oradata
mkdir -p u03/recovery_area
chown -R oracle:oinstall u01 u02 u03
chmod -R 775 u01 u02 u03
To prevent a couple of errors when the Oracle installer tries to link some libraries located slightly differently within Debian systems, add the following links:
ln -s /usr/bin/awk /bin/awk
ln -s /usr/bin/basename /bin/basename
Running The Oracle Intaller
Assuming you have downloaded, checksummed, unpacked and transferred over your Oracle files….
Debian and certainly Crunchbang is unsupported at Oracle so some PreReqs will appear to be missing during Install. So, we can ignore them! Include the -ignoreSysPrereqs flag when running the installer. If the steps above have been successful (and you can check them again now with the ksettings.sh script) then installation should complete. Remember to run this as oracle!
Nb: If running this directly on the server and not through an XTerminal or anything, the main user (the user you entered when installing #!) needs to issue the command ‘xhost +’ Once you have SU’d to oracle, oracle needs to export the DISPLAY variable, like ‘export DISPLAY=”:0.0″ – This will allow the Installer to run correctly.
Work through the installer making as many or as few changes as you require. A lot of defaults are already set. Ignore the Prerequisite Checks failures (if any) – as long as above steps were followed, Oracle will install.*
And that’s it. Oralce 11g Enterprise Edition installed on an Openbox Linux distribution. Now wasn’t that more fun than installing Express Edition on Windows?
* UPDATE – UBUNTU 12.10
Having just installed Oracle 11g on Ubuntu 12.10 following my own guide above, spending a long and frustrating day doing so (fun though eh?), the additional steps below need to be followed. This took me ages to locate, so putting them here so you don’t have to
First of all you might get errors saying some files can’t be found. These files are there and are are easily fixed using symbolic links as we did above with awk etc. Just set a symbolic link from /lib/i386-linux-gnu/<filename> to either /lib or /usr/lib as required (the error messages explain all. Look in the make.log in the ‘install’ directory under ORACLE_HOME)
Next, you will get some errors during the linking phase of the install. Once you get the first error:
Error in invoking target 'agent nmhs' of makefile
you need to open up a terminal, su to root user, and run the following:
export ORACLE_HOME=<path to oracle_home>
sed -i 's/^\(\s*\$(MK_EMAGENT_NMECTL)\)\s*$/\1 -lnnz11/g' $ORACLE_HOME/sysman/lib/ins_emagent.mk
Then you can hit ‘Retry’.
On the next error, which is actually a biggy and a long list of errors (check the make.log if you want to depress yourself) you need to open up a terminal, su to root user, and run the following:
export ORACLE_HOME=<path to oracle_home>
sed -i 's/^\(\$LD \$LD_RUNTIME\) \(\$LD_OPT\)/\1 -Wl,--no-as-needed \2/g' $ORACLE_HOME/bin/genorasdksh
sed -i 's/^\(\s*\)\(\$(OCRLIBS_DEFAULT)\)/\1 -Wl,--no-as-needed \2/g' $ORACLE_HOME/srvm/lib/ins_srvm.mk
sed -i 's/^\(TNSLSNR_LINKLINE.*\$(TNSLSNR_OFILES)\) \(\$(LINKTTLIBS)\)/\1 -Wl,--no-as-needed \2/g' $ORACLE_HOME/network/lib/env_network.mk
sed -i 's/^\(ORACLE_LINKLINE.*\$(ORACLE_LINKER)\) \(\$(PL_FLAGS)\)/\1 -Wl,--no-as-needed \2/g' $ORACLE_HOME/rdbms/lib/env_rdbms.mk
Again, hit the ‘Retry’ button.
After this it went very smoothly with no issues at all.
One quirk, which I think might be common across all distributions, is any special characters in passwords you select during database creation will cause an ORA-00992 error. Don’t know why. Don’t care. Just ignore it and reset passwords at the end. Or, better still, use non special character passwords. Has to be a bug…
There are loads of posts out there regarding Enterprise Manager and Listeners, automatic starting of db etc. etc. so not going to repeat them here.