Created
June 24, 2019 05:58
-
-
Save ts050/be41df907b36b437cc5f3be0bdb070cd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| if [ ! -f /etc/centos-release ]; then | |
| echo "The current OS is not a CentOS" | |
| exit 0 | |
| fi | |
| if [ "$EUID" -ne 0 ]; then | |
| echo "Please run as root" | |
| exit 0 | |
| fi | |
| echo "Updating system and installing dependencies" | |
| sudo yum update -y -q | |
| sudo yum install -q -y binutils.x86_64 compat-libcap1.x86_64 gcc.x86_64 gcc-c++.x86_64 glibc.i686 \ | |
| glibc.x86_64 glibc-devel.i686 glibc-devel.x86_64 ksh compat-libstdc++-33 \ | |
| libaio.i686 libaio.x86_64 libaio-devel.i686 libaio-devel.x86_64 libgcc.i686 \ | |
| libgcc.x86_64 libstdc++.i686 libstdc++.x86_64 libstdc++-devel.i686 libstdc++-devel.x86_64 \ | |
| libXi.i686 libXi.x86_64 libXtst.i686 libXtst.x86_64 make.x86_64 \ | |
| sysstat.x86_64 zip unzip bind-pkcs11-utils.x86_64 bind-devel.x86_64 \ | |
| bind-libs.i686 libxcb-devel.i686 smartmontools net-tools libX11-devel.i686 \ | |
| zlib-devel.i686 zlib-devel.x86_64 libXau-devel.i686 libXext-devel.x86_64 libXext-devel.i686 | |
| echo "Starting installation" | |
| if [ -f linux*database*.zip ]; then | |
| mkdir -p /stage/ | |
| unzip linux*database*.zip -d /stage/ | |
| else | |
| echo "Zip not found, opening download page and exiting script" | |
| xdg-open https://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html | |
| echo "Please run the script again once you have downloaded the file" | |
| exit 0 | |
| fi | |
| groupadd oinstall | |
| groupadd dba | |
| groupadd oper | |
| useradd -g oinstall -G dba,oper oracle | |
| read -ps "Please enter the password you would like to set for the new user oracle: " password | |
| echo $password | passwd oracle --stdin | |
| echo "Adding to sysctl.conf" | |
| cat > /etc/sysctl.conf <<SYSCTL | |
| fs.aio-max-nr = 1048576 | |
| fs.file-max = 6815744 | |
| kernel.shmall = 2097152 | |
| kernel.shmmax = 1987162112 | |
| kernel.shmmni = 4096 | |
| kernel.sem = 250 32000 100 128 | |
| net.ipv4.ip_local_port_range = 9000 65500 | |
| net.core.rmem_default = 262144 | |
| net.core.rmem_max = 4194304 | |
| net.core.wmem_default = 262144 | |
| net.core.wmem_max = 1048586 | |
| SYSCTL | |
| sysctl -a | |
| echo "Setting oracle user limits" | |
| cat > /etc/security/limits.conf <<LIM | |
| oracle soft nproc 2047 | |
| oracle hard nproc 16384 | |
| oracle soft nofile 1024 | |
| oracle hard nofile 65536 | |
| LIM | |
| # Change SELinux mode to Permissive | |
| sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/sysconfig/selinux | |
| setenforce permissive | |
| # Configure Linux Firewall to allow Oracle SQL* Net Listener to accept service requests on its default port | |
| firewall-cmd --permanent --add-port=1521/tcp | |
| firewall-cmd --reload | |
| chown -R oracle:oinstall /stage/ | |
| mkdir -p /u01 /u02 | |
| chown -R oracle:oinstall /u01 /u02 | |
| chmod -R 775 /u01 /u02 | |
| chmod g+s /u01 /u02 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment