系统使用rhel7/centos7/Oracle Linux Server release 7
数据库安装包上传到/tmp目录
cd /tmp
unzip Oracle_122010_Linux-x86-64.zip
需在图形界面下执行脚本和安装程序
执行初始化
#http://public-yum.oracle.com/getting-started.html#checking-yum-configuration
echo -n "正在配置iptables防火墙……"
systemctl stop firewalld > /dev/null 2>&1
systemctl disable firewalld > /dev/null 2>&1
if [ $? -eq 0 ];then
echo -n "Iptables防火墙初始化完毕!"
fi
echo -n "正在关闭SELinux……"
setenforce 0 > /dev/null 2>&1
sed -i '/^SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
if [ $? -eq 0 ];then
echo -n "SELinux初始化完毕!"
fi
echo "进入yum配置文件夹,添加oracle的yum信息库"
wget http://public-yum.oracle.com/public-yum-ol7.repo -O /etc/yum.repos.d/public-yum-ol7.repo
echo "使用yum安装oracle预安装文件"
yum install -y oracle-rdbms-server-12cR1-preinstall.x86_64 --nogpgcheck
sysctl -p
sed -i 's@SELINUX=enforcing@SELINUX=disabled@g' /etc/selinux/config
setenforce 0
mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/app/oracle
xhost +
chown -R oracle:oinstall /tmp/database
cat <<EOF >/home/oracle/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
export ORACLE_SID=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/12.2.0/dbhome_1
export PATH=\$PATH:\$ORACLE_HOME/bin
export DISPLAY=:0
export UMASK=022
export PATH
EOF
chown -R 644 /home/oracle/.bash_profile
切换到oracle用户,su - oracle 开始安装数据库
cd /tmp/database/
./runInstaller
下面的步骤按默认即可。
来源:CSDN
作者:运维自动化&云计算
链接:https://blog.csdn.net/h106140873/article/details/103983378