This is a simple HOWTO, for installing Oracle Database 11g Release 1 on Debian sid.
But why we need this HOWTO? Since Oracle only officially support Red Hat Enterprise Linux, SUSE Enterprise Linux and other enterprise level Linux distribution; BTW, there shouldn't be any problem if you hope to use with other distribution, which just need some special configuration and install required dependent packages. On the other hand, some dependent packages are obsoleted in Debian etch, but only available in oldstable or sid, so install with sid should be better than etch + hybrid sid packages.
"Hey man! Please stop for a while! I have no idea about how to working with Debian sid!"... Ooops... If this is your case, my other article should be your cup of tea. Go back now and let's enjoy with that for a bit while :-)
Before start you will need to prepare your Debian with:
- A complete Debian sid installation with X11.
- Static public IP address (or you may bind to localhost during installation).
- Functional hostname, e.g. hardcode it within
/etc/hostnameand/etc/hosts.
Check your hardware setup
First of all, you need to have AT LEAST 1GB of physical memory. Check it with:
grep MemTotal /proc/meminfoOn the other hand, it is suggest to have swap with 1.5 time of your physical memory, e.g. around 2GB. Check it with:
grep SwapTotal /proc/meminfoShared memory is very important, too. Or else you may face the ORA-00845 error message. First check it with:
df -kh /dev/shm/If you have less than 512MB (I will suggest for 1GB), edit your
/etc/fstaband add/modify the following line:
tmpfs /dev/shm tmpfs defaults,size=1024M 0 0Then remount it and check the size once again:
mount -o remount /dev/shm
df -kh /dev/shm/
Prepare network connection
Oracle 11g is highly depend on a correct network connection setup, especially the hostname and domain must be a valid value. On the other hand, I will suggest bind your Debian as localhost only, so you will even able to migrate the installation to other IP without reconfigure the Oracle installation.
Configure your /etc/hostname as below. Be careful that you MUST have a valid domain name (e.g. localdomain):
lostlhost.localdomainAlso make sure your /etc/hosts have this line:
127.0.0.1 localhost.localdomain localhostInstall dependence packages
As I assume you have Debian sid installed correctly with X11, we just need to dig into dependence packages installation directly:
apt-get install alien cpp-3.3 debhelper g++-3.3 gawk gcc-3.3 gcc-3.3-base gettext html2text intltool-debian ksh lesstif2 libaio-dev libaio1 libbeecrypt6 libdb3 libelf-dev libelf1 libg++2.8.1.3-glibc2.2 libltdl3 libltdl3-dev libmotif3 libodbcinstq1c2 libqt4-core libqt4-gui librpm4.4 libsqlite3-0 libstdc++2.10-glibc2.2 libstdc++5 libstdc++5-3.3-dev lsb lsb-core lsb-cxx lsb-desktop lsb-graphics lsb-qt4 odbcinst1debian1 pax po-debconf rpm sysstat unixodbc unixodbc-devWell, in case of AMD64, we need some modification:
apt-get install alien cpp-3.3 debhelper g++-3.3 gawk gcc-3.3 gcc-3.3-base gettext html2text intltool-debian ksh lesstif2 libaio-dev libaio1 libbeecrypt6 libdb3 libelf-dev libelf1 libltdl3 libltdl3-dev libmotif3 libodbcinstq1c2 libqt4-core libqt4-gui librpm4.4 libsqlite3-0 libstdc++5 libstdc++5-3.3-dev lsb lsb-core lsb-cxx lsb-desktop lsb-graphics lsb-qt4 odbcinst1debian1 pax po-debconf rpm sysstat unixodbc unixodbc-dev libc6-dev-i386
System groups and users
Check your existing setup with:
grep oinstall /etc/group
grep dba /etc/group
grep nobody /etc/group
id oracle
id nobodyMost likely, you should run the following command for create the required system groups and users. Latest Debian sid already come with user nobody so we don't need to retouch it:
addgroup --system oinstall
addgroup --system dba
useradd -r -g oinstall -G dba -m -s /bin/bash -d /var/lib/oracle oracle
passwd oracleConfigure kernel parameters
Check your existing setup with:
/sbin/sysctl -a | grep sem
/sbin/sysctl -a | grep shm
/sbin/sysctl -a | grep file-max
/sbin/sysctl -a | grep ip_local_port_rangeThen edit your /etc/sysctl.conf and add the following lines:
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144Run the following command to reload these kernel parameters:
sysctl -pShell limits for oracle user
Add the following to /etc/security/limits.conf as below:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536Check (or add) if the following line exits within /etc/pam.d/login:
session required /lib/security/pam_limits.soCheck (or add) if the following line exits within /etc/pam.d/su:
session required pam_limits.soAdd this lines to the tail of /etc/profile:
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fiCreate required directories
Create required directory and change permission:
mkdir -p /u01/app/oracle
mkdir -p /u02/oradata
chown -R oracle:oinstall /u01 /u02
chmod -R 775 /u01 /u02Configuring the oracle user's environment
Add following line to /var/lib/oracle/.profile (as i will create a AL32UTF8 database; change to US7ASCII if you will create ASCII database). This will also map Oracle's /bin to your $PATH so can run Oracle's binary directly when login as user oracle:
umask 022
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_1
export ORACLE_SID=AL32UTF8
export NLS_LANG=.AL32UTF8
unset TNS_ADMIN
if [ -d "$ORACLE_HOME/bin" ]; then
PATH="$ORACLE_HOME/bin:$PATH"
fiFake Oracle installer
As mentioned before , Debian is not listed as Oracle officially support platform and so we need to "fake" it. Create symbolic links:
ln -s /usr/bin/awk /bin/awk
ln -s /usr/bin/rpm /bin/rpm
ln -s /usr/bin/basename /bin/basename
ln -s /etc /etc/rc.dAlso mask ourself as RedHat:
echo 'Red Hat Linux release 4' > /etc/redhat-releaseLast step before installation start
First of all, login with your new oracle user, with X enabled.
If you are using PuTTY + Xming, for sure that the X11 forward is enabled.
Copy the file linux_11gR1_database.zip to oracle's home directory, then unzip it:
cp linux_11gR1_database.zip /var/lib/oracle
cd /var/lib/oracle
unzip -q linux_11gR1_database.zipI will STRONGLY suggest for a complete reboot, and double-check ALL pre-installation BEFORE starting the next step.
In case of X86, be sure that your
/usr/bin/gccis linked to correct location, e.g.:
lrwxrwxrwx 1 root root 7 2008-07-06 15:36 /usr/bin/gcc -> gcc-4.1
-rwxr-xr-x 1 root root 80976 2007-01-04 02:48 /usr/bin/gcc-3.3
-rwxr-xr-x 1 root root 196932 2008-06-24 10:23 /usr/bin/gcc-4.1
In case of AMD64, you will need to take some hack to gcc. Originally, your
/usr/bin/gccmay exist and similar as the case of that in X86. Remove it and replace with a new file as:
#!/bin/bash
if [ "$1" = "-m32" ]; then
gcc-4.1 -L/usr/lib32 $*
else
gcc-4.1 $*
fiYou need to do this BEFORE starting the Oracle 11g installer. After installation complete, you can roll this hack back as case before ;-)
Recommended installation procedures
Start the installer with:
cd /var/lib/oracle/database
./runInstallerNext we go though the installation with screenshots.
/var/lib/oracle/oraInventory.
General Purpose / Transaction Processing.
localhost.localdomain which seems to be a bit dummy.
Use the same password for all the accounts and apply the change.
Now you can access the EM page with https://localhost.localdomain:1158/em :-)
Autostart Oracle during system boot
There is almost for sure that you will hope to start your Oracle automatically during system boot. Even you may turn this feature off, but the init.d script is very useful, too.
First of all, specify which database instant will be started together with Oracle. Edit /etc/oratab as below:
AL32UTF8:/u01/app/oracle/product/11.1.0/db_1:YNext, create init.d script as /etc/init.d/oracle:
#!/bin/bash
#
# Run-level Startup script for the Oracle Instance and Listener
#
# chkconfig: 345 91 19
# description: Startup/Shutdown Oracle listener and instance
ORA_HOME="/u01/app/oracle/product/11.1.0/db_1"
ORA_OWNR="oracle"
# if the executables do not exist -- display error
if [ ! -f $ORA_HOME/bin/dbstart -o ! -d $ORA_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 - $ORA_OWNR -c "$ORA_HOME/bin/dbstart $ORA_HOME"
su - $ORA_OWNR -c "$ORA_HOME/bin/lsnrctl start"
#Optional : for Enterprise Manager software only
su - $ORA_OWNR -c "$ORA_HOME/bin/emctl start dbconsole"
touch /var/lock/oracle
echo "OK"
;;
stop)
# Oracle listener and instance shutdown
echo -n "Shutdown Oracle: "
#Optional : for Enterprise Manager software only
su - $ORA_OWNR -c "$ORA_HOME/bin/emctl stop dbconsole"
su - $ORA_OWNR -c "$ORA_HOME/bin/lsnrctl stop"
su - $ORA_OWNR -c "$ORA_HOME/bin/dbshut $ORA_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 0Permission is very important, too:
chmod 755 /etc/init.d/oracleFinally, install the script so Oracle will start during system bootup:
update-rc.d oracle defaults 99 01Encore...
If your Oracle 11gR1 EM keep on eating up your CPU up to 100%, sorry that you face a bug as me... Please follow my other article for more information and solution...
References
- http://www.oracle.com/technology/tech/php/zendcore/index.html
- http://www.oracle.com/technology/pub/articles/deployphp/kern_zco.html
- http://www.oracle.com/technology/tech/php/htdocs/inst_php_apache_linux.html
- http://www.togaware.com/linux/survivor/Oracle_10g.html
- http://www.cs.unm.edu/~luo/ora10g/Oracle10g.html


















Brilliant!
This is the most comprehensive and to the point howto I've found for 11g on debian. A very good summary of various bits of information that are spread out over the oracle forums and various blog postings.
I have a few updates to bring to this, I assume because sid has changed a bit since this was initially written:
First, about installing on etch, I think that would still be possible, the main problem will be a lack of 32 bit libaio, but I suppose you could get the lib from a 32 bit installation and put it in, or custom compile an updated package from sid for it.
Some of the recommended install packages are no longer available (gcc-3.3 for instance), and the generic package for 32 bit libraries is not mentioned.
I had problems with 32 bit libgcc.a not found, and apparently it's only in the gcc-snapshot package, so I made the gcc wrapper scripts point to that. I also made a g++ wrapper script, as some stuff in install/make.log indicated it was using it with -m32
The other problem I had was in the memory target when configuring the database, I couldn't set the target higher than ~2GB the system saying I didn't have that much available (a remnant from counting memory for 32 bit systems maybe). This system has 4GB and will only run the DB so I wanted to set my memory target fairly high .. anyway .. more space for OS buffers :)
Thanks for you support :-)
Thanks for you support :-)
The problem of libaio can be solve easily in case of Debian etch, if you know and also able to PLAY with Debian's APT pinning system. E.g. you may first pin your Debian to etch and install most suggested packages; then pin it as sid for getting those missing part (including some required dependence upgrade); and finally pin back to etch for starting Oracle installation. I have been using this method for quite a long period, but I am not going to introduce it for newbie. You will need a lot more of technical knowledge for handling those pinning and packages dependence conflict, which is something belongs to Debian itself but not Oracle. Using Debian sid directly would be the most simple solution for power users, as a drawback you should be responsible to handle this lovely toy.
You may also need to be careful about the different between X86 and AMD64, and carefully following those installation guideline as mentioned above. In case of X86 (32bit), all required packages are mentioned and it is now working happily with my KVM virtual client; In case of AMD64 (64bit),
ia32-libsis required for backward compatibility where the other are remain as 64bit, and additional gcc hack is needed (which will solve your -m32 problem).The final question for memory should belongs to the different of X86 and AMD64. In case of X86, usually you will only able to use 3GB memory as maximum, where AMD64 is relatively unlimited (in TB scale). That may be a bit tricky in choosing X86 or AMD64 for base OS installation. According to my study, usually I will install the host OS as AMD64 (AMD X2 CPU + 4GB main memory: my most efficiency development testbed combination), and running Oracle installation as a X86 KVM virtual client (single qemu CPU + 2GB main memory). This is the most flexible solution that I have been discovered up to now, and hopefully may act as your reference :-)
----------------------------------------
Edison Wong
Post new comment