Oracle requires a series of configurations before installation on linux. if the environment is set up each time, it is a little slow to execute manually. Here, two scripts are written to achieve automatic configuration and installation. Currently
Oracle requires a series of configurations before installation on linux. if the environment is set up each time, it is a little slow to execute manually. Here, two scripts are written to achieve automatic configuration and installation. Currently
Before installing Oracle on linux, You need to perform a series of configurations. Manual execution of each environment is slow;
Two scripts are written here for automatic configuration and installation. Currently, the installation is successful on your CentOS6.3 linux template;
It is not tested on other systems. before using it, you must first understand the script, configure a static IP address for the NIC, and modify the IP address before performing the operation;
Scripts are composed of a series of functions in sequence;
#! /Bin/bash
# Set-x
Echo "Start Configure Oracle Environment For Install ........................."
Time = 'date + % Y % m % d _ % H % M % s'
Flag = "##################################### ###############################"
# It is easy to back up the configuration file. just copy the system configuration file to be modified and copy the two files to facilitate recovery.
Backup_config (){
# Echo "$ flag"
Echo "######################## Step 1: backup system config that will be modified ###########################"
Cp/etc/sysconfig/network. bak $ {time}
Cp/etc/sysctl. conf/etc/sysctl. conf. bak $ {time}
Cp/etc/security/limits. conf/etc/security/limits. conf. bak $ {time}
Cp/etc/pam. d/login/etc/pam. d/login. bak $ {time}
Cp/etc/profile. bak $ {time}
Cp/home/oracle/. bash_profile/home/oracle/. bash_profile.bak $ {time}
Cp/etc/selinux/config. bak $ {time}
Cp/etc/sysconfig/network. bak
Cp/etc/sysctl. conf/etc/sysctl. conf. bak
Cp/etc/security/limits. conf/etc/security/limits. conf. bak
Cp/etc/pam. d/login/etc/pam. d/login. bak
Cp/etc/profile. bak
Cp/home/oracle/. bash_profile/home/oracle/. bash_profile.bak
Cp/etc/selinux/config. bak
}
# Obtain the current system information, configure hostname, and disable selinux
Sys_info ()
{
# Echo "$ flag"
Echo "check system space and version ";
Echo "######################## Step 2: check system space and versio ################################### ######"
Uname-
Cat/etc/* release
Df-h
Hostname
Ip_add = 'ifconfig | grep' inet addr: '| grep-v '2017. 0.0.1' | cut-d:-f2 | awk '{print $1 }''
Ip_code = 'ifconfig | grep' inet addr: '| grep-V' 127. 0.0.1 '| cut-d:-f2 | awk' {print $1} '| cut-d. -f4'
Echo "$ ip_add oraserver $ {ip_code}">/etc/hosts
Sed-I '/HOSTNAME =/s/localhost. localdomain/oraserver' "$ {ip_code}" '/etc/sysconfig/network
Sed-I '/SELINUX =/s/enforcing/disabled/'/etc/selinux/config
Hostname oraserver $ {ip_code}
}
# Install the required dependent packages. The customized RPM varies with different systems. You can manually check this step.
Rpm_info ()
{
Echo "######################## Step 2: install oracle rpms ##################################### ##############"
Rpm-q binutils compat-libstdc ++ elfutils-libelf kernel-libelf-devel gcc-c ++ glibc-common glibc-devel glibc-headers ksh libaio-devlibel gcc stlibdc ++ make numactl-devel sysstat unixODBC-devel elfutils-libelf-devel-static kernel-headers libgomp
Rpm-ivh/root/rpm-centos/lrzsz-0.12.20-27.1.el6.x86_64.rpm
Rpm-ivh/root/rpm-centos/compat-libstdc ++-33-3.2.3-69.el6.x86_64.rpm
Rpm-ivh/root/rpm-centos/unixODBC *
Rpm-ivh/root/rpm-centos/libaio *
Rpm-ivh/root/rpm-centos/numactl *
Rpm-ivh/root/rpm-centos/sysstat *
Rpm-ivh/root/rpm-centos/unzip-6.0-1.el6.x86_64.rpm
Rpm-ivh/root/rpm-centos/ksh-20100621-16.el6.x86_64.rpm
Rpm-ivh/root/rpm-centos/elfutils-libs-0.152-1.el6.x86_64.rpm
Rpm-ivh/root/rpm-centos/elfutils-libelf-devel *
Echo "######### After Install essential rpms"
Rpm-q binutils compat-libstdc ++ elfutils-libelf kernel-libelf-devel gcc-c ++ glibc-common glibc-devel glibc-headers ksh libaio-devlibel gcc stlibdc ++ make numactl-devel sysstat unixODBC-devel elfutils-libelf-devel-static kernel-headers libgomp
}
# Create oracle users, related directories, and allow oracle to execute scripts as root users using sudo
Oracle_user ()
{
Echo "######################## Step 3: add oracle user and group, create directory #############################"
Groupadd oinstall
Groupadd dba
Useradd-g oinstall-G dba-d/home/oracle-m-s/bin/bash-c "ORACLE" oracle
Echo "oracle: oracle">/root/oracle_pass
Chpasswd </root/oracle_pass
Rm-rf/root/oracle_pass
Id oracle;
Id nobody;
Echo "";
Echo "######### create oracle directory"
Mkdir-p/oracle;
Mkdir-p/oracle/oraInventory;
Chown-R oracle: oinstall/oracle;
Chmod-R 775/oracle /;
Echo "######### Add Oracle to sudu user"
Chmod u + w/etc/sudoers
Echo "oracle ALL = (ALL) ALL">/etc/sudoers
Chmod u-w/etc/sudoers
}