欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

CentOS6安装Oracle11g(1)——安装前的准备工作

程序员文章站 2022-06-02 12:49:11
...

CentOS6安装Oracle11g(1)——安装前的准备工作

安装Oracle11g之前首先需要查看计算机是否满足硬件最低要求(内存,交换空间,硬盘空间等)。然后关闭防火墙,配置selinux,主机名等。

一、查看安装环境

1、安装包

(1)linux.x64_11gR2_database_1of2.zip
(2)linux.x64_11gR2_database_2of2.zip

2、操作系统

(1)虚拟机:VMware Workstation12
(2)操作系统:CentOS6.10、64位系统

3、安装oracle11g对计算机硬件的要求

(1)内存:最小1G,推荐2G或2G以上
(2)swap空间:内存在1GB到2GB之间的,设定swap大小为物理内存的1.5倍;内存在2GB到16GB物理内存之间的,设置swap大小与物理内存相等;内存大于16GB的,设置swap大小为16GB。
(3)硬盘空间:硬盘要求空间至少5GB。

4、查看安装环境相关命令

(1)查看操作系统版本

[[email protected] proc]# cat /etc/redhat-release
CentOS release 6.10 (Final)

[[email protected] proc]# cat /etc/issue
CentOS release 6.10 (Final)
Kernel \r on an \m

[[email protected] proc]# cat /proc/version
Linux version 2.6.32-754.27.1.el6.x86_64 ([email protected]) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC) ) #1 SMP Tue Jan 28 14:11:45 UTC 2020

[[email protected] proc]# uname -a
Linux wgx 2.6.32-754.27.1.el6.x86_64 #1 SMP Tue Jan 28 14:11:45 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

(2)查看内存信息

[[email protected] proc]# grep MemTotal /proc/meminfo
MemTotal:        2037224 kB

(3)查看可用内存信息

[[email protected] proc]# free -m
             total       used       free     shared    buffers     cached
Mem:          1989       1683        306          0         22       1472
-/+ buffers/cache:        187       1801
Swap:         3999          0       3999

(4)查看交换分区信息

[[email protected] proc]# grep SwapTotal /proc/meminfo
SwapTotal:       4095996 kB

(5)查看CPU信息

[[email protected] proc]# grep "model name" /proc/cpuinfo
model name	: Intel(R) Core(TM) i3-2120 CPU @ 3.30GHz
model name	: Intel(R) Core(TM) i3-2120 CPU @ 3.30GHz

二、安装前的准备工作

1、关闭防火墙

(1)临时关闭防火墙

[[email protected] proc]# service iptables stop
iptables:将链设置为政策 ACCEPT:filter                    [确定]
iptables:清除防火墙规则:                                 [确定]
iptables:正在卸载模块:                                   [确定]

(2)永久关闭防火墙

[[email protected] proc]# chkconfig iptables off 
[[email protected] proc]# service iptables status
iptables:未运行防火墙。

2、关闭selinux

(1)执行vim /etc/selinux/config,设置SELINUX=disabled

[[email protected] proc]# vim /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
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

(2)执行setenforce 0

[[email protected] proc]# setenforce 0

3、把主机名添加到/etc/hosts文件中

(1)查看主机名

[[email protected] proc]# hostname
wgx

(2)修改/etc/hosts文件

[[email protected] proc]# vim /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.1.10  wgx

4、修改内核参数

(1)编辑/etc/sysctl.conf文件,在文件结尾添加以下内容

vim /etc/sysctl.conf

fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmall = 2097152
kernel.shmmax = 1073741824
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576

注:kernel.shmmax参数的值设置为物理内存的50%。

(2)使配置文件立即生效

[[email protected] soft]# sysctl  -p

net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmall = 2097152
kernel.shmmax = 1073741824
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576

5、修改用户资源限制

(1)修改进程数和最大会话数

修改配置文件/etc/security/limits.conf,在文件结尾添加如下内容:

[[email protected] soft]# vim /etc/security/limits.conf

oracle              soft    nproc  2047
oracle              hard    nproc  16384
oracle              soft    nofile  1024
oracle              hard    nofile  65536
oracle              soft    stack   10240

(2)设置关联信息

修改关联文件/etc/pam.d/login,在文件结尾添加如下内容:

[[email protected] soft]# vim /etc/pam.d/login

session required /lib64/security/pam_limits.so
session required pam_limits.so

6、添加oracle用户和用户组

[[email protected] soft]# groupadd oinstall
[[email protected] soft]# groupadd dba
[[email protected] soft]# useradd -g oinstall -G dba oracle
[[email protected] soft]# passwd oracle
更改用户 oracle 的密码 。
新的 密码:
无效的密码: 它基于字典单词
无效的密码: 过于简单
重新输入新的 密码:
passwd: 所有的身份验证令牌已经成功更新。

7、创建安装目录并赋予用户权限

创建安装目录:/usr/local/oracle,/usr/local/oraInventory,/usr/local/oradata,并赋予用户及权限。

[[email protected] soft]# mkdir -p /usr/local/oracle /usr/local/oraInventory /usr/local/oradata/
[[email protected] soft]# chown -R oracle:oinstall /usr/local/oracle /usr/local/oraInventory /usr/local/oradata/
[[email protected] soft]# chmod -R 775 /usr/local/oracle /usr/local/oraInventory /usr/local/oradata/

查看目录及用户权限:

[[email protected] soft]# ll /usr/local/
总用量 52
drwxr-xr-x. 2 root   root     4096 9月  23 2011 bin
drwxr-xr-x. 2 root   root     4096 9月  23 2011 etc
drwxr-xr-x. 2 root   root     4096 9月  23 2011 games
drwxr-xr-x. 2 root   root     4096 9月  23 2011 include
drwxr-xr-x. 2 root   root     4096 9月  23 2011 lib
drwxr-xr-x. 2 root   root     4096 9月  23 2011 lib64
drwxr-xr-x. 2 root   root     4096 9月  23 2011 libexec
drwxrwxr-x  2 oracle oinstall 4096 2月   2 09:25 oracle
drwxrwxr-x  2 oracle oinstall 4096 2月   2 09:25 oradata
drwxrwxr-x  2 oracle oinstall 4096 2月   2 09:25 oraInventory
drwxr-xr-x. 2 root   root     4096 9月  23 2011 sbin
drwxr-xr-x. 5 root   root     4096 1月  30 17:11 share
drwxr-xr-x. 2 root   root     4096 9月  23 2011 src

8、配置oracle用户环境变量

修改/home/oracle/.bash_profile文件,加入以下内容:

[[email protected] soft]# su - oracle
[[email protected] ~]$ vi .bash_profile

export ORACLE_BASE=/usr/local/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=orcl    
export ORACLE_OWNER=oracle
export PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin

执行source命令使配置的环境变量立即生效:

[[email protected] ~]$ source .bash_profile

9、安装Oracle11g所需的依赖包

(1)查看依赖包的安装情况

[[email protected] oracle]# rpm -qa binutils compat-libstdc++-33 compat-libstdc++-33.i686 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc.i686 glibc-common glibc-devel glibc-devel.i686 glibc-headers ksh libaio libaio.i686 libaio-devel libaio-devel.i686 libgcc libgcc.i686 libstdc++ libstdc++.i686 libstdc++-devel make sysstat unixODBC unixODBC-devel
glibc-2.12-1.212.el6_10.3.x86_64
elfutils-libelf-0.164-2.el6.x86_64
glibc-headers-2.12-1.212.el6_10.3.x86_64
libgcc-4.4.7-23.el6.x86_64
binutils-2.20.51.0.2-5.48.el6_10.1.x86_64
libaio-0.3.107-10.el6.x86_64
glibc-devel-2.12-1.212.el6_10.3.x86_64
glibc-common-2.12-1.212.el6_10.3.x86_64
libstdc++-4.4.7-23.el6.x86_64
make-3.81-23.el6.x86_64

(2)安装所需的依赖包

执行以下命令:

yum -y install binutils compat-libstdc++-33 compat-libstdc++-33.i686elfutils-libelf elfutils-libelf-devel gcc gcc-c++  glibc glibc.i686 glibc-common glibc-devel glibc-devel.i686 glibc-headers ksh libaio libaio.i686 libaio-devel libaio-devel.i686  libgcc libgcc.i686 libstdc++ libstdc++.i686libstdc++-devel make sysstat unixODBC unixODBC-devel

(3)重新查看依赖包的安装情况

[[email protected] oracle]# rpm -qa binutils compat-libstdc++-33 compat-libstdc++-33.i686 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc.i686 glibc-common glibc-devel glibc-devel.i686 glibc-headers ksh libaio libaio.i686 libaio-devel libaio-devel.i686 libgcc libgcc.i686 libstdc++ libstdc++.i686 libstdc++-devel make sysstat unixODBC unixODBC-devel
glibc-2.12-1.212.el6_10.3.x86_64
libstdc++-devel-4.4.7-23.el6.x86_64
gcc-c++-4.4.7-23.el6.x86_64
sysstat-9.0.4-33.el6_9.1.x86_64
elfutils-libelf-0.164-2.el6.x86_64
glibc-headers-2.12-1.212.el6_10.3.x86_64
libgcc-4.4.7-23.el6.x86_64
libgcc-4.4.7-23.el6.i686
elfutils-libelf-devel-0.164-2.el6.x86_64
glibc-2.12-1.212.el6_10.3.i686
unixODBC-2.2.14-14.el6.x86_64
libaio-0.3.107-10.el6.i686
gcc-4.4.7-23.el6.x86_64
libaio-devel-0.3.107-10.el6.x86_64
unixODBC-devel-2.2.14-14.el6.x86_64
ksh-20120801-37.el6_9.x86_64
binutils-2.20.51.0.2-5.48.el6_10.1.x86_64
libaio-0.3.107-10.el6.x86_64
glibc-devel-2.12-1.212.el6_10.3.x86_64
glibc-common-2.12-1.212.el6_10.3.x86_64
libstdc++-4.4.7-23.el6.x86_64
glibc-devel-2.12-1.212.el6_10.3.i686
libaio-devel-0.3.107-10.el6.i686
compat-libstdc++-33-3.2.3-69.el6.x86_64
make-3.81-23.el6.x86_64

然后就可以开始安装oracle11g了。
后续的安装步骤参见【CentOS6安装Oracle11g(2)——详细安装步骤】。