CentOS 6.9 安装Oracle 11G R2

689次阅读

共计 4026 个字符,预计需要花费 11 分钟才能阅读完成。

安装前:

[v_notice]

  1. 内存(RAM)的最小要求是 1GB,建议 2GB 及以上。
  2. 虚拟内存 swap 建议:内存为 1GB~2GB 时建议swap大小为内存大小的 1.5 倍;内存为 2GB~16GB 时建议swap大小为内存的大小;内存超过 16GB 时swap保持16GB。
  3. 要求临时文件目录,如 /tmp 的磁盘空间至少 1GB。
  4. 磁盘空间要求:企业版为4.35GB的安装空间和1.7GB以上的数据文件空间;标准版为4.22GB的安装空间和1.5GB以上的数据文件空间。
  5. 需要 X window 图形界面。
  6. 需要 root 用户权限[/v_notice]

安装环境配置

执行脚本

#!/bin/bash
clear
echo -e "\033[44;37mStart Init...\033[0m"
#System Check
. /etc/init.d/functions
function Environment_Check {
	#Swap check
	SWAP=`free -m | grep Swap |awk '{print $2}'`
	if [ ${SWAP} -eq 0 ];then
		action "Swap Check..." /bin/false
		exit 1
	else
		action "Swap Check..." /bin/true
	fi
	#Mem check
	MEM=`free -m | grep Mem |awk '{print $2}'`
	if [ ${MEM} -lt 2048 ];then
		action "Mem  Check..." /bin/false
		exit 1
	else
		action "Mem  Check..." /bin/true
	fi
	#Disk check
	DISK=`df -h | grep -w / | awk '{print $3}' |cut -f1 -d "G"`
	if [ ${DISK%.*} -lt 6 ];then
		action "Disk Check..." /bin/false
		exit 1
	else
		action "Disk Check..." /bin/true
	fi
}

#Init Packages
function Install_Packages {
echo -e "\033[44;37mInstall Packages...\033[0m"
	for i in binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel libaio libaio-devel libgcc libstdc++ libstdc++-devel make numactl sysstat libXp unixODBC unixODBC-devel
	do
		rpm -q $i &> /dev/null
    		if [ $? != 0 ];then
        	yum -y install $i &> /dev/null
		action "$i..." /bin/true
		else
		action "$i..." /bin/true
		fi
	done
}
#Create User Group
function Config_Sys {
groupadd oinstall &> /dev/null
groupadd dba &> /dev/null
useradd -g oinstall -G dba oracle &> /dev/null
echo "anchnet.coM" | passwd --stdin oracle &> /dev/null
if [ $? -ne 0 ];then
        action "Change Password..." /bin/false
	exit 1
else
        action "Change Password..." /bin/true
fi
cat /etc/sysctl.conf | grep 'fs.aio-max-nr' &> /dev/null
if [ $? -ne 0 ];then
cat >> /etc/sysctl.conf <<EOF
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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 = 1048576
EOF
sysctl -p &> /dev/null
fi
if [ $? -ne 0 ];then
        action "Sysctl Config..." /bin/false
	exit 1
else
        action "Sysctl Config..." /bin/true
fi
cat /etc/pam.d/login | grep "pam_limits.so" &> /dev/null
if [ $? -ne 0 ];then
echo "session   required     pam_limits.so" >> /etc/pam.d/login
action "Pam.d Config..." /bin/true
fi
cat /etc/security/limits.conf | grep oracle &> /dev/null
if [ $? -ne 0 ];then
cat >> /etc/security/limits.conf <<EOF
oracle          soft    nproc   2047
oracle          hard    nproc   16384
oracle          soft    nofile  1024
oracle          hard    nofile  65536
EOF
fi
if [ $? -ne 0 ];then
        action "Limits Config..." /bin/false
	exit 1
else
        action "Limits Config..." /bin/true
fi
}

#Start Install
function Oracle_Config {
echo -e "\033[44;37mConfig Oracle...\033[0m"
[ ! -d /u01/app ] && mkdir -p /u01/app/
[ ! -d /u01/app/oraInventory ] && mkdir -p /u01/app/oraInventory
[ ! -d /u01/app/oracle/oradata ] && mkdir -p /u01/app/oracle/oradata
[ ! -d /backup/oracle ] && mkdir -p /backup/oracle/
chown -R oracle:oinstall  /u01/app/oracle/oradata
chown -R oracle:oinstall  /u01/app/oraInventory
chown -R oracle:oinstall /u01/app
chmod -R 775 /u01/app/
chmod -R 775 /u01/app/oracle/oradata
chmod -R 775 /u01/app/oraInventory
chown -R oracle:oinstall  /backup/oracle/
chmod -R 775 /backup/oracle/
cat /etc/hosts | grep `hostname` &> /dev/null
if [ $? -ne 0 ];then
	echo `ifconfig | grep "inet addr" | grep -v "127.0.0.1"| awk '{print $2}' |awk -F: '{print $2}'` `hostname` >> /etc/hosts
fi
if [ $? -ne 0 ];then
        action "Hosts Config..." /bin/false
	exit 1
else
        action "Hosts Config..." /bin/true
fi
}

#Install VNC
function VNC_Install {
echo -e "\033[44;37mInstall VNC...\033[0m"
echo "Install X Windows System..."
yum groupinstall -y "X Window System" "Desktop" "Chinese Support" &> /dev/null
echo "Install VNC..."
yum install tigervnc-server -y &> /dev/null
echo 'anchnet.coM' | passwd --stdin oracle &> /dev/null
echo 'VNCSERVERS="2:oracle"' >> /etc/sysconfig/vncservers
echo 'VNCSERVERARGS[2]="-geometry 1366x768 -nolisten tcp"' >> /etc/sysconfig/vncservers

echo -e "\033[31mInput VNC Password\033[0m"
su - oracle -c "vncpasswd"
/etc/init.d/vncserver start &> /dev/null
}

#Main
Environment_Check
Install_Packages
Config_Sys
Oracle_Config
VNC_Install

echo -e "\e[1;32mUser    : oracle\e[0m"
echo -e "\e[1;32mPassword: anchnet.coM\e[0m"
echo -e "\e[1;32mVNC User: oracle\e[0m"
echo -e "\e[1;32mVNC Port: 2\e[0m"
echo -e "\e[1;32mOracle install init finished! Please run oracle installer as user oracle \e[0m"

脚本执行如下图所示:

CentOS 6.9 安装Oracle 11G R2

执行到此处时,输入VNC连接的密码,两次

CentOS 6.9 安装Oracle 11G R2

环境初始完成,VNC安装完成,安装信息显示

CentOS 6.9 安装Oracle 11G R2

VNC连接

通过VNC软件连接服务器的2端口,输入VNC密码

CentOS 6.9 安装Oracle 11G R2

CentOS 6.9 安装Oracle 11G R2

 

正文完
 
mervinwang
版权声明:本站原创文章,由 mervinwang 2017-10-13发表,共计4026字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
文章搜索