注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

红烧鱼

linux & windows management

 
 
 

日志

 
 
关于我
mac

专注IT基础架构设计与运维。 欢迎给我留言,或邮件沟通zjwsk@163.com

网易考拉推荐

Linux install kickstart script for oracle 11g  

2011-01-03 11:13:50|  分类: Linux |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
# Uncomment the next line to enable interactive installation
#interactive
# Comment the next line to use GUI installation
text
install
# reboot after installation
reboot
# From where to get the installation disks
#cdrom
url --url http://192.168.249.11/centos/5.5/x86_64
lang en_US.UTF-8
keyboard us
xconfig --resolution 800x600 --depth 16 --defaultdesktop gnome
# Change the hostname and adjust the eth configuration for your environment
# hostname_$$ adds random number to hostname to try and avoid name conflicts (tested on OEL 5.2+)
#OEL5: --noipv6
#network --device eth0 --noipv6 --bootproto dhcp --hostname srvoracle01_$$
#network --device eth0 --bootproto static --ip x.y.z.v --netmask 255.255.255.0 --gateway x.y.z.v --nameserver x.y.z.t,x.y.z.v --hostname srvoracle01_$$
network --device eth0 --bootproto dhcp --hostname srvoracle01_$$
rootpw --iscrypted $1$uKWECPhN$Im66UG8MpWd2/kpcHoyuy/
firewall --disabled
selinux --disabled
authconfig --enableshadow --enablemd5
# Set a different timezone if not located in israel
timezone Asia/Shanghai
bootloader --location=mbr
# Clear the Master Boot Record
zerombr yes
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
# RAM Size----------SWAP partition size
# 1 GB - 2 GB       1.5 times the size of RAM
# 2 GB - 8 GB       Equal to the size of RAM
# more than 8GB     0.75 times the size of RAM
part /boot --fstype ext3 --size=100 --asprimary
part / --fstype ext3 --size 20480 --asprimary
part swap --size 8192 --asprimary
part /home --fstype ext3 --size 1 --asprimary --grow
# All packages needed by Oracle installation include Gnome desktop
# NOTE: despite explicitly removing a pkg, dependencies may add them later on.
# Always clean up RPMs/packages after reboot and before an up2date/yum update
#OEL5: up2date deprecated! use yum
%packages
@admin-tools
@base
@core
@development-libs
@development-tools
@editors
@gnome-desktop
@graphical-internet
@legacy-software-development
@legacy-software-support
@server-cfg
@system-tools
@text-internet
@base-x
keyutils
kexec-tools
trousers
fipscheck
device-mapper-multipath
perl-Convert-ASN1
imake
festival
audit
xorg-x11-server-Xnest
xorg-x11-server-Xvfb
-openldap-clients
-ckermit
-wireshark
-bluez-pin
-OpenIPMI-tools
-samba-client
e2fsprogs
-screen
-xdelta
-zsh
-nmap
# If you Don't use LVM: comment out next line
#lvm2
-open
grub
binutils
compat-db
control-center
gcc
gcc-c++
glibc
glibc-common
libstdc++
libstdc++-devel
make
sysstat
libaio
libaio-devel
elfutils-libelf
unixODBC
unixODBC-devel
# This post script modify all the Oracle database prerequisites, includes oracle user and dba,oinstall groups
%post
# create user and groups
/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
/usr/sbin/useradd -m -g oinstall -G dba oracle
# Change kernel parameters
cat >> /etc/sysctl.conf << EOF
##############################
# Oracle Database requirements
##############################
# The max value for shmmax on a 32bit machine is 4294967295
# shmmax value must less than physical memory size
# 1G=1*1024*1024*1024=1073741824
# 2G=2147483648
# 4G=4294967296
# 8G=8589934592
# 16G=17179869184
# 32G=34359738368
kernel.shmmax = 4294967296
kernel.shmall = 2097152
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
fs.aio-max-nr = 1048676
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.wmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 262144
EOF
# Change ulimits for user oracle
cat >> /etc/security/limits.conf << EOF
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft nofile 65536
oracle hard nofile 65536
EOF
# Add hangcheck-timer module for RAC; comment if you don't need RAC
#echo "options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180" >> /etc/modprobe.conf
#echo "modprobe hangcheck-timer" >> /etc/rc.modules
# create oracle software directory
mkdir -p /opt/oracle/product/11g/db_1
mkdir -p /opt/oraInventory
chown -R oracle.oinstall /opt/oracle
chown -R oracle.oinstall /opt/oraInventory

# Set oracle account environment variables
cat >> /home/oracle/.bash_profile << \EOF
# Oracle environment variables
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11g/db_1
#export TNS_ADMIN=$ORACLE_HOME/network/admin
#export ORACLE_SID=orcl1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$PATH:\$ORACLE_HOME/bin
if [ "`ls -ld $ORACLE_HOME | awk '{print $3" "$4}'`" != "oracle oinstall" ]
then
echo "The ORACLE_HOME ($ORACLE_HOME) is not owned by oracle:oinstall"
fi
EOF
#############################
# Remove unneeded services!!!
#############################
# Comment this line if you are using Oracle Clusterware
chkconfig rawdevices off
# Enable Network filesystems support for run level 4 only
chkconfig --level 12356 portmap off
chkconfig --level 12356 nfslock off
chkconfig --level 12356 rpcgssd off
chkconfig --level 12356 rpcidmapd off
chkconfig --level 12356 autofs off
chkconfig --level 4 portmap on
chkconfig --level 4 nfslock on
chkconfig --level 4 rpcgssd on
chkconfig --level 4 rpcidmapd on
chkconfig --level 4 autofs on
# Enable xfs support for run level 5 only
chkconfig --level 12346 xfs off
chkconfig --level 5 xfs on
#chkconfig sendmail off
#chkconfig cups off
#chkconfig hplip off
#chkconfig anacron off
#chkconfig apmd off
#chkconfig arptables_jf off
#chkconfig atd off
#chkconfig bluetooth off
#chkconfig canna off
#chkconfig cups-config-daemon off
#chkconfig gpm off
#chkconfig hidd off
#chkconfig hpoj off
#chkconfig iiim off
#chkconfig isdn off
#OEL5: comment line below; pkg not longer exists
#chkconfig pcmcia off
#if using SNMP, uncomment line below
#chkconfig snmpd on
#chkconfig rhnsd off
#chkconfig auth off
# OEL/RHEL 5 only services
chkconfig yum-updatesd off
chkconfig setroubleshoot off
chkconfig restorecond off
chkconfig pcscd off
chkconfig mcstrans off
chkconfig avahi-dnsconfd off
chkconfig avahi-daemon off
# Delete some unused service from /etc/init.d/ directory
unused="rawdevices sendmail cups hplip anacron apmd arptables_jf atd bluetooth canna cups-config-daemon gpm hidd hpoj iiim isdn pcmcia rhnsd auth ipmi yum NetworkManager auditd rdisc netplugd mdmpd diskdump dc_client wpa_supplicant psacct capi dc_server saslauthd ypbind irda nscd nfs winbind netdump cups-lpd klogin time rsync chargen-udp krb5-telnet time-udp kshell daytime-udp echo gssftp daytime echo-udp chargen eklogin acpid cpuspeed iptables irqbalance lvm2-monitor mdmonitor messagebus microcode_ctl readahead readahead_early firstboot nfslock lm_sensors rpcidmapd rpcgssd smartd wdaemon portmap autofs avahi-daemon avahi-dnsconfd conman dnsmasq dund ip6tables lisa mcstrans multipathd netconsole netfs oddjobd pand pcscd readahead_later restorecond rpcsvcgssd tcsd vncserver xfs yum-updatesd"

for noservice in $unused
do
        chkconfig --del ${noservice}
done
#NGSS Start---------------------------------------
echo "### Modifying /etc/fstab for ext2/3"
# add "noatime" mount option onto /etc/fstab
perl -pi -e 's/(ext[23] +) defaults /$1 defaults,noatime /' /etc/fstab
echo "### Modifying /etc/modprobe.conf for e100/e100 driver tuning"
# add some options for e100/e1000 (http://e1000.sourceforge.net)
alias eth0 e100 RxCongestionControl=1
alias eth0 e1000 RxCongestionControl=1
perl -pi -e 's/(e1000*)$/$1 RxCongestionControl=1/' /etc/modprobe.conf
echo "### Turning off some heavy daily/weekly cron"
# we do not need heavy cron jobs
mv -f /etc/cron.weekly/00-makewhatis.cron /etc/cron.weekly/.00-makewhatis.cron
mv -f /etc/cron.daily/00-makewhatis.cron /etc/cron.daily/.00-makewhatis.cron
mv -f /etc/cron.daily/slocate.cron /etc/cron.daily/.slocate.cron
echo "### Configure ntp server list"
cat << EOF > /etc/ntp.conf
server ntp.pool.org
driftfile /var/lib/ntp/drift
EOF
sleep 3
/sbin/hwclock --systohc
echo "### Clean no need User account"
NDUSER="lp
        sync
        adm
        uucp
        shutdown
        halt
        news
        operator
        games
        gopher
        ftp"
for i in $NDUSER
do
        userdel $i;
done
echo "### Clean no need group account"
NDGROUP="sys
        adm
        lp
        news
        uucp
        games
        dip"
for j in $NDGROUP
do
        groupdel $j;
done
echo "### Password length"
sed -i '/^PASS_MAX_DAYS[:space:]*[:digit:]*/c\PASS_MAX_DAYS\t180' /etc/login.defs
sed -i '/^PASS_MIN_DAYS[:space:]*[:digit:]*/c\PASS_MIN_DAYS\t90' /etc/login.defs
sed -i '/^PASS_MIN_LEN[:space:]*[:digit:]*/c\PASS_MIN_LEN\t8' /etc/login.defs
sed -i '/^PASS_WARN_AGE[:space:]*[:digit:]*/c\PASS_WARN_AGE\t10' /etc/login.defs
chmod 600 /etc/login.defs
echo '### Set timeout and history size'
sed -i '/^HISTSIZE.*/c\HISTSIZE=100' /etc/profile
sed -i '/^HISTSIZE.*/i\HISTFILESIZE=0' /etc/profile
sed -i '/^HISTSIZE.*/i\TMOUT=3600' /etc/profile
sed -i '/^export.*/c\export PATH USER LOGNAME MAIL HOSTNAME HISTFILESIZE HISTSIZE INPUTRC TMOUT' /etc/profile
echo '### Set tty'
echo 'console' > /etc/securetty
echo 'vc/1' >> /etc/securetty
echo 'tty1' >> /etc/securetty
chmod 600 /etc/securetty
echo "### Ctrl+Alt+Del key disable"
sed -i "s#ca::ctrlaltdel:/sbin/shutdown -t3 -r now#ca::ctrlaltdel:/bin/true#g" /etc/inittab
echo "### Force sshd use protocl 2"
sed -i "s/#Protocol 2,1/Protocol 2/g" /etc/ssh/sshd_config
echo "### Force sshd don't use reversion dns lookup "
sed -i "s/#UseDNS yes/UseDNS no/g" /etc/ssh/sshd_config
echo '### Create SiteScope cpu usage script'
mkdir /root/scripts
echo '#!/bin/bash' > /root/scripts/cpu_usage.sh
cat << EOF > /root/scripts/cpu_usage.sh
/usr/bin/vmstat 1 3 | tail -2 | head -1 | awk '{cpu=100-\$15;printf ("%d\\n", cpu)}'
EOF
chmod 700 /root/scripts/cpu_usage.sh
#NGSS Stop---------------------------------------
  评论这张
 
阅读(817)| 评论(1)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017