First of all start by download the Oracle Database 11g 64-bit from Oracle Technology Network. While you wait for the download, finish some of the pre-install tasks:
1. Insert the following lines to /etc/sysctl.conf
kernel.shmall = 15032385536
kernel.shmmax = 4294967296
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6553600
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=262144
Most of these parameters are set by default to the correct parameters, however we can include them just to be sure or if you are feeling a little lazy to check their values one by one. It is also important to note that kernel.shmmax & kernel.shmall are in bytes. kernel.shmmax is the maximum size of any shared memory chunk (the amount of memory a process can allocate at a time). kernel.shmall determines the maximum amount of memory that all shared memory can take. So it is often good practice to set kernel.shmmax to half the size of physical RAM and to set kernel.shmmax to about 75%-85% of physical RAM available on server.
type sysctl -p as root to apply the settings without a reboot.
2. Open /etc/security/limits.conf and insert the following lines:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
3. Open /etc/pam.d/login and add the following lines:
session required /lib/security/pam_limits.so
session required pam_limits.so
4. Disable SELinux:
Open /etc/selinux/config and set the parameter SELINUX=disabled
Reboot the system for the new changes to take effect.
5. Install the necessary packages to install oracle:
[root@linux ~]# yum -y install binutils
[root@linux ~]# yum install glibc glibc-common libgcc libstdc++
[root@linux ~]# yum install make
[root@linux ~]# yum install elfutils-libelf elfutils-libelf-devel
[root@linux ~]# yum install glibc-devel gcc gcc-c++ libstdc++-devel
[root@linux ~]# yum install unixODBC unixODBC-devel
[root@linux ~]# yum install libaio libaio-devel
[root@linux ~]# yum install sysstat
[root@linux ~]# yum install php-devel
[root@linux ~]# yum install php-pear
I had some trouble with Oracle Universal Installer reagarding the 64-bit architecture. In order to successfully pass Oracle Installer pre-checks I had to install some of the 32-bit binaries and libraries too. I searched for the latest version of these binaries from rpmfind.net and downloaded them. And used yum to install them locally.
[root@linux ~]# wget ftp://rpmfind.net/linux/fedora/development/i386/os/Packages/compat-libstdc++-33-3.2.3-64.i386.rpm
[root@linux ~]# wget ftp://rpmfind.net/linux/fedora/releases/10/Everything/x86_64/os/Packages/compat-libstdc++-33-3.2.3-64.x86_64.rpm
[root@linux ~]# wget ftp://rpmfind.net/linux/fedora/releases/10/Everything/i386/os/Packages/libaio-0.3.107-4.fc10.i386.rpm
[root@linux ~]# wget ftp://rpmfind.net/linux/fedora/releases/10/Everything/i386/os/Packages/libstdc++-4.3.2-7.i386.rpm
[root@linux ~]# wget ftp://rpmfind.net/linux/fedora/updates/10/x86_64/glibc-devel-2.9-3.i386.rpm
[root@linux ~]# yum –localinstall *
6. Change the /etc/redhat-release file to include the following:
Red Hat Enterprise Linux Server release 5 (Tikanga)
7. Create the necessary users and groups for oracle:
[root@linux ~]# groupadd oinstall
[root@linux ~]# groupadd dba
[root@linux ~]# groupadd oper
[root@linux ~]# groupadd asmadmin
[root@linux ~]# useradd -g oinstall -G dba,oper,asmadmin oracle
Change the password for oracle user account:
[root@linux ~]# passwd oracle
8. Create the necessary directories and give the permissions:
[root@linux ~]# mkdir -p /u01/app/oracle/product/11.1.0/db_1
[root@linux ~]# chown -R oracle:oinstall /u01
[root@linux ~]# chmod -R 775 /u01
9. Set the environment variables for the oracle user in file /home/oracle/.bash_profile:
# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_HOSTNAME=localhost; export ORACLE_HOSTNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_1; export ORACLE_HOME
ORACLE_SID=ORCL; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
Save the file.
10. Login to Oracle user and start the Oracle Installation:
[oracle@linux ~]$ unzip linux.x64_11gR1_database_1013.zip
[oracle@linux ~]$ cd database
[oracle@linux ~]$ ./runInstaller
Continue the step-by-step wizard to install Oracle 11g. After installation, open a web browser and visit https://localhost:1158/em/. Confirm the security excemption for SSL certificate and if you see the Oracle Enterprise Manager Interface; the installation went well.
11. Auto starting and stopping Oracle 11g:
First edit /u01/app/oracle/product/11.1.0/db_1/bin/dbstart script:
Change the line reading ORACLE_HOME_LISTNER=$1 to ORACLE_HOME_LISTNER=$ORACLE_HOME
then do the same for /u01/app/oracle/product/11.1.0/db_1/bin/dbshut script.
Now create a file /etc/init.d/oratab with the following contents:
#!/bin/sh
# chkconfig: 345 99 10
# description: Oracle auto start-stop script.
#
# Set ORA_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
#
# Set ORA_OWNER to the user id of the owner of the
# Oracle database in ORA_HOME.
ORA_HOME=/u01/app/oracle/product/11.1.0/db_1
ORA_OWNER=oracle
#if [ ! -f $ORA_HOME/bin/dbstart ]
#then
# echo “Oracle startup: cannot start”
# exit
#fi
case "$1" in
'start')
# Start the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
# su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart"
su - $ORA_OWNER -c "$ORA_HOME/bin/emctl start dbconsole"
;;
'stop')
# Stop the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c "$ORA_HOME/bin/emctl stop dbconsole"
su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut"
# su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
;;
esac
then do:
[root@linux ~]#chmod 750 /etc/init.d/oratab
[root@linux ~]# chkconfig oratab on
[root@linux ~]# ln -s /etc/init.d/oradb /etc/rc.d/rc3.d/K01oradb
[root@linux ~]# ln -s /etc/init.d/oradb /etc/rc.d/rc5.d/K01oradb
That will start and stop oracle on system reboot. Oracle can also be started and stopped using the service command of Fedora once this is done. If you want Oracle 11g itself on the server then the chapter is closed. However I need to run Apache along with Oracle 11g on this server. Therefore I should run Apache and PHP along with OCI8 extension which will call the internal Oracle Database 11g.
12. Set the environment variables for OCI8:
Edit /etc/profile and /etc/init.d/httpd files to include the following line:
export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1
13. Install OCI8:
[root@linux ~]# pecl install oci8
when the script asks for oracle path, simply press Enter. The module will compile and install automatically. Then edit /etc/php.ini to include:
extension=oci8.so
14. Start Apache and test connection:
[root@linux ~]# service httpd start
create a file called index.php with the following content in /var/ww/html :
echo $conn1 = oci_connect('username', 'password', '//localhost/SID');
change the appropriate values to suit your installation. Visit http://localhost/ from a browser and the output should print a resourceID. That’s all, enjoy!