雷锋 发表于 2018-8-28 08:39:07

使用Shell脚本实现自动化静默安装Oracle软件

#!/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
页: [1]
查看完整版本: 使用Shell脚本实现自动化静默安装Oracle软件