VMWare虚拟机CentOS 7下Oracle 11g安装详解

一、安装前准备

[[email protected] oracle]$ su root
Password: 
[[email protected] oracle]# groupadd oinstall
[[email protected] oracle]# groupadd dba
[[email protected] oracle]# useradd -g oinstall -g dba -m oracle
[[email protected] oracle]# passwd oracle
[[email protected] oracle]# id oracle

[[email protected] oracle]# mkdir -p /data/oracle
[[email protected] oracle]# mkdir -p /data/oraInventory
[[email protected] oracle]# mkdir -p /data/database
[[email protected] oracle]# cd /data
[[email protected] oracle]# ls
[[email protected] oracle]# chown -R oracle:oinstall /data/oracle
[[email protected] oracle]# chown -R oracle:oinstall /data/oraInventory
[[email protected] oracle]# chown -R oracle:oinstall /data/database

[[email protected] oracle]# yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*i686 compat-libstdc++-33*.devel compat-libstdc++-33 compat-libstdc++-33*.devel gcc gcc-c++ glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio libaio*.i686 libaio-devel libaio-devel*.devel libgcc libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.devel libXi libXi*.i686 libXtst libXtst*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686

[[email protected] oracle]# systemctl status firewalld.service
[[email protected] oracle]# systemctl stop firewalld.service
[[email protected] oracle]# systemctl status firewalld.service
[[email protected] oracle]# systemctl disable firewalld.service
[[email protected] oracle]# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
  SELINUX=disabled   #需要修改此处,将此处修改为disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted 

[[email protected] oracle]# vi /etc/sysctl.conf
#需要添加以下配置参数
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.conf.all.rp_filter = 1
fs.file-max = 6815744 #设置最大打开文件数
fs.aio-max-nr = 1048576
kernel.shmall = 2097152 #共享内存的总量,8G内存设置:2097152*4k/1024/1024
kernel.shmmax = 2147483648 #最大共享内存的段大小
kernel.shmmni = 4096 #整个系统共享内存端的最大数
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500 #可使用的IPv4端口范围
net.core.rmem_default = 262144
net.core.rmem_max= 4194304
net.core.wmem_default= 262144
net.core.wmem_max= 1048576
[[email protected] oracle]# sysctl -p

[[email protected] oracle]# vi /etc/security/limits.conf
#需要添加以下配置
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

[[email protected] oracle]# vi /home/oracle/.bash_profile
#需要加入以下代码(根据自己的实际情况填写路径)
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
export ORACLE_BASE=/home/oracle/app/oracle 
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1 
export ORACLE_SID=orcl 
export ORACLE_TERM=xterm 
export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH 
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib 
export LANG=C
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
[[email protected] oracle]# source /home/oracle/.bash_profile 

[[email protected] oracle]# su oracle
[[email protected] src]$ ls
linux.x64_11gR2_database_1of2.zip  linux.x64_11gR2_database_2of2.zip
[[email protected] src]$ unzip linux.x64_11gR2_database_1of2.zip -d /data/database/#解压
[[email protected] src]$ unzip linux.x64_11gR2_database_2of2.zip -d /data/database/#解压
[[email protected] src]$ su root
[[email protected] src]# chown -R oracle:oinstall /data/database/database/

二、Oracle安装

#我们只用图形化界面来安装Oracle
[[email protected] src]# su oracel
[[email protected] src]$ cd /data/database/database/
[[email protected] database]$ ls
doc  install  response  rpm  runInstaller  sshsetup  stage  welcome.html
[[email protected] database]$ ./runInstaller

 后续安装与Windows大致相同,可能遇到的问题如下:

1、swap空间不足,如图所示:

#解决办法
[[email protected] database]$ free -m
#将当前swap空间由2048M 增加到 3048M 新增一个2014的swap文件
[[email protected] database]$ dd if=/dev/zero of=/home/swap bs=1024 count=1024000
[[email protected] database]$ free -m
[[email protected] database]$ swapon /home/swap
[[email protected] database]$ free -m

VMWare虚拟机CentOS 7下Oracle 11g安装详解

2、若遇到如图所示错误,勾选右上角Ignore All,继续安装即可:

VMWare虚拟机CentOS 7下Oracle 11g安装详解

安装完成后会弹出如下提示框,这时候只需要以root用户登录运行图中路径下的两个文件即可:

VMWare虚拟机CentOS 7下Oracle 11g安装详解