Page 1 of 1

Linux prep for Oracle

Posted: Thu Mar 22, 2007 9:02 pm
by thockman
#!/bin/bash
# Script: lxbuild.sh
# Description: Script for Oracle OS
# Created by: Troy Hockman

function showusage {
echo "Usage: --help or help shows this usage summery."
echo " ./lxbuild undo to rollback"
}

if grep help <<<"$@"; then
showusage
exit 0
fi

clear
#################### Check for undo options
if [ "$1" = "undo" ]; then
undo="y"
else
undo="n"
fi
####################

#################### lrpms equals the required rpms for the oracle build
# if any are missing script will exit
lrpms="make compat-db compat-gcc-32
compat-gcc-32-c++ compat-oracle-rhel4
compat-libcwait compat-libgcc-296
compat-libstdc++-296 compat-libstdc++-33
gcc gcc-c++ gnome-libs gnome-libs-devel
libaio-devel libaio openmotif21
xorg-x11-deprecated-libs-devel
xorg-x11-deprecated-libs"
for X in "$lrpms"
do
ins=`rpm -q $X | grep "is not installed"`
done
if [ -n "$ins" ]; then
echo $ins
echo Missing rpms! Exiting!
exit
fi
################### end rpm check

################### this will append our time server
if [ "$undo" = "y" ]; then
mv -f /etc/ntp.conf.sp /etc/ntp.conf
/etc/init.d/ntpd stop
chkconfig ntpd off
else
cp /etc/ntp.conf /etc/ntp.conf.sp
echo "server 192.168.190.194" >> /etc/ntp.conf
echo "restrict 192.168.190.194 mask 255.255.255.255 nomodify notrap noquery" >> /etc/ntp.conf
/etc/init.d/ntpd restart
chkconfig ntpd on
fi

################### end time server

################### add KEY for up2date
if [ "$undo" = "y" ]; then
rpm -e gpg-pubkey-b38a8516-44fd79eb
else
rpm --import /usr/share/rhn/RPM-GPG-KEY
fi
################### end KEY

################### setup stage area

################### end stage

################### /etc/sysctl.conf mods for oracle
if [ "$undo" = "y" ]; then
mv -f /etc/sysctl.conf.sp /etc/sysctl.conf
else
cp /etc/sysctl.conf /etc/sysctl.conf.sp
cat > /etc/sysctl.conf <<EOF
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.

# Controls IP packet forwarding
net.ipv4.ip_forward = 0

# Controls source route verification
net.ipv4.conf.default.rp_filter = 1

# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0

# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
kernel.shmall = 2097152
kernel.shmmax = 536870912
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=262144
net.core.wmem_default=262144
net.core.rmem_max=262144
net.core.wmem_max=262144
EOF
fi
#################### end sysctl.conf

#################### /etc/security/limits.conf mods for oracle
if [ "$undo" = "y" ]; then
mv -f /etc/security/limits.conf.sp /etc/security/limits.conf
else
cp /etc/security/limits.conf /etc/security/limits.conf.sp
cat > /etc/security/limits.conf <<EOF
# /etc/security/limits.conf
#
#Each line describes a limit for a user in the form:
#
#<domain> <type> <item> <value>
#
#Where:
#<domain> can be:
# - an user name
# - a group name, with @group syntax
# - the wildcard *, for default entry
# - the wildcard %, can be also used with %group syntax,
# for maxlogin limit
#
#<type> can have the two values:
# - "soft" for enforcing the soft limits
# - "hard" for enforcing hard limits
#
#<item> can be one of the following:
# - core - limits the core file size (KB)
# - data - max data size (KB)
# - fsize - maximum filesize (KB)
# - memlock - max locked-in-memory address space (KB)
# - nofile - max number of open files
# - rss - max resident set size (KB)
# - stack - max stack size (KB)
# - cpu - max CPU time (MIN)
# - nproc - max number of processes
# - as - address space limit
# - maxlogins - max number of logins for this user
# - maxsyslogins - max number of logins on the system
# - priority - the priority to run user process with
# - locks - max number of file locks the user can hold
# - sigpending - max number of pending signals
# - msgqueue - max memory used by POSIX message queues (bytes)
#
#<domain> <type> <item> <value>
#

#* soft core 0
#* hard rss 10000
#@student hard nproc 20
#@faculty soft nproc 20
#@faculty hard nproc 50
#ftp hard nproc 0
#@student - maxlogins 4

# End of file

oracle soft nproc 2047
oracle hard nproc 16384
#oracle soft nofile 1024
#oracle hard nofile 65536
* - nofile 65536
EOF
fi
#################### end limits.conf

#################### create dba groups & users
if [ "$undo" = "y" ]; then
groupdel dba
groupdel oinstall
userdel applmgr
userdel oracle
else
mkdir /u01/app/appvis
mkdir /u01/app/oravis
groupadd -g 200 dba
groupadd -g 201 oinstall
useradd -m -d /u01/app/appvis -g 200 -u 211 -s /bin/bash -c "applmgr user" appvis
useradd -m -d /u01/app/oravis -g 200 -u 211 -s /bin/bash -c "oracle user" oravis
#fi
#################### end dba groups & users