Wednesday, April 28, 2010

Oracle 11g Software Installation on Linux—CentOS-5

SkyHi @ Wednesday, April 28, 2010

Introduction

This paper takes a look at installing Oracle 11g (11.1) on Linux (CentOS-5).You can read about CentOS at www.centos.org and be assured of its' Enterprise-class quality. This paper will use Oracle's Quick Installation Guide for Linux x86 as its' guide—noting where additional information may be obtained but getting Oracle installed on Linux as fast as possible. We at thecheapdba.com have years of experience installing Oracle—starting back with Oracle 7. We will point out best practices so that you end up with a reliable database that provides exceptional performance. We will occasionally re-visit, edit, and post additions to this paper as we find further configuration best practices.

This paper will not cover the installation of CentOS-5 as that can be acquired through the CentOS website and additional Linux guides. We will however point out those alterations to the Linux environment that pertains to getting Oracle installed.

Our goal is to provide you with the steps to properly install the Oracle 11g software without having to read Oracle's installation guide from front to back cover. We will provide you the commands to execute (just cut-n-paste) and the desired outcome of those commands. If you get something other than what is expected it would be time for you to re-visit earlier steps in this process. So hold on, here we go.

It is assumed that the installer of Oracle software has access and is running on an X Window System workstation. Please consult X Server documentation if you need help. We at thecheapdba.com typically will use cygwin ( www.cygwin.com ) for all interfacing with our Linux distribution. It has an X Window System that works quite well—and as we always like is free.

Checking Hardware Requirements

Log into the CentOS-5 system as the root user.

For setting up the system to be used by Oracle there are a few prerequisites that must be checked and possibly changed by the root user. Log in as the root user and this document will tell you when it is time to switch from the root user to someone else.

How much memory

command: grep -i memtotal /proc/meminfo

results: should be at least 1GB

How much swap

command: grep -i swaptotal /proc/meminfo

results: should be 1.5 the size of memtotal if memtotal <>

should be equal to memtotal if memtotal is between 2GB and 8GB

should be .75 the size of memtotal if memtotal > 8GB

What processor type

command: grep "model name" /proc/cpuinfo

results: informational

How much available RAM and swap

command: free

results: informational

How much shared memory available

command: df -k /dev/shm

results: informational

purpose: The shared memory should be sized to be at least the greater of MEMORY_MAX_TARGET and MEMORY_TARGET for each Oracle instance on the computer.

How much disk space in /tmp

command: df -k /tmp

results: should have at least 400MB available

How much disk space for Oracle binaries

command: df -k

results: Depending on installation type you should have between 1.5GB and 3.5GB

Checking Software Requirements

What distribution and version of Linux is installed

command: cat /proc/version

results: Linux version 2.6.18-8.1.15.el5 (mockbuild@builder6.centos.org)

(gcc version 4.1.1 20070105 (Red Hat 4.1.1-52))

#1 SMP Mon Oct 22 08:32:04 EDT 2007

What version of the kernel is installed

command: uname -r

results: 2.6.18-8.1.15.el5

Are the following packages installed (assumes CentOS-5 and above distribution)

command:rpm -q binutils \

compat-libstdc++ \

elfutils-libelf \

elfutils-libelf-devel \

glibc \

glibc-common \

glibc-devel \

glibc-headers \

gcc \

gcc-c++ \

libaio-devel \

libaio \

libgcc \

libstdc++ \

libstdc++ \

make \

sysstat \

unixODBC \

unixODBC-devel

results: you will probably get quite a few packages that are not installed with a typical installation. You can investigate missing packages with the following command making sure you add/subtract from this list if necessary.

yum list available "compat*" \

"elfutils*" \

"glibc*" \

"gcc*" \

"libaio*" \

"sysstat*" \

"unixODBC*"

action : Our base installation left us needing to issue the following command to install missing packages.

yum -y install compat-libstdc++-296.i386 \

compat-libstdc++-33.i386 \

elfutils-libelf-devel.i386 \

glibc-devel.i386 \

glibc-headers.i386 \

gcc.i386 \

gcc-c++.i386 \

libaio-devel.i386 \

sysstat.i386 \

unixODBC.i386 \

unixODBC-devel.i386

Create Oracle user and group

Create groups oinstall & dba

command: /usr/sbin/groupadd oinstall

/usr/sbin/groupadd dba

Create the Oracle and change password

command: /usr/sbin/useradd -g oinstall -G dba -s /bin/bash oracle

/usr/bin/passwd oracle

Validate the nobody user exists

command: /usr/bin/id nobody

results: this user is almost always created on a base CentOS installation

action : if this user is not created use the following command to create

/usr/sbin/useradd nobody

Configuring kernel parameters

The following kernel parameters must be validated and possibly changed. Use the commands given below to view a particular kernel setting and then change if the setting is lower than the recommendation given in the following table.

You can make the changes by editing the /etc/sysctl.conf file and then rebooting the server. The following results are what we observed on our server and should not be expected on yours.

shmmni

4096

shmall

2097152

shmmax

2147483648

semmsl

250

semmns

32000

semopm

100

semmni

128

file-max

65536

ip_local_port_range

1024 - 65000

rmem_default

1048576

rmem_max

1048576

wmem_default

262144

wmem_max

262144

command: /sbin/sysctl -a | grep kernel.sem

results: kernel.sem = 250 32000 100 128

command: /sbin/sysctl -a | grep kernel.shm

results: kernel.shmmni = 4096

kernel.shmall = 268435456

kernel.shmmax = 4294967295

command: /sbin/sysctl -a | grep file-max

results: fs.file-max = 102440

command: /sbin/sysctl -a | grep ip_local_port_range

results: net.ipv4.ip_local_port_range = 32768 61000

command: /sbin/sysctl -a | grep rmem_default

results: net.core.rmem_default = 109568

command: /sbin/sysctl -a | grep rmem_max

results: net.core.rmem_max = 131071

command: /sbin/sysctl -a | grep wmem_default

results: net.core.wmem_default = 109568

command: /sbin/sysctl -a | grep wmem_max

results: net.core.wmem_max = 131071

sample /etc/sysctl.conf file. This is given as an example only and does not reflect the results obtained above by the /sbin/sysctl commands. Only add lines that are needed and do not change any values to be lower than the base installation might have assigned.

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

Setting shell limits for the Oracle user

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

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

Add the following lines to /etc/pam.d/login

session required /lib/security/pam_limits.so

session required pam_limits.so

Add the following lines to /etc/profile

if [ $USER = "oracle" ]; then

if [ $SHELL = "/bin/ksh" ]; then

ulimit -p 16384

ulimit -n 65536

else

ulimit -u 16384 -n 65536

fi

fi

Creating Directories to Install the Oracle Software

Validate you have enough space on disk and choose a directory to install

command: df -k

results: pick a mount point that has enough space—we have chosen /opt for the our.

Create subdirectories and give permissions to the oracle user

The following directory used is common for Oracle installations. Note that we are creating all directories under /opt and that there are no other applications using /opt/app and below. This is very important as we are changing permissions with the following commands.

command: mkdir -p /opt/app/oracle/product/11.1.0

chown -R oracle:oinstall /opt/app

chmod -R 775 /opt/app

Switch to the oracle user

Up to know we have been doing everything as the root user. It is now time to switch to the oracle user to actually install the Oracle software.

command: su – oracle

Add the following line to $HOME/.bash_profile

umask 022

Execute oracle's bash_profile to use new setting

command: . ./.bash_profile

Make sure the oracle user is using an X Windows System

It is assumed you know how to set up an X Windows System as stated earlier in the document. Please verify it is working by issuing the xterm command and validating an X Terminal comes up. You may close the X Terminal if you wish.

Set Oracle environment for the installation

Issue the following commands to set/unset particular Oracle environments in preparation for the installation.

command: export ORACLE_BASE=/opt/app/oracle

export ORACLE_SID=orcl

unset ORACLE_HOME

unset TNS_ADMIN

Start Oracle Installer

This paper assumes you have downloaded the Oracle software from the net and have unzipped the files. We have unzipped our software into /opt and the following commands will take you through starting the Oracle installer form that mount point.

command: cd /opt/database

./runInstaller

From this point, Oracle will do a few minor checks on the operating system and then put up the Oracle Installation screen. Our particular configuration did not throw any errors at this point but it should be noted, as it can be helpful, that sometimes the Oracle installer will complain at this very early stage about various Linux system configurations. If this is the case you might be able to bypass them by adding an additional argument to the runInstaller command. Please only use this as a last resort to the normal installation path.

command: ./runInstaller -ignoreSysPrereqs

From this point on we will walk through each of the prompts one at a time to give you a simple feel for a full installation of the Oracle software.

Select installation method

This screen is very busy to say the least. We are not going to create any databases at this point as it is not required nor is it suggested to do at this point. We like to create databases separately through the Database Creation Assistant (DBCA) and not confuse the software installation process.

1. Choose basic installation

1. verify Oracle Base of '/opt/app/oracle'

2. verify Oracle Home of '/opt/app/oracle/product/11.1.0/db_1'

3. verify installation type of 'Enterprise Edition'

4. verify dba group of 'dba'

2. Un-check “Create Starter Database”

3. Un-check “Advanced Installation”

4. Click

Specify Inventory directory and credentials

1. verify path of inventory directory of '/opt/app/oraInventory'

2. verify group name for install of 'oinstall'

3. Click

Product-Specific Prerequisite Checks

This screen, the installer will verify the system environment and report on any issues it may find. If all goes well you will get the status of 'Succeeded' for every check. Scroll through and make sure nothing has failed or look at the status box at the bottom of the screen and verify you get the following:

'Check complete. The overall result of this check is: Passed'

1. verify all statuses

2. Click

Summary

This screen give a summary of the installation you are about to perform. It can be interesting to click and expand the products being installed to give you an idea of the what product and version is going to be installed.

1. validate 'Global Settings' for directories

2. validate 'Space Requirements'

3. Click

Install

This screen gives a status of what is being installed. If all system settings have been properly set and all packages been installed properly then this should proceed without error. The status bar gives some indication of what is being installed at a particular point and the amount of work to be performed. But as all status bars you never really know how long in the process it is.

1. Note the time it takes for specific products. If you notice one hanging or taking a long amount of time (greater than 10 minutes) you could have a condition that requires a pre-installation patch. Don't stop the installer yet but instead start looking for a bug / patch for the Oracle 11g installation process and the actual product being installed.

2. Execute Configuration scripts

1. open up a different terminal window

2. login as the root user

3. run /opt/app/oraInventory/orainstRoot.sh

4. run /opt/app/oracle/product/11.1.0/db_1/root.sh

1. accept default of /usr/local/bin

5. Click

3. Click

4. Click

Cleanup

1. If you downloaded the software from the net you can now remove .zip file and the complete directory structure you unzipped it to. That particular command is not given here as it can be quite disastrous if executed from the wrong directory.

2. Add the following lines to oracle's $HOME/.bash_profile file. This will allow you to execute various Oracle binaries to create databases, configure network settings, and generally manage the Oracle database environment.

export ORACLE_HOME=/opt/app/oracle/product/11.1.0/db_1

export PATH=$ORACLE_HOME/bin:$PATH

Installation is complete

Congratulations on a successful installation of the Oracle software. This paper hopefully was also successful in its attempt to guide you down a more simplistic path—giving you the commands to execute and working past the minor hurdles encountered during installation. Obviously this paper can not predict all the issues that you may encounter but if you have a relatively current system with ample memory and disk space there is no reason not to believe your installation wouldn't run smoothly.

REFERENCES

http://www.jameskoopmann.com/docs/Install_Oracle11gCentOS5.htm

Install Oracle x64 11gR2 on Centos 5.4 x86_x64

SkyHi @ Wednesday, April 28, 2010

I followed the tutorial written by James F. Koopmann located at http://www.jameskoopmann.com/docs/Install_Oracle11gCentOS5.htm. It is basically the best oracle installation tutorial I found on the internet.
The tutorial just install the software only. For the database creation, we can install later using Database Configuration Assistant (DBCA).
For the x64 platform you need to modify some settings in the /etc/sysctl.conf file and also the memory swap space.
I have 2GB RAM and set the swap memory to 2GB also, but in the installation stage the expected swap space is 3GB.
Here are the parameter of /etc/sysctl.conf file you need to consider:

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 = 1048576
fs.file-max = 6815744
fs.aio-max-nr = 1048576

Below are the screenshots of the installation process:

ora-install-1


ora-grid-option


ora-install-db-edition


ora-install-location


ora-install-inventory


ora-os-group


ora-install-summary


ora-install-product


ora-install-finish


Incoming search terms for this post:

How to upgrade Clam Anti-virus(Clamav) on Centos

SkyHi @ Wednesday, April 28, 2010
My email server is using Postfix as the MTA and Clamav as the anti-virus software running on Centos 5.4. Today I check the version of Clamav installed on it and it is already out-dated so I need to upgrade to the latest stable version. The installed version of clamav is ClamAV 0.94 whereas the latest stable version is ClamAV 0.95.2.
Upgrading clamav installed on Centos is easy. You just first backup the current configuration of clamav (/etc/clamd.conf and /etc/freshclam.conf).
Basically if you install clamav for the first time, you need to edit and modify the config file of clamav (clamd.conf and freshclam.conf) to meet your need. You do not wanna lose these files because it takes time to edit them.
Here are the upgrade processes:
[root@mx-1 ~]# yum upgrade clamav
Loading "installonlyn" plugin
Setting up Upgrade Process
Setting up repositories
rpmforge                  100% |=========================| 1.1 kB    00:00
base                      100% |=========================| 1.1 kB    00:00
updates                   100% |=========================|  951 B    00:00
addons                    100% |=========================|  951 B    00:00
extras                    100% |=========================| 1.1 kB    00:00
Reading repository metadata in from local files
primary.xml.gz            100% |=========================| 3.5 MB    00:39
################################################## 9558/9558
primary.xml.gz            100% |=========================| 878 kB    00:02
################################################## 2508/2508
primary.xml.gz            100% |=========================| 306 kB    00:01
################################################## 465/465
primary.xml.gz            100% |=========================| 100 kB    00:01
################################################## 312/312
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for clamav to pack into transaction set.
clamav-0.95.2-4.el5.rf.i3 100% |=========================|  25 kB    00:00
---> Package clamav.i386 0:0.95.2-4.el5.rf set to be updated
--> Running transaction check
--> Processing Dependency: libclamav.so.5 for package: clamd
--> Processing Dependency: libclamav.so.5(CLAMAV_PRIVATE) for package: clamd
--> Processing Dependency: clamav = 0.94-1.el5.rf for package: clamd
--> Processing Dependency: libclamav.so.5(CLAMAV_PUBLIC) for package: clamd
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for clamd to pack into transaction set.
clamd-0.95.2-4.el5.rf.i38 100% |=========================| 6.7 kB    00:00
---> Package clamd.i386 0:0.95.2-4.el5.rf set to be updated
--> Running transaction check
 
Dependencies Resolved
 
=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Updating:
 clamav                  i386       0.95.2-4.el5.rf  rpmforge          2.7 M
Updating for dependencies:
 clamd                   i386       0.95.2-4.el5.rf  rpmforge          213 k
 
Transaction Summary
=============================================================================
Install      0 Package(s)
Update       2 Package(s)
Remove       0 Package(s)
 
Total download size: 2.9 M
Is this ok [y/N]:
Downloading Packages:
(1/2): clamd-0.95.2-4.el5 100% |=========================| 213 kB    00:03
(2/2): clamav-0.95.2-4.el 100% |=========================| 2.7 MB    00:15
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating  : clamav                       [1/4]warning: /etc/freshclam.conf created as /etc/freshclam.conf.rpmnew
  Updating  : clamav                       ######################### [1/4]
  Updating  : clamd                        ######################### [2/4]
  Cleanup   : clamd                        ######################### [3/4]
  Cleanup   : clamav                       ######################### [4/4]
 
Updated: clamav.i386 0:0.95.2-4.el5.rf
Dependency Updated: clamd.i386 0:0.95.2-4.el5.rf
Complete!
Now restore the backup files to /etc folder and then restart the clamav service.
[root@mx-1 ~]# /etc/init.d/clamd restart
Check the clamav version:
[root@mx-1 ~]# clamd -V
ClamAV 0.95.2/9727/Sat Aug 22 21:04:10 2009
Do not forget to update clam antivirus database using freshclam.
Since I live in Indonesia, I use db.id.clamav.net as DatabaseMirror in the freshclam.conf file but got errors when running the freshclam update like below:
Can not connect to port 80 of host db.id.clamav.net (IP: 222.124.18.201)
ERROR: getpatch: Can not download daily-9725.cdiff from db.local.clamav.net
WARNING: Incremental update failed, trying to download daily.cvd
Trying host db.id.clamav.net (222.124.18.201)...
nonblock_connect: connect timing out (30 secs)
Can not connect to port 80 of host db.id.clamav.net (IP: 222.124.18.201)
ERROR: Can not download daily.cvd from db.id.clamav.net
Giving up on db.id.clamav.net...
Update failed. Your network may be down or none of the mirrors listed in /etc/freshclam.conf is working. Check http://www.clamav.net/support/mirror-problem for possible reasons.
We have to try another mirror sites. Run ‘freshclam –list-mirrors’ to see available mirror sites.
[root@mx-1 ~]# freshclam --list-mirrors
Mirror #1
IP: 222.124.18.201
Successes: 1113
Failures: 0
Last access: Wed Aug 19 04:04:58 2009
Ignore: No
-------------------------------------
Mirror #2
IP: 193.1.193.64
Successes: 1116
Failures: 2
Last access: Wed Aug 19 04:04:58 2009
Ignore: No
-------------------------------------
Mirror #3
IP: 192.121.13.5
Successes: 12
Failures: 0
Last access: Sat Aug 22 04:12:07 2009
Ignore: No
There are three available mirrors. The first one was failed (db.id.clamav.net), the second one is located at Ireland and the third one is located at Sweden.
I choose the third one, the Sweden. The domain country code of Sweden is ‘se’ so the db clamav domain must be ‘db.se.clamav.net’. Set the DatabaseMirror in freshclam.conf to be db.se.clamav.net and then run freshclam update again.
[root@mx-1 ~]# /usr/bin/freshclam --datadir="/var/clamav" --log="/var/log/clamav/freshclam.log" --daemon-notify="/etc/clamd.conf"
ClamAV update process started at Sun Aug 23 07:01:18 2009
main.cld is up to date (version: 51, sigs: 545035, f-level: 42, builder: sven)
Trying host db.se.clamav.net (194.47.250.218)...
Downloading daily-9725.cdiff [100%]
Downloading daily-9726.cdiff [100%]
Downloading daily-9727.cdiff [100%]
daily.cld updated (version: 9727, sigs: 66742, f-level: 43, builder: mcichosz)
Database updated (611777 signatures) from db.se.clamav.net (IP: 194.47.250.218)
Clamd successfully notified about the update.
Now your clamav has been upgraded and the clam antivirus database also has been updated successfully. Restart the clamd service again.
[root@mx-1 ~]# /etc/init.d/clamd restart

Incoming search terms for this post: