- 安装常用包
[root@localhost ~]# yum -y install nano vim wget curl net-tools lsof zip unzip
#安裝rlwrap
[root@localhost ~]# cd /usr/local/src
[root@localhost src]# pwd
/usr/local/src
[root@localhost src]# yum -y install perl autoconf
[root@localhost src]# wget http://www.rpmfind.net/linux/epel/6/x86_64/Packages/r/rlwrap-0.42-1.el6.x86_64.rpm
[root@localhost src]# rpm -ivh rlwrap-0.42-1.el6.x86_64.rpm
- 修改主机名
[root@localhost ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=CRM02.COM
[root@localhost ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.0.9.69 CRM02 CRM02.COM
- 关闭SELINUX 编辑selinux的配置文件
[root@CRM02 ~]# cat /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=enforcing
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
#SELINUXTYPE=targeted
SELINUX=disabled
- 安装系统需要的rpm包
[root@CRM02 ~]# yum install gcc gcc-c++ binutils compat-libcap1 compat-libstdc++-33 glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libxcb libX11 libXau libXi libXtst make net-tools nfs-utils smartmontools sysstat xterm unixODBC unixODBC-devel libXp e2fsprogs e2fsprogs-libs elfutils-libelf-devel libXrender -y
- 添加oracle 用戶
[root@CRM02 ~]# groupadd oinstall
[root@CRM02 ~]# groupadd dba
[root@CRM02 ~]# groupadd oper
[root@CRM02 ~]# useradd -g oinstall -G dba,oper oracle
[root@CRM02 ~]# echo "123456" | passwd --stdin oracle
#设置密码永不过期
[root@CRM02 ~]# chage -M -1 oracle
[root@CRM02 ~]# chage -l oracle
[root@CRM02 ~]# id oracle
uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba),502(oper)
- 修改系统对用户使用资源的限制
[root@CRM02 ~]# cat /etc/security/limits.conf
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft nofile 16384
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
oracle soft memlock 3145728
oracle hard memlock 3145728
- 修改系统的参数
[root@CRM02 ~]# cat /etc/sysctl.conf
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 8388608
kernel.shmmax = 34359738367
kernel.panic_on_oops = 1
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
[root@CRM02 ~]# sysctl -p
- 配置/etc/pam.d/login
[root@CRM02 ~]# vim /etc/pam.d/login
#add
#这是对应64位的
session required /lib64/security/pam_limits.so
#这是对应32位的
#session required /lib/security/pam_limits.so
- 修改ulimit
[root@CRM02 ~]# vim /etc/profile
#添加oracle 用户 limit:
if [ $USER = "oracle" ] ; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
[root@CRM02 ~]# source /etc/profile
10.创建安装目录
[root@CRM02 ]#
mkdir -p /u01/app/oracle/
mkdir -p /u01/tmp/
mkdir -p /u01/setup/
mkdir -p /u02/oradata/
mkdir -p /u02/fast_recovery_area/
chown -R oracle:oinstall /u01/app/
chown -R oracle:oinstall /u01/tmp/
chown -R oracle:oinstall /u01/setup/
chown -R oracle:oinstall /u02/oradata/
chown -R oracle:oinstall /u02/fast_recovery_area/
chmod -R 775 /u01/app/
chmod -R 775 /u01/tmp/
chmod -R 775 /u01/setup/
chmod -R 775 /u02/oradata/
chmod -R 775 /u02/fast_recovery_area/
- 配置/dev/shm大小
#修改/dev/shm的大小 8G 以上
vim /etc/fstab
修改/dev/shm的大小
修改/etc/fstab的这行: 默认的:
tmpfs /dev/shm tmpfs defaults 0 0
改成:
tmpfs /dev/shm tmpfs defaults,size=8G 0 0
size参数也可以用G作单位:size=1G。
重新mount /dev/shm使之生效:
# mount -o remount /dev/shm
马上可以用"df -h"命令检查变化。
[root@CRM02 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 469G 2.1G 443G 1% /
tmpfs 16G 0 16G 0% /dev/shm
/dev/sda1 190M 39M 141M 22% /boot
/dev/sda3 9.5G 22M 9.0G 1% /home
/dev/sda5 9.5G 22M 9.0G 1% /tmp
/dev/sdc1 2.9T 72M 2.8T 1% /u02
- 配置 oracle 用戶的環境變量
[oracle@XAG193 ~]$ vim .bash_profile
[oracle@XAG193 ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
export DISPLAY=10.0.0.85:0.0
ORACLE_SID=MPFILE;export ORACLE_SID
ORACLE_UNQNAME=MPFILE;export ORACLE_UNQNAME
#JAVA_HOME=/u01/java/jdk1.8.0_181; export JAVA_HOME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME
ORACLE_TERM=xterm; export ORACLE_TERM
NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"; export NLS_DATE_FORMAT
NLS_LANG=American_America.AL32UTF8; export NLS_LANG
TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN
ORA_NLS11=$ORACLE_HOME/nls/data; export ORA_NLS11
PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin:$ORA_CRS_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
THREADS_FLAG=native; export THREADS_FLAG
export TEMP=/u01/tmp
export TMPDIR=/u01/tmp
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
#alias asmcmd='rlwrap asmcmd'
#设置环境变量,登录oracle会提示设置ORACLE_SID以免实例太多误操作
#/usr/local/bin/oraenv
#ORAENV_ASK=YES
#export ORAENV_ASK
umask 022
[oracle@XAG193 ~]$ source .bash_profile
- 開始安裝
[oracle@CRM02 setup]$ pwd
/u01/setup
[oracle@CRM02 setup]$ ls
p13390677_112040_Linux-x86-64_1of7.zip p13390677_112040_Linux-x86-64_2of7.zip
[oracle@CRM02 setup]$ unzip p13390677_112040_Linux-x86-64_1of7.zip
[oracle@CRM02 setup]$ unzip p13390677_112040_Linux-x86-64_2of7.zip
[oracle@CRM02 setup]$ cd database/
[oracle@CRM02 database]$ ls
install readme.html response rpm runInstaller sshsetup stage welcome.html
[oracle@CRM02 database]$ ./runInstaller
- 坑01- 缺失i386版本包
(注意:在进入这个坑之前,首先请按照网上的教程先把所有依赖都安装,并且确认存在。)
例如:libaio.xxx玩意缺失,提示需要i386版本(具體見下圖)
那是因为oracle11g在配置中把这些依赖包的版本写死了,且为i386,但是centos7根本没这版本,而这时候我们只需找到cvu_prereq.xml文件
该文件路径为 解压后的安装包根路径database/stage/cvu/cvu_prereq.xml,直接把该文件中所有的i386字符串改为i686即可解决问题。
- 坑02-缺少pdksh-5.2.14这个依赖包
解决方法: 修改<unzip path>/database/stage/cvu/cv/admin 目录下的 cvu_config文件
将其中的 CV_ASSUME_DISTID=OEL4 改为 CV_ASSUME_DISTID=OEL6
保存后重新 runInstaller
- 坑03-在安装到68%时提示错误Error in invoking target 'install' of makefile
及 Error in invoking target 'agent nmhs' of makefile
解决办法:
yum -y install glibc-static
该软件包包含一个静态链接库:/usr/lib64/libc.a
修改/u01/app/oracle/product/11.2.0/dbhome_1/ctx/lib/ins_ctx.mk,将
ctxhx: $(CTXHXOBJ)
$(LINK_CTXHX) $(CTXHXOBJ) $(INSO_LINK)
修改为:
ctxhx: $(CTXHXOBJ)
-static $(LINK_CTXHX) $(CTXHXOBJ) $(INSO_LINK) /usr/lib64/stdc.a
点击Retry继续安装。接着又提示”Error in invoking target 'agent nmhs' of makefile '/u01/app/oracle/product/11.2.0/dbhome_1/sysman/lib/ins_emagent.mk.' ,
解决方法:在makefile中添加链接libnnz11库的参数
修改/u01/app/oracle/product/11.2.0/dbhome_1/sysman/lib/ins_emagent.mk,将
$(MK_EMAGENT_NMECTL)
修改为(有1處):
$(MK_EMAGENT_NMECTL) -lnnz11
点击Retry继续安装。
安装成功!
參考如下
https://gitee.com/xag/xag_bak2/blob/master/Oracle/install/11G/Oracle%E5%AE%89%E8%A3%85-11G.docx
https://my.oschina.net/u/3387406/blog/2991990