Installing Oracle11 on Debian Wheezy, Squeeze (and Lenny)
Posted by kroshka on Thu 15 Jul 2010 at 11:55
The main goal is to get the Oracle installer to run so you can install Oracle successfully. This application has to run within X windows. We will use vnc for that, this is not necessary, but you may (often) find you have to install Oracle remotely. And using something like vnc sure beats spending time in a noisy server room.
Debian Lenny was used to write the initial guide. I have since migrated a few Oracle11 servers from Lenny to Squeeze and I did quite a number of fresh Oracle11 installs on squeeze and wheezy. There is a tiny problem with regards to the name of a package and a problem regarding vm/hugetlb_shm_group (see below note Tuning kernel parameters). This guide should work on Wheezy, Squeeze and Lenny without much difficulty.
Getting Oracle11 from the Oracle website
Normally you should find two zip files. Download and unzip them, in /opt for example. You should end up with a directory called database.
Making Debian a bit more compatible
We should install a few packages so that the Oracle installer will be able to do its thing:Note: on Lenny use libmotif3
Note2: normally libstdc++6 is already present, but oracle stupidly insists on libstdc++5.
apt-get install gcc make binutils libmotif4 lesstif2 rpm libaio1 libdb4.6 libstdc++5
The following 2 steps will make the Debian environment look a bit like Red Hat so the installer will not complain. I am not sure if this is still necessary for Oracle11, but it's not affecting anything.
Create symlinks so the installer can find a few utilities it needs:
ln -s /usr/bin/awk /bin/awk ln -s /usr/bin/rpm /bin/rpm ln -s /usr/bin/basename /bin/basename
Create an rc.d symlink:
ln -s /etc /etc/rc.d
Oracle account and volumes
Create an account and group:
groupadd oinstall groupadd dba useradd -m -g oinstall -G dba -p passwd -s /bin/bash -d /home/oracle oracle passwd oracle <-- change password!
It's useful to have a few default volumes and/or directories in place, such as /u01 and /u02. /u01 is used to install Oracle and in my case I am not using it to store databases. In this case it's symlinked from /home, and I use /u02 to store databases and ideally should be a separate RAID volume, the same goes for /u03, etc. Anyways, you could choose whatever you prefer of course.
mkdir /home/u01 ln -s /home/u01 / mkdir /u02/oradata <-- assuming it's already mounted chown -R oracle.oinstall /home/u01 /u02/ chmod -R 775 /home/u01 /u02/
Change ownership of the directory from where we will run the Oracle installer:
chown -R oracle.oinstall /opt/database
Tuning kernel parameters
Oracle11 expects a few kernel parameters to be changed from its default. Some are different, i.e. higher, than for Oracle10. The below is what I used on a system with 4 CPU cores and 32 GB RAM, your mileage may vary and I am not sure if this is very optimal, but it worked.
Edit /etc/sysctl.conf and add the following at the bottom:
kernel.sem = 250 32000 100 128 kernel.shmmax = 2147483648 net.ipv4.ip_local_port_range = 9000 65000 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576 fs.aio-max-nr = 1048576 fs.file-max = 6815744
Please note: after migrating from Lenny to Squeeze I had to add the following to sysctl.conf in order to be able use HugePages. This is enabled by default in the Debian kernel and increases performance, but the oracle/dba group may not be allowed to use it. See this for a discussion about it, dba_group_gid is the GID number of the dba group.
vm/hugetlb_shm_group = dba_group_gid
Now you can make those changes live:
Configure the Oracle account environment
Change a few settings in the /etc/security/limits.conf file:
* soft nproc 2047 * hard nproc 16384 * soft nofile 1024 * hard nofile 65536
Make sure session required pam_limits.so module for PAM is being used. i.e. Ensure that pam_limits.so is included in the following files and is NOT commented out:
/etc/pam.d/su /etc/pam.d/login /etc/pam.d/sshd
Edit /etc/profile and add the following:
if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fiThe umask should be 022, this tends to be the system default so there is no need to set it. In case you do need to set it you can do so in /etc/profile or in /etc/login.defs (wheezy) or use pam_umask.
Edit /home/oracle/.profile and add (this will change slightly after install):
ORACLE_BASE=/u01/app/oracle ORACLE_SID=instancename export ORACLE_BASE ORACLE_SID unset ORACLE_HOME unset TNS_ADMIN
Setting up X and vnc to run the Oracle installer
Now we need to set up a minimal X environment (if it's not installed, which is not unusual for a server) in order to run the Oracle installer. I prefer to have no X environment on a server unless necessary and then I would like to keep it as minimal as possible.
Install the following packages, which include a dummy X server, xterm and a minimal window manager:
apt-get install xserver-xorg-video-dummy vnc4server x11-xserver-utils xterm wm2
As user oracle run vnc4server, then kill it and edit /home/oracle/.vnc/xstartup and add the following 2 lines to the bottom. This makes sure a window manager and terminal will be started without much problems:
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & wm2 &
Running the Oracle installer
Now run vnc4server again as user oracle. Connect to this server from your own machine and run the Oracle installer within the terminal, which should be named runInstaller and can be found wherever you unzipped the Oracle11 zipfiles. The installation should be fairly self explanatory. The installer WILL complain about a few things not being the way it expects it to be. It will list them as fail. It is safe to ignore it and continue. Near the end the installer once again will complain about some compilation error, which you too can safely ignore.
Note:  If you get more than one or two compilation errors it's possible tools such as dbca will not be installed. Please see the note at the bottom of this article on how to solve such compilation errors.
After the installer finished do some cleanup
Edit /home/oracle/.profile and edit the change you previously applied to become:
ORACLE_BASE=/u01/app/oracle ORACLE_SID=instancename ORATAB=/etc/oratab export PATH=$PATH:/u01/app/oracle/product/11.2.0/dbhome_1/bin/ export ORACLE_BASE ORACLE_SID ORATAB export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1 unset TNS_ADMIN
In order to automatically start and stop Oracle at (re)boot create /etc/init.d/oracle and add:
#!/bin/bash # # Run-level Startup script for the Oracle Instance and Listener # # chkconfig: 345 91 19 # description: Startup/Shutdown Oracle listener and instance ### BEGIN INIT INFO # Provides: oracle # Required-Start: $remote_fs $syslog $all # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Oracle database server # Description: Oracle database server ### END INIT INFO ORACLE_HOME="/u01/app/oracle/product/11.2.0/dbhome_1" ORACLE_OWNR="oracle" # if the executables do not exist -- display error if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ] then echo "Oracle startup: cannot start" exit 1 fi # depending on parameter -- startup, shutdown, restart # of the instance and listener or usage display 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: $0 start|stop|restart|reload" exit 1 esac exit 0
Now make that live by running:
update-rc.d oracle defaults
You should now have a fresh Oracle11 installation. This was the easy part...
Note: While installing Oracle you sometimes may stumble upon compilation errors. Even though those are not fatal it may mean tools such as dbca are not available. To fix these you will need to do a little detective work. It looks like this is especially the case on Debian releases newer than squeeze. Check the make log file, it will tell you exactly what it is trying to find:
/usr/bin/ld: cannot find /usr/lib/libpthread_nonshared.aAssuming you have the right packages installed this normally means such files are in a slightly different location. Try to find it:
find /usr/lib -name libpthread_nonshared.aIn case of a 64 bits system it could be in /usr/lib/x86_64-linux-gnu/, create a symlink this way:
ln -s /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a /usr/lib/libpthread_nonshared.aNote: It's possible the Oracle installer stupidly looks for some libraries in /lib64 and /usr/lib64 instead, and these directories do not exist in wheezy. In that case create these directories and the above command would look like this:
ln -s /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a /usr/lib64/libpthread_nonshared.aIn case of a 32 bits system:
ln -s /usr/lib/i386-linux-gnu/libpthread_nonshared.a /usr/lib/libpthread_nonshared.aThen hit retry in the installer and repeat this for the other compilation errors. Common symlinks I had to create (replace x86_64 with i386 if using 32 bits system):
ln -s /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a /usr/lib/ ln -s /usr/lib/x86_64-linux-gnu/libc_nonshared.a /usr/lib/ ln -s /lib/x86_64-linux-gnu/libgcc_s.so.1 /lib/ ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/lib/On wheezy:
ln -s /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a /usr/lib64/libpthread_nonshared.a ln -s /usr/lib/x86_64-linux-gnu/libc_nonshared.a /usr/lib64/ ln -s /lib/x86_64-linux-gnu/libgcc_s.so.1 /lib64/ ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/lib64/
Another compilation error prevents EM from being built properly. Although this is not essential and you can run Oracle fine after continuing, many people, including me, would like to be able to use it. There is a simple, albeit not too obvious fix. Please see https://cn.forums.oracle.com/forums/thread.jspa?threadID=1091616 for a discussion. You will find an error such as this in make.log:
/usr/bin/ld: note: 'B_DestroyKeyObject' is defined in DSO /u01/app/oracle/product/11.2.0/dbhome_1/lib/libnnz11.so so try adding it to the linker command line /u01/app/oracle/product/11.2.0/dbhome_1/lib/libnnz11.so: could not read symbols: Invalid operation collect2: error: ld returned 1 exit statusThe log actually provides you with a hint on how to solve it. What you do is you run the make by hand, then wait for the error and run the last compilation with the necessary arguments added:
cd $ORACLE_HOME/sysman/lib make -f ins_emagent.mk "agent"When it errors copy paste the last gcc command and add the following to the end:
-lnmemso -lcore11 -lnnz11