Search My Blog

Wednesday, July 28, 2010

Installing Oracle 11gR2 on Fedora 13

So, here is my "short" copy of how to install Oracle 11gR2 on a Fedora 13 box. Sorry if the formating is a little rough......
 
Pre-Requisite Checks
Hosts File
The /etc/hosts file must contain a fully qualified name for the server:

Example:
    127.0.0.1 localhost localhost.myhost.com localhost
    192.168.1.101 Fedora13Dev Fedora13Dev.myhost.com Fedora13Dev

Set Kernel Parameters
Oracle recommends the following minimum parameter settings:

    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 = 1048586

The current values can be tested using the following command:
    /sbin/sysctl -a | grep < command parameter > 

Add or amend the following lines in the "/etc/sysctl.conf" file. The raw Fedora 13 install didn’t have any of these, so I just added them to the end of the sysctl.conf file.

           fs.aio-max-nr = 1048576
           fs.file-max = 6815744
           kernel.shmall = 2097152
           kernel.shmmax = 536870912
           kernel.shmmni = 4096
           # semaphores: semmsl, semmns, semopm,semmni
           kernel.sem = 250 32000 100 128
           net.ipv4.ip_local_port_range = 9000 65500
           net.core.rmem_default=4194304
           net.core.rmem_max=4194304
           net.core.wmem_default=262144
           net.core.wmem_max=1048586

Run the following command updated the new current kernel parameters:

           /sbin/sysctl –p

Add the following lines to the /etc/security/limits.conf file:

           oracle soft nproc 2047
           oracle hard nproc 16384
           oracle soft nofile 1024
           oracle hard nofile 65536

Add the following line to the /etc/pam.d/login file:

           session required pam_limits.so

Disable (or set it to permissive) Secure Linux (SELinux) by editing the /etc/selinux/config file, making sure the SELINUX flag is set as follows:

           SELINUX=permissive
OR
           SELINUX=disabled

NOTE: You could use the GUI tool (Applications -> System Settings -> Security Level). Click on the SELinux tab and disable/permissive the feature. (You need to reboot if you disable it)

Update/Install Required Modules

I cheated here. Some of the modules might have existed… but if you run this it will update them. And, since I used wildcards it added a few I didn’t need…but I’m not concerned. You need to be root for this:

           yum install binutils-2.*\
             nanoelfutils-libelf*\
             gcc-4.*\
             gcc-c++-4.*\
             glibc-2.*\
             glibc-common-2.*\
             glibc-devel-2.*\
             glibc-headers-2.*\
             ksh*\
             libgomp-4.*\
             libgcc-4.*\
             make-3.*\
             sysstat*\
             libaio-*\
             glibc-2*\
             compat-libstdc++*\
             libgcc-*\
             libstdc+*\
             unixODBC*

Create the new groups and users
You need to be root for this:

           groupadd oinstall           groupadd dba           groupadd oper           groupadd asmadmin           useradd -g oinstall -G dba,oper,asmadmin oracle           passwd oracle

Note. The"asmadmin" group is for ASM. I’m not planning on using ASM. So, its just getting created for “throughness”. I’m going to lock it in the OS.


Create the directories in which the Oracle software will be installed
You need to be root for this:

           mkdir -p /u01/app/oracle/product/11.2.0/db_1           chown -R oracle:oinstall /u01           chmod -R 775 /u01

As root and issue the following command
I’m not doing it via an xterm connection… so you could skip this:

           xhost +<machinename>

Login as the oracle user and add the following lines at the end of the .bash_profile file

           # Oracle Settings 

export TMP=/tmp   
export TMPDIR=$TMP
export ORACLE_HOSTNAME=Fedora13Dev   
export ORACLE_UNQNAME=DB11G   
export ORACLE_BASE=/u01/app/oracle   
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1   
export ORACLE_SID=DB11G   
export ORACLE_TERM=xterm   
export PATH=/usr/sbin:$ORACLE_HOME/bin:$PATH    
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib   
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib


           if [ $USER = "oracle" ]; then
             if [ $SHELL = "/bin/ksh" ]; then
              ulimit -p 16384
              ulimit -n 65536
             else
              ulimit -u 16384 -n 65536
             fi
           fi

Edit the /etc/redhat-release file
Replacing the current release information (Fedora release 13 (Goddard)) with the following:

           redhat release 5

Procedure to add a swap file
Depending on your current config, you might need to add more swap space. You need to use dd command to create swapfile. Then, you need to use mkswap command to set up a Linux swap area on a device or in a file. As root:

Create 512MB swap file (1024 * 512MB = 524288 block size):

           dd if=/dev/zero of=/myextraswap bs=1024 count=524288
           mkswap /myextraswap
           swapon /myextraswap
This will only work unit the box is rebooted, so to make it permanant you need to add an entry to /etc/fstab file.

           nano /etc/fstab

Add following line:

           /myextraswap swap swap defaults 0 0

Ok. So, at this point you are ready to run the Oracle 11gR2 installer. However, it is going to fail when it tries to compile/link the Oracle Enterprise Manager parts. (Error will be something like “'agent nmhs' linking error”) So, in order to avoid this I recommend the following:

How to avoid the 'agent nmhs' linking Error

When you start to install with ./runInstaller (you should be running this as oracle…i.e. the ‘oracle’ user), spawn another terminal window (as root). While runInstaller is executing the “Install Product” phase.

           ls /u01/app/oracle/product/11.2.0/db_1/sysman/lib/ins_emagent.mk

At first this will produce an error, as the “Install Product” phase will not have created this file yet.
Once the file exists, do:

           nano /u01/app/oracle/product/11.2.0/db_1/sysman/lib/ins_emagent.mk

Search for the line

           $(MK_EMAGENT_NMECTL)

Change it to:

           $(MK_EMAGENT_NMECTL) -lnnz11

Save the file. If you are fast enough, everything should just compile and be happy…. If you get an error, you were not fast enough… just finish your edit then click on “Retry” in the popup.
Official Linking error is:

           INFO: /usr/bin/ld:
           /u01/app/oracle/product/11.2.0/db_1/sysman/lib/libnmectl.a(nmectlt.o):
           undefined reference to symbol 'B_DestroyKeyObject'
           /usr/bin/ld: note: 'B_DestroyKeyObject' is defined in DSO
           /u01/app/oracle/product/11.2.0/db_1/lib/libnnz11.so so try adding it to
           the linker command line /u01/app/oracle/product/11.2.0/db_1/lib/libnnz11.so:
           could not read symbols: Invalid operation
           collect2: ld returned 1 exit status

This means that the gcc linker phase lacked an option for "-lnnz11”

Post Installation

Re-Edit the /etc/redhat-release file
Replacing the current release information (redhat release 5) with the following:

           Fedora release 13 (Goddard)

If you didn’t select to create a DB during the install.
You will need to run the Network Configuration Assistant (netca) and the Database Creation Assistant (dbca)

           netca           dbca

netca was used to create a default listener. The file will be located in:
/u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora

Sometimes, the listener, at startup, doesn't register the DB correctly. So, to "force" it I like to hard code it into the listener file. Here is an example of that:
SID_LIST_LISTENER=
  (SID_LIST=
    (SID_DESC=
      (GLOBAL_DBNAME=DB11G)
      (ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1)
      (SID_NAME=DB11G)
    )
  )
You can test that you listener can see your DB using the tnsping commandline tool. Or, by checking
lsnrctl status

Edit the /etc/oratab file
Now, fix the database to restart each instance to 'Y'. This assumes you took the default ORACLE_SID (DB11G) when creating the database.

           DB11G:/u01/app/oracle/product/11.2.0/db_1:Y