ShellスクリプトによるOracleソフトウェアの自動サイレントインストール


1、まず、yumサービスとoracleソフトウェアのダウンロードを提供するためのWebサイトを構築する必要があります.ソフトウェアリポジトリのようなものです.(Webサービスの代わりにFtpサービスを利用して、自分の選択を見ることもできます)
2、Oracleソフトウェアのインストールでは、ルート・ディレクトリにインストールしないことを推奨します.したがって、このスクリプトの/uディレクトリはパーティションです./uパーティションがない場合、関連ディレクトリはルート・ディレクトリの下にあります.このスクリプトは、PXE+KICKSTARTの無人インストールと組み合わせて、一括導入を実現することもできます.
3、シナリオの内容は以下の通りです.
#!/bin/bash
################################################################################################
# Install softeare -- Install oracle 11g database software
# 
# History: 2016/01/25 zhuwei First release
################################################################################################
# set a safe path before doing anything else
PATH=/sbin:/usr/sbin:/bin:/usr/bin; export PATH
WEBSITE="http://192.168.1.10"
#-----------------------------------------------------------------------------------------------
# This script must be executed as root
RUID=`/usr/bin/id|awk -F\( '{print $1}'|awk -F\= '{print $2}'`
if [ ${RUID} != "0" ];then
    $ECHO "This script must be executed as root"
    exit 1
fi
#-----------------------------------------------------------------------------------------------
prepareSystem(){
# Set SElinux to disabled mode regardless of its initial value
  sed -i -e 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
  setenforce 0
# stop iptables
  /etc/init.d/iptables stop
# *** Chkconfig section 
# Turn off unwanted services
  chkconfig --level 0123456 iptables off
  chkconfig --level 0123456 ip6tables off
}
#-----------------------------------------------------------------------------------------------
# Display an error and exit
errorExit() {
    echo "$@" >&2
    exit 1
}
#-----------------------------------------------------------------------------------------------
# Display the normal print
displayheader() {
    echo -e "\033[32m*******************************************************************\033[0m"
    echo -e "\033[32m*\033[0m"$@""
    echo -e "\033[32m*******************************************************************\033[0m"
    echo ""
}
#-----------------------------------------------------------------------------------------------
#download oracle software
download(){
    wget -N -q -P /u $WEBSITE/oracle11g/p10404530_112030_Linux-x86-64_1of7.zip
    wget -N -q -P /u $WEBSITE/oracle11g/p10404530_112030_Linux-x86-64_2of7.zip
    
    unzip -q -d /u /u/p10404530_112030_Linux-x86-64_1of7.zip
    unzip -q -d /u /u/p10404530_112030_Linux-x86-64_2of7.zip
    
    rm -rf /u/p10404530_112030_Linux-x86-64_1of7.zip
    rm -rf /u/p10404530_112030_Linux-x86-64_2of7.zip
    
    chown -R oracle:oinstall /u/database
}
#-----------------------------------------------------------------------------------------------
#Configure the kernel params
Configure1(){
    cat >> /etc/sysctl.conf <> /etc/security/limits.conf <> /etc/pam.d/login <> /home/oracle/.bash_profile < 
  


$ORACLE_BASE/oraInventory/orainstRoot.sh $ORACLE_HOME/root.sh 。