2018-1-3 第一节 安装系统redhat

workstation:推送系统代码
#####
##### Name: workstationmain.cfg for rhel5
##### Type: Kickstart Configuration File
##### Depends on: parts of botang-config-push
##### Version: BCP-TAG201010210854-V9.20
#####

##########################################################################
#
# sample workstation install script
# RHEL4
# $Id: workstation.cfg,v 1.1.2.3 2007/10/10 19:35:18 mcurry Exp $
# RHCX:  Customize keyboard, lang, langsupport, mouse, time, and DEVICE
#        (both %pre and %post) as appropriate
#
##########################################################################

####
####  1 Mail Begin
###   1.1 Text,Key,Keyboard,Lang,Net Begin
###

text
install
keyboard us
lang en_US
selinux --enforcing
#langsupport --default en_US en_US
network --bootproto dhcp
nfs --server=192.168.0.254 --dir=/var/ftp/pub
# url --url ftp://server1.example.com/pub

###   1.1 Text,Key,Keyborad,Lang,Net End
###   1.2 Partition Begin
###

# Partition 19028M
%include /tmp/partitioning

###   
###   1.2 Partition End
###   1.3 Timezone,X,passwd,security,bootloader Begin
###   

#mouse genericps/2 --emulthree
#mouse generic3ps/2
#mouse genericwheelusb --device input/mice
timezone Asia/Shanghai --utc
#timezone US/Central --utc
#timezone US/Mountain --utc
#timezone US/Pacific --utc

# When probed, some monitors return strings that wreck havoc (not
# Pennington) with the installer.  You can indentify this condition
# by an early failure of the workstation kickstart just prior to when
# it would ordinarily raise the installer screen after probing.  There
# will be some nasty python spew.
# In this situation, comment the xconfig line below, then uncomment
# the skipx line.  Next, uncomment the lines beneath #MY X IS BORKED
graphical
#skipx
rootpw redhat
auth  --useshadow  --passalgo=md5
firstboot --disable
firewall --disabled
bootloader --location=mbr
reboot

###
###   1.3 Timezone,X,passwd,security,bootloader End
####  1 Main End
####  2 Paclages Begin
####

%packages

@basic-desktop
@desktop-debugging
@desktop-platform
@fonts
@general-desktop
@graphical-admin-tools
@input-methods
@legacy-x
@remote-desktop-clients
@x11
# KDE is huge...install it if you wish
#@ KDE
#@ Windows File Server
#@ Web Server
elinks
openssh
openssh-server
openssh-clients
vim-enhanced
samba-common
samba-client
gimp
gimp-data-extras
enscript
libcap
ntp
coreutils
elfutils
elfutils-libelf
gimp-print-plugin
gnome-icon-theme
gstreamer
gstreamer-tools
#libgnomeprint22
#libgnomeprintui22
libgsf
libIDL
libraw1394
nautilus-cd-burner
openmotif
pyorbit
startup-notification
ttmkfdir
firefox
mutt
vnc
gcc
xorg-x11-apps

####
####  2 Packages End
####  3 Post Begin
####

%post

### 
###   3.1 Ntp/X Begin
###

# Set the time, then set the hardware clock
ntpdate -b 192.168.0.254
hwclock --systohc --utc
# Non-destructive rebuild approach
CURRENT="5"
if [ -x /usr/bin/links ]; then httpget="/usr/bin/links";
elif [ -x /usr/bin/lynx ]; then httpget="/usr/bin/lynx";
fi
${httpget} -source http://192.168.0.254/buildscript > /tmp/buildscript
sh /tmp/buildscript
# MY X IS BORKED
#${httpget} -source http://192.168.0.254/cgi-bin/getXF86.pl > /etc/X11/XF86Config
#ln -s ../../usr/X11R6/bin/XFree86 /etc/X11/X
# Allows for easy RH035 setup. 7-Oct-2005 jsk
if
	grep -qv 'without-x' /proc/cmdline
then
	perl -pi -e 's,id:3:initdefault,id:5:initdefault,' /etc/inittab
	system-config-display --noui --set-resolution=1280x1024
fi
# Configure as NTP client of server1
cat > /etc/ntp.conf <<END
restrict default ignore
restrict 127.0.0.1
restrict 192.168.0.254
server 192.168.0.254
driftfile /var/lib/ntp/drift
broadcastdelay 0.008

END
echo "192.168.0.254" >> /etc/ntp/step-tickers
chkconfig ntpd on
perl -i -pe 's,via,vesa,'  /etc/X11/xorg.conf

###
###   3.1 Ntp/X End
###   3.2 Lang/Network Begin
###

cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
NETMASK=255.255.255.0
IPADDR=XXX
GATEWAY=192.168.0.254
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
EOF
# VMware Network
cat > /etc/ifcfg-eth0.bak << EOF
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
NETMASK=255.255.255.0
IPADDR=XXX
GATEWAY=192.168.0.254
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
EOF
# IP
v_botang_ip=`ifconfig  eth0 | head -n 2 | tail -n 1 | cut -d ':' -f 2 | cut -d ' ' -f 1`
perl -pi -e "s,XXX,$v_botang_ip," /etc/sysconfig/network-scripts/ifcfg-eth0
perl -pi -e "s,XXX,$v_botang_ip," /etc/ifcfg-eth0.bak
echo "99 0 eth0backup mv -f /etc/ifcfg-eth0.bak     /etc/sysconfig/network-scripts/ifcfg-eth0" >> /etc/anacrontab

###
###   3.2 Lang/Network End
###   3.3 User Begin
###

# These accounts should be consolidated
useradd student -u 600
echo "student" | passwd --stdin student
useradd visitor -u 601
echo "password" | passwd --stdin visitor

###
###   3.3 User End
###   3.4 Lesson Begin
##    3.4.1 Tgz Begin
##

wget -P / -c --tries=100 --wait=5 http://192.168.0.254/pub/lessonfiles/upload.tgz
tar -C / -zxvf /upload.tgz
rm -f /upload.tgz
wget -P /usr/sbin -c --tries=100 --wait=5 http://192.168.0.254/pub/lessonfiles/botang-start-lesson

##
##    3.4.1 Tgz End
##    3.4.2 Usbstorage/X Begin
## 

find /lib/modules -name "usb-storage.ko" -exec rm -rf {} \;
echo "99 3 usbmodule find /lib/modules -name usb-storage.ko -exec rm -rf {} \;" >> /etc/anacrontab
chkconfig anacron on

grep -v '"DontZap" "off"' /etc/X11/xorg.conf > /etc/X11/xorg.conf.no
grep -v '"DontVTSwitch" "off"' /etc/X11/xorg.conf.no > /etc/X11/xorg.conf.no2
grep -v '"DontZoom" "off"' /etc/X11/xorg.conf.no2 > /etc/X11/xorg.conf.no3
grep -v '"HandleSpecialKeys" "Always"' /etc/X11/xorg.conf.no3 > /etc/X11/xorg.conf.no4
grep -v '"HandleSpecialKeys" "WhenNeeded"' /etc/X11/xorg.conf.no4 > /etc/X11/xorg.conf.no5
rm -f /etc/X11/xorg.conf
mv /etc/X11/xorg.conf.no5 /etc/X11/xorg.conf

grep '"DontZap" "on"' /etc/X11/xorg.conf > /dev/null
v_1=$?
grep '"DontVTSwitch" "on"' /etc/X11/xorg.conf > /dev/null
v_2=$?
grep '"DontZoom" "on"' /etc/X11/xorg.conf > /dev/null
v_3=$?
grep '"HandleSpecialKeys" "Never"' /etc/X11/xorg.conf > /dev/null
v_4=$?


if [ $v_1$v_2$v_3$v_4 != "0000" ]
then
 echo "Section \"ServerFlags\""  >> /etc/X11/xorg.conf
 echo "Option \"DontZap\" \"on\"" >> /etc/X11/xorg.conf
 echo "Option \"DontVTSwitch\" \"on\"" >> /etc/X11/xorg.conf
 echo "Option \"DontZoom\" \"on\"" >> /etc/X11/xorg.conf
 echo "Option \"HandleSpecialKeys\" \"Never\"" >> /etc/X11/xorg.conf
 echo "EndSection" >> /etc/X11/xorg.conf
fi

##    3.4.2 Usbstorage/X End
###   3.5 Others Begin
###

# Turn on updatedb
perl -pi -e 's,DAILY_UPDATE=no,DAILY_UPDATE=yes,g' /etc/updatedb.conf
# Why not handle leases right now, if requested?
#eval $(cat /proc/cmdline | awk '{print $NF}')
#case $s in
#        [1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[1-3]|192.168.0.[1-9]|192.168.0.[1-9][0-9]|192.168.0.1[0-9][0-9]|192.168.0.2[0-4][0-9]|192.168.0.25
#[1-3])
#                ${httpget} -source http://192.168.0.254/leaser > leaser
#                egrep -v "ifup|ifdown|killall" leaser > newleaser
#                chmod a+x newleaser
#                ./newleaser $s
#                rm -f leaser newleaser
#        ;;
#        *)
#                touch /tmp/.leaser_failed
#        ;;
#esac

# Chuck's fix for the balky USB ports - 7-Oct-2005 jsk
#for FILE in $(ls /boot/initrd*); do
#        VERSION=$(basename ${FILE} | sed 's,initrd-,,g;s,.img,,g')
#        echo $VERSION
#        mkinitrd -f --preload="ehci-hcd uhci-hcd" ${FILE} ${VERSION}
#done
cp -rp /etc/yum.repos.d /etc/yum.repos.d.ori
rm -rf /etc/yum.repos.d/*

cat >> /etc/yum.repos.d/base.repo <<EOF
[base]
name=RHEL base
baseurl=ftp://192.168.0.254/pub/Server
gpgcheck=0
EOF

# ZB: Replace with wget of file?  Seems like a better solution in the long run.
#wget -q ftp://server1/pub/gls/server1.repo -O /etc/yum.repos.d/server1.repo

# Install the pub keys
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-* 2>/dev/null
yum -y groupinstall "chinese support"
yum -y install "*chinese*"
chkconfig NetworkManager off

yum -y groupinstall "Development tools"
yum -y install libaio
yum -y install libaio-devel

yum -y groupinstall "Development tools"
yum -y install libaio
yum -y install libaio-devel

yum -y groupinstall "Development tools"
yum -y install libaio
yum -y install libaio-devel

yum -y install unixODBC
yum -y install unixODBC-devel

yum -y install unixODBC
yum -y install unixODBC-devel

yum -y install unixODBC
yum -y install unixODBC-devel

yum -y install oracleasm\*
yum -y install oracleasm\*
yum -y install oracleasm\*

yum -y install openmotif\*
yum -y install ksh\*
yum -y install sysstat\*
yum -y install compat\*
yum -y install nfs-utils

yum -y install openmotif\*
yum -y install ksh\*
yum -y install sysstat\*
yum -y install compat\*
yum -y install nfs-utils

yum -y install openmotif\*
yum -y install ksh\*
yum -y install sysstat\*
yum -y install compat\*
yum -y install nfs-utils

yum -y install "glibc-devel.i386"
yum -y install "glibc-devel.i386"
yum -y install "glibc-devel.i386"
###
###   3.5 Others End
###   3.6 Network Requirement Begin
##    3.6.1 Eth0 Begin
##

##    3.6.2 Eth1 End
###   3.6 Network Requirement End
###   3.7 Oracle Begin
##    3.7.1 User Begin
##

echo "oracle" | passwd --stdin root
# oracle
groupadd oinstall
groupadd dba
groupadd oper
# grid
groupadd asmadmin
groupadd asmdba
groupadd asmoper
# oracle
useradd -g oinstall -G dba,oper,asmadmin,asmdba,asmoper -d /home/oracle   oracle
echo "oracle" | passwd --stdin oracle
echo "export ORACLE_BASE=/u01/app/oracle" >> /home/oracle/.bash_profile
echo '# export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1' >> /home/oracle/.bash_profile
echo "# export ORACLE_SID=orcl"  >> /home/oracle/.bash_profile
echo '# export TNS_ADMIN=/u01/app/oracle/product/11.2.0/grid/network/admin'  >> /home/oracle/.bash_profile
echo "export NLS_LANG=american_america.AL32UTF8" >> /home/oracle/.bash_profile
echo "export ORACLE_TERM=xterm" >> /home/oracle/.bash_profile
echo "export EDITOR=vi" >> /home/oracle/.bash_profile
echo '# export PATH=$ORACLE_HOME/bin:$PATH:/u01/app/oracle/product/11.2.0/grid/bin' >> /home/oracle/.bash_profile
echo "export LANG=en_US" >> /home/oracle/.bash_profile

mkdir -p /u01/app/oracle
chown oracle:oinstall /u01/app
chown oracle:oinstall /u01/app/oracle

cat > /etc/sudoers <<EOF
Runas_Alias     SUSER = root
User_Alias      ORA = oracle

root    ALL=(ALL) ALL
ORA     ALL=(SUSER)     NOPASSWD: ALL
EOF

yum -y install tigervnc-server.x86_64
sleep 3
yum -y install tigervnc-server.x86_64
sleep 3
yum -y install tigervnc-server.x86_64

mkdir /home/oracle/.vnc/
cat > /home/oracle/.vnc/xstartup <<EOF
#!/bin/sh

[ -r /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n
export LANG
export SYSFONT
vncconfig -iconic &
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
OS=`uname -s`
if [ $OS = 'Linux' ]; then
  case "$WINDOWMANAGER" in
    *gnome*)
      if [ -e /etc/SuSE-release ]; then
        PATH=$PATH:/opt/gnome/bin
        export PATH
      fi
      ;;
  esac
fi
if [ -x /etc/X11/xinit/xinitrc ]; then
  exec /etc/X11/xinit/xinitrc
fi
if [ -f /etc/X11/xinit/xinitrc ]; then
  exec sh /etc/X11/xinit/xinitrc
fi
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
gnome-session &
EOF

echo 'VNCSERVERS="2:oracle"' > /etc/sysconfig/vncservers
echo 'VNCSERVERARGS[2]="-geometry 1024x768"' >> /etc/sysconfig/vncservers
wget -P /home/oracle/.vnc -c --tries=100 --wait=5 http://192.168.0.254/pub/O10g/RAC/passwd
chmod 700 /home/oracle/.vnc/passwd
chown -R oracle:oinstall /home/oracle/.vnc
chmod +x /home/oracle/.vnc/xstartup
chkconfig vncserver on

##
##    3.7.1 User End
##    3.7.2 Os Software Patch Begin
##

# Patch All Linux eg. Display Card
mkdir -p /stage/OSPATCHS/alllinux/
wget -P /stage/OSPATCHS/alllinux/ -c --tries=100 --wait=5 http://192.168.0.254/pub/O10g/OSPATCHS/alllinux/n.run 
wget -P /stage/OSPATCHS/alllinux/ -c --tries=100 --wait=5 http://192.168.0.254/pub/O10g/OSPATCHS/alllinux/a.run 
wget -P /usr/lib/ -c --tries=100 --wait=5 http://192.168.0.254/pub/O10g/OSPATCHS/alllinux/libXm.so.2 
chmod +x /stage/OSPATCHS/alllinux/n.run
chmod +x /stage/OSPATCHS/alllinux/a.run

##
##    3.7.2 Os Software Patch End
##    3.7.3 Os Script Patch Begin
##


sed -i.bak 's/SELINUX=enforcing/SELINUX=disabled/' /etc/sysconfig/selinux
echo "Red Hat Enterprise Linux Server release 4 (Tikanga)" > /etc/redhat-release
# Oracle2
echo "fs.file-max = 6815744" >> /etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf
echo "kernel.shmall = 2097152" >> /etc/sysctl.conf
echo "kernel.shmmni = 4096" >> /etc/sysctl.conf
echo "net.core.rmem_default=4194304" >> /etc/sysctl.conf
echo "net.core.rmem_max=4194304" >> /etc/sysctl.conf
echo "net.core.wmem_default=1048576" >> /etc/sysctl.conf
echo "net.core.wmem_max=1048576" >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 9000 65500" >> /etc/sysctl.conf
echo "fs.aio-max-nr = 1048576" >> /etc/sysctl.conf
# Oracle3
echo "session required /lib/security/pam_limits.so" >>/etc/pam.d/login
# Oracle4
echo "grid soft nproc 2047" >>/etc/security/limits.conf
echo "grid hard nproc 16384" >>/etc/security/limits.conf
echo "grid soft nofile 1024" >>/etc/security/limits.conf
echo "grid hard nofile 65536" >>/etc/security/limits.conf
echo "oracle soft nproc 2047" >>/etc/security/limits.conf
echo "oracle hard nproc 16384" >>/etc/security/limits.conf
echo "oracle soft nofile 1024" >>/etc/security/limits.conf
echo "oracle hard nofile 65536" >>/etc/security/limits.conf
# Oracle5
echo 'if [ $USER = "oracle" ] || [ $USER = "grid" ] ; then' >>  /etc/profile
echo ' if [ $SHELL = "/bin/ksh" ]; then' >> /etc/profile
echo '  ulimit -p 16384' >> /etc/profile
echo '  ulimit -n 65536' >> /etc/profile
echo ' else' >> /etc/profile
echo '  ulimit -u 16384 -n 65536' >> /etc/profile
echo ' fi' >> /etc/profile
echo 'fi' >> /etc/profile

##
##    3.7.3 Os Script Patch End
##    3.7.4 Database Begin
##

wget -P /stage/ -c --tries=1000 --wait=5 ftp://192.168.0.254/pub/O11g_x8664/DATABASES/flashplayer-11.2.202.297-1.ram0.98.x86_64.rpm
rpm -ivh /stage/flashplayer-11.2.202.297-1.ram0.98.x86_64.rpm
cp /usr/lib/mozilla/plugins/libflashplayer.so  /usr/lib64/mozilla/plugins/
# wget -P /stage/ -c --tries=1000 --wait=5 ftp://192.168.0.254/pub/O11g_x8664/DATABASES/pdksh-5.2.14-36.el5.x86_64.rpm
# rpm -ivh /stage/pdksh-5.2.14-36.el5.x86_64.rpm
mkdir /stage/UEKKERNEL
wget -P /stage/UEKKERNEL/ -c --tries=1000 --wait=5 ftp://192.168.0.254/pub/Packages/kernel-uek-[0-9]*
wget -P /stage/UEKKERNEL/ -c --tries=1000 --wait=5 ftp://192.168.0.254/pub/Packages/kernel-uek-devel-[0-9]*
wget -P /stage/UEKKERNEL/ -c --tries=1000 --wait=5 ftp://192.168.0.254/pub/Packages/kernel-uek-firmware*
wget -P /stage/UEKKERNEL/ -c --tries=1000 --wait=5 ftp://192.168.0.254/pub/Packages/dtrace-modules-[0-9]*
rpm -ivh --nodeps --force  /stage/UEKKERNEL/*
wget -P /stage -c --tries=1000 --wait=5 ftp://192.168.0.254/pub/O12c_x8664/ASMLIB/oracleasmlib-2.0.4-1.el6.x86_64.rpm
rpm -ivh /stage/oracleasmlib-2.0.4-1.el6.x86_64.rpm
wget -P /stage -c --tries=1000 --wait=5 ftp://192.168.0.254/pub/O12c_x8664/ASMMOD/kmod-oracleasm-2.0.8-13.el6_8.x86_64.rpm
rpm -ivh --force --nodeps /stage/kmod-oracleasm-2.0.8-13.el6_8.x86_64.rpm 
# UEK3 for ASMFD
mkdir /stage/UEK3
wget -P /stage/UEK3/ -c --tries=1000 --wait=5 ftp://192.168.0.254/pub/O12c_x8664/UEK3/dtrace-modules-3.8.13-118.11.2.el6uek-0.4.5-3.el6.x86_64.rpm
wget -P /stage/UEK3/ -c --tries=1000 --wait=5 ftp://192.168.0.254/pub/O12c_x8664/UEK3/dtrace-modules-provider-headers-0.4.5-3.el6.x86_64.rpm
wget -P /stage/UEK3/ -c --tries=1000 --wait=5 ftp://192.168.0.254/pub/O12c_x8664/UEK3/dtrace-modules-shared-headers-0.4.5-3.el6.x86_64.rpm
wget -P /stage/UEK3/ -c --tries=1000 --wait=5 ftp://192.168.0.254/pub/O12c_x8664/UEK3/kernel-uek-3.8.13-118.11.2.el6uek.x86_64.rpm
wget -P /stage/UEK3/ -c --tries=1000 --wait=5 ftp://192.168.0.254/pub/O12c_x8664/UEK3/kernel-uek-devel-3.8.13-118.11.2.el6uek.x86_64.rpm
wget -P /stage/UEK3/ -c --tries=1000 --wait=5 ftp://192.168.0.254/pub/O12c_x8664/UEK3/kernel-uek-firmware-3.8.13-118.11.2.el6uek.noarch.rpm
wget -P /stage/UEK3/ -c --tries=1000 --wait=5 ftp://192.168.0.254/pub/O12c_x8664/UEK3/kernel-uek-headers-3.8.13-26.2.4.el6uek.x86_64.rpm
rpm -ivh --nodeps --force  /stage/UEK3/*
sed -i 's/default=[0-9]/default=1/g' /boot/grub/grub.conf

# Install Source
wget -P /stage/ -c --tries=1000 --wait=5 ftp://192.168.0.254/pub/O11g_x8664/DATABASES/11.2.0.4/p13390677_112040_Linux-x86-64_1of7.zip
unzip -d /stage  /stage/p13390677_112040_Linux-x86-64_1of7.zip
#mv /stage/database /stage/Disk1
rm -f /stage/p13390677_112040_Linux-x86-64_1of7.zip

wget -P /stage/ -c --tries=1000 --wait=5 ftp://192.168.0.254/pub/O11g_x8664/DATABASES/11.2.0.4/p13390677_112040_Linux-x86-64_2of7.zip
unzip -d /stage  /stage/p13390677_112040_Linux-x86-64_2of7.zip
#mv /stage/database /stage/Disk1
rm -f /stage/p13390677_112040_Linux-x86-64_2of7.zip

wget -P /stage/ -c --tries=1000 --wait=5 ftp://192.168.0.254/pub/O11g_x8664/DATABASES/11.2.0.4/p13390677_112040_Linux-x86-64_3of7.zip
unzip -d /stage  /stage/p13390677_112040_Linux-x86-64_3of7.zip
#mv /stage/database /stage/Disk1
rm -f /stage/p13390677_112040_Linux-x86-64_3of7.zip

mkdir -p /stage/12c
wget -P /stage/12c -c --tries=1000 --wait=5 ftp://192.168.0.254/pub/O12c_x8664/DATABASES/12.1.0.1/V46095-01_1of2.zip
unzip -d /stage/12c  /stage/12c/V46095-01_1of2.zip
rm -f /stage/12c/V46095-01_1of2.zip

wget -P /stage/12c -c --tries=1000 --wait=5 ftp://192.168.0.254/pub/O12c_x8664/DATABASES/12.1.0.1/V46095-01_2of2.zip
unzip -d /stage/12c  /stage/12c/V46095-01_2of2.zip
rm -f /stage/12c/V46095-01_2of2.zip

wget -P /stage/12c -c --tries=1000 --wait=5 ftp://192.168.0.254/pub/O12c_x8664/INFRA/V46096-01_1of2.zip
unzip -d /stage/12c  /stage/12c/V46096-01_1of2.zip
rm -f /stage/12c/V46096-01_1of2.zip

wget -P /stage/12c -c --tries=1000 --wait=5 ftp://192.168.0.254/pub/O12c_x8664/INFRA/V46096-01_2of2.zip
unzip -d /stage/12c  /stage/12c/V46096-01_2of2.zip
rm -f /stage/12c/V46096-01_2of2.zip

chown -R oracle:oinstall /stage/

cat > /usr/sbin/oracleasm.sh <<!
if
        grep -q hda /proc/partitions
then
        disktype=sda
elif
        grep -q vda /proc/partitions
then
        disktype=vda
elif
        grep -q xvda /proc/partitions
then
        disktype=xvda
elif
        grep -q sda /proc/partitions
then
        disktype=sda
else
        disktype=sda
fi

chkconfig oracleasm on
oracleasm configure -i<<EOF
oracle
asmadmin
y
y
EOF

oracleasm init

vd1=/dev/\${disktype}5
vd2=/dev/\${disktype}6
vd3=/dev/\${disktype}7
vd4=/dev/\${disktype}8
vd5=/dev/\${disktype}3

oracleasm createdisk ASMDISK01 \$vd1
oracleasm createdisk ASMDISK02 \$vd2
oracleasm createdisk ASMDISK03 \$vd3
oracleasm createdisk ASMDISK04 \$vd4
oracleasm createdisk ASMDISK05 \$vd5
!

chmod +x /usr/sbin/oracleasm.sh

echo "99 4 crs /usr/sbin/oracleasm.sh  >> /var/log/emca" >> /etc/anacrontab

# Sqlplus Extent Script
#wget -P /stage -c --tries=100 --wait=5 http://192.168.0.254/pub/O10g/OTHERS/alllinux/sqlplus_extentsetup3.0.tgz
#tar -C  /stage -zxvf /stage/sqlplus_extentsetup3.0.tgz
#rm -f /stage/sqlplus_extentsetup3.0.tgz
#cd /stage/sqlplus_extentsetup3.0/
#./setup.sh
#cd -
chkconfig oracle off

mkdir -p /u01/data/backup
chown -R oracle:oinstall /u01/data/

##
##    3.7.4 Database End
##    3.7.5 OU Begin
##


wget -P /home/oracle/ -c --tries=100 --wait=5 http://192.168.0.254/pub/O10g/OTHERS/alllinux/create_t04209_uname.sql 
wget -P /home/oracle/ -c --tries=100 --wait=5 http://192.168.0.254/pub/O10g/OTHERS/alllinux/select_t04209_uname.sql 
wget -P /home/oracle/ -c --tries=100 --wait=5 http://192.168.0.254/pub/O10g/OTHERS/alllinux/update_t04209_uname.sql 
wget -P /home/oracle/ -c --tries=100 --wait=5 http://192.168.0.254/pub/O10g/OTHERS/alllinux/update2_t04209_uname.sql
wget -P /home/oracle/ -c --tries=100 --wait=5 http://192.168.0.254/pub/O10g/OTHERS/alllinux/RMasmcmd.sh
chown oracle:oinstall /home/oracle/*.sql
chown oracle:oinstall /home/oracle/RMasmcmd.sh

##
##   3.7.5 OU End

###   3.7 Oracle End
###   3.9 Tape Begin
###

yum -y install zlib-devel
yum -y install mtx
yum -y install mt-st
yum -y install lsscsi
yum -y install sg3_utils
yum -y install ncompress

wget -P /stage -c --tries=100 --wait=5 http://192.168.0.254/pub/O12c_x8664/TAPE/mhvtl-2016-03-10.tgz
wget -P /stage -c --tries=100 --wait=5 http://192.168.0.254/pub/O12c_x8664/TAPE/V100647-01.zip
wget -P /stage -c --tries=100 --wait=5 http://192.168.0.254/pub/O10g/TAPE/osb.txt
wget -P /stage -c --tries=100 --wait=5 http://192.168.0.254/pub/O10g/TAPE/osb.sh
wget -P /stage -c --tries=100 --wait=5 http://192.168.0.254/pub/O10g/TAPE/reuseosb.sh
wget -P /stage -c --tries=100 --wait=5 http://192.168.0.254/pub/O12c_x8664/TAPE/lzo-2.04-3.4.x86_64.rpm
rpm -Uvh /stage/lzo-2.04-3.4.x86_64.rpm
wget -P /stage -c --tries=100 --wait=5 http://192.168.0.254/pub/O12c_x8664/TAPE/lzo-devel-2.04-3.4.x86_64.rpm
rpm -Uvh /stage/lzo-devel-2.04-3.4.x86_64.rpm
wget -P /stage -c --tries=100 --wait=5 http://192.168.0.254/pub/O12c_x8664/UEK3/libdtrace-ctf-0.5.0-2.x86_64.rpm
rpm -Uvh /stage/libdtrace-ctf-0.5.0-2.x86_64.rpm
wget -P /stage -c --tries=100 --wait=5 http://192.168.0.254/pub/O10g/TAPE/copytape-root.sh
wget -P /stage -c --tries=100 --wait=5 http://192.168.0.254/pub/O10g/TAPE/revertape-root.sh
cd /stage
tar zxvf mhvtl-2016-03-10.tgz
rm -f /stage/mhvtl-2016-03-10.tgz
cd /stage
unzip V100647-01.zip
rm -f /stage/V100647-01.zip
cd /stage/mhvtl-1.5
useradd vtl
echo oracle | passwd --stdin vtl
mkdir /opt/mhvtl
mkdir /etc/mhvtl
chown -R vtl:vtl /opt/mhvtl
chown -R vtl:vtl /etc/mhvtl
make distclean
cd /stage/mhvtl-1.5/kernel
make 
make install
cd /stage/mhvtl-1.5/
make 
make install
service mhvtl start
perl -i -pe 's,CAPACITY=500,CAPACITY=8000,' /etc/mhvtl/mhvtl.conf
chkconfig mhvtl on
service mhvtl stop
service mhvtl start
mkdir -p /usr/local/oracle/backup
mkdir -p /data/backup
chown oracle:oinstall /data/backup
# sed -i.bak 's/192.168.0.254/127.0.0.1/g' /etc/resolv.conf

###
###   3.9 Tape End
###
###   3.11 Udev End
####  3 Post End
####
###   3.6 Grub Begin

if grep '2.6.18' /boot/grub/grub.conf >/dev/null
then
 A=`grep vmlinuz /boot/grub/grub.conf | grep -v '^#' | grep -v xen |  grep -v debug | head -n 1 | tr ' ' '\n'  | grep vmlinuz | cut -d / -f 2`
 B=`grep initrd /boot/grub/grub.conf | grep -v '^#' | grep -v xen |  grep -v debug  | head -n 1 | tr ' ' '\n'  | grep initrd- | cut -d / -f 2`
 C=vmlinuz-2.6.32-71.el6.i686
 D=initramfs-2.6.32-71.el6.i686.img
else
 A=vmlinuz-2.6.18-164.el5PAE
 B=initrd-2.6.18-164.el5PAE.img
 C=`grep vmlinuz /boot/grub/grub.conf | grep -v '^#' | grep -v xen |  grep -v debug | head -n 1 | tr ' ' '\n'  | grep vmlinuz | cut -d / -f 2`
 D=`grep initrd /boot/grub/grub.conf | grep -v '^#' | grep -v xen |  grep -v debug  | head -n 1 | tr ' ' '\n'  | grep initrd- | cut -d / -f 2`
fi

# OCA/OCP
echo "title /dev/sda1---> Oracle 11g OCA/OCP: Database Standalone Server (2.6.18-164.el5)" >> /boot/grub/grub.conf
echo "root (hd0,0)" >> /boot/grub/grub.conf
echo "kernel /$A ro root=/dev/O11grhel5/root rhgb quiet" >>  /boot/grub/grub.conf
echo "initrd /$B" >> /boot/grub/grub.conf

# Dataguard
echo "title /dev/sda10---> Oracle 11g OCM: Dataguad Configuration (2.6.18-164.el5)" >> /boot/grub/grub.conf
echo "root (hd0,9)" >> /boot/grub/grub.conf
echo "kernel /$A ro root=/dev/DG11grhel5/root rhgb quiet" >>  /boot/grub/grub.conf
echo "initrd /$B" >> /boot/grub/grub.conf

# Grid Control
echo "title /dev/sda10---> Oracle 11g OCM: Grid Control (2.6.18-164.el5)" >> /boot/grub/grub.conf
echo "root (hd0,9)" >> /boot/grub/grub.conf
echo "kernel /$A ro root=/dev/GC11grhel5/root rhgb quiet" >>  /boot/grub/grub.conf
echo "initrd /$B" >> /boot/grub/grub.conf

# New Feature
echo "title /dev/sda10---> Oracle 11g OCM: New Feature (2.6.18-164.el5)" >> /boot/grub/grub.conf
echo "root (hd0,9)" >> /boot/grub/grub.conf
echo "kernel /$A ro root=/dev/NEW11grhel5/root rhgb quiet" >>  /boot/grub/grub.conf
echo "initrd /$B" >> /boot/grub/grub.conf


# RAC nodes
echo "title /dev/sda10---> Oracle 11g OCM: RAC Instance (2.6.18-164.el5)" >> /boot/grub/grub.conf
echo "root (hd0,9)" >> /boot/grub/grub.conf
echo "kernel /$A ro root=/dev/RAC11grhel5/root rhgb quiet" >>  /boot/grub/grub.conf
echo "initrd /$B" >> /boot/grub/grub.conf

# Shared Disk
echo "title /dev/sda10---> Oracle 11g OCM: RAC Shareddisk iSCSI Device (2.6.32-71.el6)" >> /boot/grub/grub.conf
echo "root (hd0,9)" >> /boot/grub/grub.conf
echo "kernel /$C ro root=/dev/mapper/RAC11grhel6shareddisk-root rd_LVM_LV=RAC11grhel6shareddisk/root rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto rhgb quiet" >> /boot/grub/grub.conf
echo "initrd /$D" >> /boot/grub/grub.conf

# OCM10g
echo "title /dev/sda10---> Oracle 10g OCM PRACTICUM: Even (2.6.18-164.el5)" >> /boot/grub/grub.conf
echo "root (hd0,9)" >> /boot/grub/grub.conf
echo "kernel /$A ro root=/dev/OCM10geven/root rhgb quiet" >>  /boot/grub/grub.conf
echo "initrd /$B" >> /boot/grub/grub.conf

echo "title /dev/sda10---> Oracle 10g OCM PRACTICUM: Odd (2.6.18-164.el5)" >> /boot/grub/grub.conf
echo "root (hd0,9)" >> /boot/grub/grub.conf
echo "kernel /$A ro root=/dev/OCM10godd/root rhgb quiet" >>  /boot/grub/grub.conf
echo "initrd /$B" >> /boot/grub/grub.conf

echo "title /dev/sda10---> Oracle 10g OCM PRACTICUM: RAC Instance (2.6.18-164.el5)" >> /boot/grub/grub.conf
echo "root (hd0,9)" >> /boot/grub/grub.conf
echo "kernel /$A ro root=/dev/OCM10grac/root rhgb quiet" >>  /boot/grub/grub.conf
echo "initrd /$B" >> /boot/grub/grub.conf

echo "title /dev/sda10---> Oracle 10g OCM PRACTICUM: RAC Shareddisk iSCSI Device (2.6.32-71.el6)" >> /boot/grub/grub.conf
echo "root (hd0,9)" >> /boot/grub/grub.conf
echo "kernel /$C ro root=/dev/mapper/OCM10gshareddisk-root rd_LVM_LV=OCM10gshareddisk/root rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto rhgb quiet" >> /boot/grub/grub.conf
echo "initrd /$D" >> /boot/grub/grub.conf

# OCM11g1days
echo "title /dev/sda10---> Oracle 11g1days OCM UPDATE PRACTICUM: Even (2.6.18-164.el5)" >> /boot/grub/grub.conf
echo "root (hd0,9)" >> /boot/grub/grub.conf
echo "kernel /$A ro root=/dev/OCM11g1dayseven/root rhgb quiet" >>  /boot/grub/grub.conf
echo "initrd /$B" >> /boot/grub/grub.conf

echo "title /dev/sda10---> Oracle 11g1days OCM UPDATE PRACTICUM: Odd (2.6.18-164.el5)" >> /boot/grub/grub.conf
echo "root (hd0,9)" >> /boot/grub/grub.conf
echo "kernel /$A ro root=/dev/OCM11g1daysodd/root rhgb quiet" >>  /boot/grub/grub.conf
echo "initrd /$B" >> /boot/grub/grub.conf

# OCM11g2days
echo "title /dev/sda10---> Oracle 11g2days OCM PRACTICUM: Even (2.6.18-164.el5)" >> /boot/grub/grub.conf
echo "root (hd0,9)" >> /boot/grub/grub.conf
echo "kernel /$A ro root=/dev/OCM11g2dayseven/root rhgb quiet" >>  /boot/grub/grub.conf
echo "initrd /$B" >> /boot/grub/grub.conf

echo "title /dev/sda10---> Oracle 11g2days OCM PRACTICUM: Odd (2.6.18-164.el5)" >> /boot/grub/grub.conf
echo "root (hd0,9)" >> /boot/grub/grub.conf
echo "kernel /$A ro root=/dev/OCM11g2daysodd/root rhgb quiet" >>  /boot/grub/grub.conf
echo "initrd /$B" >> /boot/grub/grub.conf

echo "title /dev/sda10---> Oracle 11g2days OCM PRACTICUM: RAC Instance (2.6.18-164.el5)" >> /boot/grub/grub.conf
echo "root (hd0,9)" >> /boot/grub/grub.conf
echo "kernel /$A ro root=/dev/OCM11g2daysrac/root rhgb quiet" >>  /boot/grub/grub.conf
echo "initrd /$B" >> /boot/grub/grub.conf

echo "title /dev/sda10---> Oracle 11g2days OCM PRACTICUM: RAC Shareddisk iSCSI Device (2.6.32-71.el6)" >> /boot/grub/grub.conf
echo "root (hd0,9)" >> /boot/grub/grub.conf
echo "kernel /$C ro root=/dev/mapper/OCM11g2daysshareddisk-root rd_LVM_LV=OCM11g2daysshareddisk/root rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto rhgb quiet" >> /boot/grub/grub.conf
echo "initrd /$D" >> /boot/grub/grub.conf

perl -i -pe 's,timeout=,timeout=5000,' /boot/grub/grub.conf
grep -v 'hiddenmenu' /boot/grub/grub.conf > /boot/grub/grub.conf2
mv -f /boot/grub/grub.conf2 /boot/grub/grub.conf

###
###   3.6 Grub end
%pre
# Partition Total 19028M
echo "Starting PRE" > /dev/tty2

v_pci0=$(udevinfo -ap /sys/class/net/eth0 | grep 'ID==' | head -n 1)
v_pci1=$(udevinfo -ap /sys/class/net/eth1 | grep 'ID==' | head -n 1)
v_driver0=$(udevinfo -ap /sys/class/net/eth0 | grep 'DRIVER==' | head -n 1)
v_driver1=$(udevinfo -ap /sys/class/net/eth1 | grep 'DRIVER==' | head -n 1)
v_mac0=$(ifconfig eth0 | grep HWaddr | cut -d ' ' -f 11)
v_mac1=$(ifconfig eth1 | grep HWaddr | cut -d ' ' -f 11)

if [ ! -z $v_mac1 ]
then
 cat >> /etc/udev/rules.d/60-net.rules <<EOF
$v_driver0, $v_pci0, NAME="eth0"
$v_driver1, $v_pci1, NAME="eth1"
EOF
fi

v_ip_short=$(grep $v_mac0 /mnt/source/workstation.list | cut -d '-' -f 1)
v_ip=192.168.0.$v_ip_short

if [ ! -z $v_ip_short ]
then
 ifconfig eth0 $v_ip
 hostname station$v_ip_short.example.com
fi

# CLASSROOM MACHINE(c) NEED A DISK OF: 90000M
cat >>  /tmp/partitioning <<EOF
clearpart --none
part /boot  --size 300
part swap --size 4096
part pv.RAC12crhel601 --size 45800
volgroup RAC12crhel6 pv.RAC12crhel601
logvol /  --vgname=RAC12crhel6 --size=45700 --name=root
part pv.O11grhel502 --size 7000
part pv.O11grhel503 --size 7000
part pv.O11grhel504 --size 7000
part pv.O11grhel505 --size 7000
part pv.O11grhel506 --size 10000
EOF


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值