Shell script-CentOS7Oracle11g installation auxiliary script implementation process record

Recently, I am thinking about how to install Oracle 11g in CentOS7 to simplify it. Everyone can install it. Installation is as simple as windows.
Tutorial: "Install Oracle11g with Zero Warning in 2021 Compulsory Proof of the Gospel CentOS7"

But I think it's still too complicated, and I want to use shell scripts to simplify it. Record the entire exploration process.

Example 1: Confirmation prompt (once)

This sample code will prompt for confirmation once. If you make an input error, the program will exit with status 1. This example will only accept Y or N or YES or NO (not case sensitive).

#!/bin/bash
#因为脚本内容大量中文,临时设置中文环境
export LC_ALL=zh_CN.UTF-8
echo '------欢迎使用 CentOS7 Oracle 11G安装助手------'
echo '脚本使用环境如下:'
echo '操作系统: CentOS Linux release 7.9.2009 (Core)'
echo 'Oracle: linux.x64_11g_11.2.0.4'
echo '注意!其他环境尚未测试,请谨慎使用!因此脚本出现任何损失本人不负责。'
echo '脚本替我们做了哪些?脚本只是自动安装和配置所需的程序包,理论上对系统不会造成任何损害的。'
echo '* 创建oracle用户和组。'
echo '* 搭建图形化的操作环境:VNC远程。'
echo '* 防火墙放行VNC端口5901和Oracle默认端口1521。'
echo '* 安装oracle安装程序依赖程序包。'
echo '* 安装中文字体解决中文乱码问题。'
echo '* 单独安装pdksh-5.2.14'
echo '博文地址:https://blog.csdn.net/lxyoucan/article/details/113381858'
echo '------欢迎使用 CentOS7 Oracle 11G安装助手------'
echo '当前操作系统版本是:'
cat /etc/redhat-release
read -r -p "确定继续执行吗? [Y/n] " input

case $input in
    [yY][eE][sS]|[yY]|[1])
		echo "Yes"
		;;

    [nN][oO]|[nN]|[0])
		echo "No"
       	;;

    *)
		echo "Invalid input..."
		exit 1
		;;
esac


reference

"Shell script-prompt confirmation (Y/N, YES/NO)"
https://blog.csdn.net/liyyzz33/article/details/93497802

Guess you like

Origin blog.csdn.net/lxyoucan/article/details/113578401