oracle 11g虚拟机安装环境配置脚本

#!/bin/bash 

host_name="ol6"
domain_name="local"
host_ip="192.168.127.20"

echo "blacklist i2c_piix4"  >> /etc/modprobe.d/blacklist.conf
echo "blacklist pcspkr" >> /etc/modprobe.d/blacklist.conf
echo "$host_ip      $host_name      $host_name.$domain_name" >> /etc/hosts

sed -i '/UseDNS yes/s/^/#/' /etc/ssh/sshd_config
sed -i '/#UseDNS yes/a UseDNS no' /etc/ssh/sshd_config

sed -i '/SELINUX=enforcing/s/^/#/' /etc/selinux/config
sed -i '/#SELINUX=enforcing/a SELinux=disabled' /etc/selinux/config

service iptables stop
chkconfig iptables off
service ip6tables stop
chkconfig ip6tables off

service kdump stop
chkconfig kdump off

service postfix stop
chkconfig postfix off

yum update -y
yum groupinstall -y 'X Window System' 
yum groupinstall -y 'Development Tools'
yum install -y oracle-rdbms-server-11gR2-preinstall
yum install -y vim

mkdir -p /u01/app/oracle/product/11.2.0.4/db_1
chown -R oracle:oinstall /u01
chmod -R 775 /u01

mkdir /home/oracle/scripts

cat > /home/oracle/scripts/setEnv.sh <<EOF
# Oracle Settings
export TMP=/tmp
export TMPDIR=\$TMP

export ORACLE_HOSTNAME=$host_name.$domain_name
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/11.2.0.4/db_1
export ORACLE_SID=orcl

export PATH=/usr/sbin:/usr/local/bin:\$PATH
export PATH=\$ORACLE_HOME/bin:\$PATH

export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib
EOF

echo ". /home/oracle/scripts/setEnv.sh" >> /home/oracle/.bash_profile

chown -R oracle.oinstall /home/oracle/scripts
chmod u+x /home/oracle/scripts/*.sh

posted @ 2018-09-10 12:31  javaite  阅读(362)  评论(0编辑  收藏  举报