目录
- 一.环境准备
- 1.关闭防火墙
- 2.关闭SELINUX
- 3.配置本地yum源
- 4.安装ORACLE先决条件的软件包
- 5.修改LINUX的内核文件
- 6.添加下列参数到/etc/security/limits.conf
- 7.添加下列条目到/etc/pam.d/login
- 8.环境变量中添加下列语句
- 9.创建文件目录和相应的用户
- 10.配置oracle用户的环境变量
- 11.上传软件并解压
- 二.图形安装
- 第一步 执行安装命令
- 第二步 配置监听
- 第三步 创建数据库
- 第四步 测试
一.环境准备
1.关闭防火墙
#检查防火墙状态
systemctl status firewalld.service
#暂时关闭防火墙,下次启动时防火墙仍随系统启动而启动
systemctl stop firewalld.service
#彻底永久关闭防火墙
systemctl disable firewalld.service
2.关闭SELINUX
vi /etc/selinux/config
将内容
SELINUX=enforcing
更改为
SELINUX=disabled
或者命令关闭selinux
sed -i's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
3.配置本地yum源
[root@localhost ~]# mkdir /yums
[root@localhost ~]# cd /run/media/root/CentOS\ 7\ x86_64/Packages/
[root@localhost Packages]# cp * /yums
[root@localhost Packages]# cd /yums
[root@localhost yums]# createrepo .
......
[root@localhost yums]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# rm -rf *
[root@localhost yum.repos.d]# vim yum.local.repo
[local]
name=yum local repo
baseurl=file:///yums
gpgcheck=0
enable=1
[root@localhost yum.repos.d]# yum clean all
Loaded plugins: fastestmirror, langpacks
Cleaning repos: local
Cleaning up list of fastest mirrors
[root@localhost yum.repos.d]# yum repolist
4.安装ORACLE先决条件的软件包
yum install -y bc
yum install -y compat-libcap1*
yum install -y compat-libcap*
yum install -y binutils
yum install -y compat-libstdc++-33
yum install -y elfutils-libelf
yum install -y elfutils-libelf-devel
yum install -y gcc
yum install -y gcc-c++
yum install -y glibc-2.5
yum install -y glibc-common
yum install -y glibc-devel
yum install -y glibc-headers
yum install -y ksh libaio
yum install -y libaio-devel
yum install -y libgcc
yum install -y libstdc++
yum install -y libstdc++-devel
yum install -y make
yum install -y sysstat
yum install -y unixODBC
yum install -y unixODBC-devel
yum install -y binutils*
yum install -y compat-libstdc*
yum install -y elfutils-libelf*
yum install -y gcc*
yum install -y glibc*
yum install -y ksh*
yum install -y libaio*
yum install -y libgcc*
yum install -y libstdc*
yum install -y make*
yum install -y sysstat*
yum install -y libXp*
yum install -y glibc-kernheaders
yum install -y net-tools-*
5.修改LINUX的内核文件
#修改配置
vi /etc/sysctl.conf
kernel.shmmax = 277495689510912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
fs.file-max = 6815744
kernel.shmall = 67747971072
net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.ip_local_port_range = 9000 65500
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_tw_reuse = 1
#net.core.somaxconn = 262144
net.core.netdev_max_backlog = 262144
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_keepalive_time = 30
net.ipv4.tcp_keepalive_probes = 6
net.ipv4.tcp_keepalive_intvl = 5
net.ipv4.tcp_timestamps = 0
fs.aio-max-nr = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
#生成系统参数
sysctl -p
6.添加下列参数到/etc/security/limits.conf
vi /etc/security/limits.conf
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
oracle hard memlock 134217728
oracle soft memlock 134217728
7.添加下列条目到/etc/pam.d/login
vim /etc/pam.d/login
session required /lib/security/pam_limits.so
session required pam_limits.so
8.环境变量中添加下列语句
vim /etc/profile
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
#生成环境变量
source /etc/profile
9.创建文件目录和相应的用户
groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba,oper oracle
mkdir -p /u01/app/oracle
mkdir -p /u01/oraInventory
chown -R oracle.oinstall /u01
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/app/oracle
--ORACLE的HOME目录
mkdir -p /u01/app/oracle/product/11.2.0/db_1
chown -R oracle:oinstall /u01/app/oracle/product/
10.配置oracle用户的环境变量
su - oracle
vim .bash_profile
export EDITOR=vi
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_SID=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export INVENTORY_LOCATION=/u01/oraInventory
export TNS_ADMIN=$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export NLS_LANG="AMERICAN_AMERICA.AL32UTF8"
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin:$PATH:$HOME/bin
umask 022
source .bash_profile
11.上传软件并解压
#上传到/home/oracle
chown -R oracle:oinstall 压缩包
#切换oracle账户
su - oralce
unzip 压缩包
二.图形安装
第一步 执行安装命令
#root执行
[root@localhost oracle]# export DISPLAY=:0.0
[root@localhost oracle]# xhost +
access control disabled, clients can connect from any host
#oracle执行
[oracle@localhost db_1]# export DISPLAY=:0.0
[oracle@localhost db_1]# xhost +
access control disabled, clients can connect from any host
#开始安装
[oracle@localhost localhost]# cd database
[oracle@localhost database]# ./runInstaller
1)不勾选,next,报错选择yes
2)跳过软件更新
3)选择安装选项
4)选择单实例
5)english,next
6)选择版本
7)选择安装目录
8)对应组信息
9)安装校验信息
10)开始安装
11)安装过程中出现报错
如果出现target 'agent nmhs' of makefile :这个是RHEL 7与oracle11的一个BUG,具体处理如下:
1、cd $ORACLE_HOME
2、cd sysman/lib
3、cp ins_emagent.mk ins_emagent.mk.bak
4、vi ins_emagent.mk
5、查到:NMECTL ,增加 -lnnz11
12)执行脚本 root账户
13)安装完成 close
第二步 配置监听
#oracle账户执行
netca
关闭就可以了
第三步 创建数据库
#oracle账户执行
dbca
1)开始创建数据库 next
2)下一步
3)填写实例名称
4)不配置EM
5)配置相同的密码
6)下一步
7)不设置归档
8)下一步
9)下一步
10)下一步
11)finish
12)稍等,完成安装
第四步 测试
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Fri Sep 22 20:42:41 2023
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>