centos 安装oracle 11g r2(一)-----软件安装

centos 安装oracle 11g r2(一)-----软件安装

1、进入管理员权限

[anzerong@localhost ~]# su - root password 

[root@localhost ~]#

2、创建用户组oinstall

[root@localhost ~]# groupadd oinstall

3、创建用户组dba

[root@localhost ~]# groupadd dba

4、创建oracle用户,并加入到oinstall和dba用户组

[root@localhost ~]# useradd -g oinstall -g dba -m oracle

5、设置用户oracle的登陆密码,不设置密码,在CentOS的图形登陆界面没法登陆

[root@localhost ~]# passwd oracle 

Changing passwordforuser oracle.

New password:# 密码BAD PASSWORD: 

The passwordisshorter than characters

Retypenewpassword:# 再次输入密码passwd: 

all authentication tokens updated successfully.

6、查看新建的oracle用户

[root@localhost ~]# id oracle

uid=1001(oracle) gid=1002(dba) groups=1002(dba)

7、进入根目录

[root@localhost ~]# cd /.

8、创建oracle数据库安装目录

[root@localhost /]# mkdir -p /data/oracle

9、创建oracle数据库配置文件目录

[root@localhost /]# mkdir -p /data/oraInventory

10、创建oracle数据库软件包解压目录

[root@localhost /]# mkdir -p /data/database

11、创建完后检查一下

[root@localhost /]# cd /data

[root@localhostdata]# ls database oracle  oraInventory

12、设置目录所有者为oinstall用户组的oracle用户

[root@localhostdata]# chown -R oracle:oinstall /data/oracle

[root@localhostdata]# chown -R oracle:oinstall /data/oraInventory

[root@localhostdata]# chown -R oracle:oinstall /data/database

13、修改OS系统标识(oracle默认不支持CentOS系统安装,但是centos与redhat的关系自行百度)

[root@localhost data]#cat /proc/version

Linuxversion3.10.0-514.26.2.el7.x86_64(builder@kbuilder.dev.centos.org) (gcc version4.8.520150623(Red Hat4.8.5-11) (GCC) )#1SMPTueJul415:04:05UTC2017

[root@localhost data]#cat /etc/redhat-release

CentOSLinuxrelease7.3.1611(Core)

[root@localhost data]#vi /etc/redhat-release

[root@localhost data]#cat /etc/redhat-release 

redhat-7

14、安装oracle数据库所需要的软件包

[root@localhostdata]# yum install binutils compat-libcap1 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi  libXtst make sysstat unixODBC unixODBC-devel glibc elfutils-libelf-devel compat*

[root@ljg ~]#yum install binutils-2.* compat-libstdc++-33* elfutils-libelf-0.* elfutils-libelf-devel-* gcc-4.* gcc-c++-4.* glibc-2.* glibc-common-2.* glibc-devel-2.* glibc-headers-2.* ksh-2* libaio-0.* libaio-devel-0.* libgcc-4.* libstdc++-4.* libstdc++-devel-4.* make-3.* sysstat-7.* unixODBC-2.* unixODBC-devel-2.* pdksh*

15、查看防火墙状态(运行中)

[root@localhost data]#systemctl status

firewalld.service●firewalld.service-firewalld-dynamicfirewalldaemonLoaded:loaded(/usr/lib/systemd/system/firewalld.service; enabled; vendorpreset: enabled)Active:active(running)sinceWed2017-09-1309:23:08CST;25minagoDocs:man:firewalld(1)MainPID:641(firewalld)CGroup: /system.slice/firewalld.service└─641/usr/bin/python-Es/usr/sbin/firewalld--nofork--nopidSep1309:22:58localhost.localdomainsystemd[1]:Startingfirewalld-dynami...Sep1309:23:08localhost.localdomainsystemd[1]:Startedfirewalld-dynamic...Hint:Somelineswereellipsized,use-ltoshowinfull.

16、关闭防火墙

[root@localhostdata]# systemctl stop firewalld.service

17、查看防火墙状态(已关闭)

[root@localhostdata]#systemctl status

firewalld.service●firewalld.service-firewalld-dynamicfirewalldaemon  Loaded:loaded(/usr/lib/systemd/system/firewalld.service;

enabled;vendorpreset:enabled)  Active:inactive(dead)sinceWed2017-09-1309:48:55CST;10sago    Docs:man:firewalld(1)  Process:641ExecStart=/usr/sbin/firewalld--nofork--nopid$FIREWALLD_ARGS(code=exited,status=0/SUCCESS)MainPID:641(code=exited,status=0/SUCCESS)Sep1309:22:58localhost.localdomainsystemd[1]:Startingfirewalld-dynami...Sep1309:23:08localhost.localdomainsystemd[1]:Startedfirewalld-dynamic...Sep1309:48:54localhost.localdomainsystemd[1]:Stoppingfirewalld-dynami...Sep1309:48:55localhost.localdomainsystemd[1]:Stoppedfirewalld-dynamic...Hint:Somelineswereellipsized,use-ltoshowinfull.

18、禁止使用防火墙(重启也是禁止的)

[root@localhost data]# systemctl disable 

firewalld.serviceRemovedsymlink/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.Removedsymlink/etc/systemd/system/basic.target.wants/firewalld.service.

19、关闭selinux(需重启生效)

[root@localhostdata]# vi /etc/selinux/config

[root@localhostdata]# cat /etc/selinux/config

/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.

#此处修改为disabled

SELINUX=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

20、修改内核参数(加入斜体部分)

[root@local++hostdata]# vi /etc/sysctl.conf

[root@localhostdata]# cat /etc/sysctl.conf

# sysctl settings are defined through files in

# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.

#

# Vendors settings live in /usr/lib/sysctl.d/.

# To override a whole file, create a new file with the same in

# /etc/sysctl.d/ and put new settings there. To override

# only specific settings, add a file with a lexically later

# name in /etc/sysctl.d/ and put new settings there.

#

# For more information, see sysctl.conf(5) and sysctl.d(5).

net.ipv4.icmp_echo_ignore_broadcasts = 1

net.ipv4.conf.all.rp_filter = 1

#设置最大打开文件数

fs.file-max = 6815744

fs.aio-max-nr = 1048576

#共享内存的总量,8G内存设置:2097152*4k/1024/1024

kernel.shmall = 2097152

#最大共享内存的段大小

kernel.shmmax = 2147483648

#整个系统共享内存端的最大数

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

#可使用的IPv4端口范围

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

21、使配置修改内核的参数生效

[root@localhostdata]# sysctl -p

net.ipv4.icmp_echo_ignore_broadcasts = 1

net.ipv4.conf.all.rp_filter = 1

#设置最大打开文件数

fs.file-max = 6815744

fs.aio-max-nr = 1048576

#共享内存的总量,8G内存设置:2097152*4k/1024/1024

kernel.shmall = 2097152

#最大共享内存的段大小

kernel.shmmax = 2147483648

#整个系统共享内存端的最大数

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

#可使用的IPv4端口范围

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

22、对oracle用户设置限制,提高软件运行性能(斜体为添加部分)

[root@localhostdata]# vi /etc/security/limits.conf

[root@localhostdata]# cat /etc/security/limits.conf

# /etc/security/limits.conf

#

#This file sets the resource limits for the users logged in via PAM.

#It does not affect resource limits of the system services.

#

#Also note that configuration files in /etc/security/limits.d directory,

#which are read in alphabetical order, override the settings in this

#file in case the domain is the same or more specific.

#That means for example that setting a limit for wildcard domain here

#can be overriden with a wildcard setting in a config file in the

#subdirectory, but a user specific setting here can be overriden only

#with a user specific setting in the subdirectory.

#

#Each line describes a limit for a user in the form:

#

#

#Where:

# can be:

# - a user name

# - a group name, with @group syntax

# - the wildcard *, for default entry

# - the wildcard %, can be also used with %group syntax,

# for maxlogin limit

#

# can have the two values:

# - "soft" for enforcing the soft limits

# - "hard" for enforcing hard limits

#

# can be one of the following:

# - core - limits the core file size (KB)

# - data - max data size (KB)

# - fsize - maximum filesize (KB)

# - memlock - max locked-in-memory address space (KB)

# - nofile - max number of open file descriptors

# - rss - max resident set size (KB)

# - stack - max stack size (KB)

# - cpu - max CPU time (MIN)

# - nproc - max number of processes

# - as - address space limit (KB)

# - maxlogins - max number of logins for this user

# - maxsyslogins - max number of logins on the system

# - priority - the priority to run user process with

# - locks - max number of file locks the user can hold

# - sigpending - max number of pending signals

# - msgqueue - max memory used by POSIX message queues (bytes)

# - nice - max nice priority allowed to raise to values: [-20, 19]

# - rtprio - max realtime priority

#

#* soft core 0

#* hard rss 10000

#@student hard nproc 20

#@faculty soft nproc 20

#@faculty hard nproc 50

#ftp hard nproc 0

#@student - maxlogins 4

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

# End of file

23、配置用户的环境变量(斜体部分为添加代码)

[root@localhostdata]# vi /home/oracle/.bash_profile

[root@localhostdata]# cat /home/oracle/.bash_profile

# .bash_profile

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

. ~/.bashrc

fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin:/usr/bin

export PATH

#oracle数据库安装目录

export ORACLE_BASE=/data/oracle/app

#oracle数据库路径

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1

#oracle启动数据库实例名

export ORACLE_SID=orcl

#xterm窗口模式安装

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

#设置Oracle客户端字符集,必须与Oracle安装时设置的字符集保持一致

export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

24、使用户的环境变量配置立即生效

[root@localhostdata]# source /home/oracle/.bash_profile

25、将安装包移动到/usr/local/src路径下

[root@localhost ~]# cd /.

[root@localhost /]# cd /home/anzerong/Desktop/

[root@localhost Desktop]# ls linux.x64_11gR2_database_1of2.zip  linux.x64_11gR2_database_2of2.zip

[root@localhost Desktop]# mv linux.x64_11gR2_database_1of2.zip /usr/local/src

[root@localhost Desktop]# ls linux.x64_11gR2_database_2of2.zip

[root@localhost Desktop]# mv linux.x64_11gR2_database_2of2.zip /usr/local/src

26、重启系统,确保所有设置生效

[root@localhost Desktop]# reboot

27、从oracle用户进入/usr/local/src目录

[oracle@localhost/]$ cd /usr/local/src

[oracle@localhostsrc]$ ls p13390677_112040_Linux-x86-64_1of7.zip  p13390677_112040_Linux-x86-64_2of7.zip.zip

28、解压两个软件包至/data/database/目录下

[oracle@localhost src]$ unzip p13390677_112040_Linux-x86-64_1of7.zip -d /data/database

/#解压(省略...)

[oracle@localhost src]$ unzip p13390677_112040_Linux-x86-64_2of7.zip -d /data/database/

#解压(省略...)

29、进入管理员权限

[oracle@localhostsrc]$ su root Password:

30、设置目录所有者为oinstall用户组的oracle用户

[root@localhost src]#chown -R oracle:oinstall /data/database/database/

31、执行安装脚本

[oracle@localhost /]$ cd /data/database/database/

[oracle@localhost database]$ ls

doc  install  response  rpm  runInstaller  sshsetup  stage  welcome.html

[oracle@localhost database]$ ./runInstaller

Starting Oracle Universal Installer...

(省略...)

如失败,执行下面命令

./runInstaller -jreLoc /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64/jre/

oracle图形化安装界面打开

图形界面打不开执行下面代码

root用户,在同一和命令窗口下,命令:(一行一个)

export DISPLAY=localhost:1.0

xhost +

32、==++Configure Security Updates++==

去掉 I wish to receive security updates via My Oracle Support.

点击 “Nest >”

33、==++Installation Option++==

选择第二项 Install database software only

点击 “Nest >”

34、==++Grid Options++==

选择单例模式 Single instance database installation

点击 “Nest >”

35、==++Product Languages++==

选择英语 English(根据系统默认选择好了)

点击 “Nest >”

36、==++Database Edition++==

选择第一个企业版

37、==++Installation Location++==

确定数据软件的安装路径,自动读取前面Oracle环境变量中配置的值

点击 “Nest >”

38、==++Create Inventory++==

选择默认,不做修改

点击 “Nest >”

39、==++Operation System Groups++==

全部使用dba用户组

点击 “Nest >”

40、==++Prepequisite Checks++==

按照提示信息一个一个解决

点击 “Nest >”

PS:pdksh安装

1、卸载已安装的ksh

[root@localhost Desktop]# rpm -e pdksh*[root@localhost Desktop]# rpm -e ksh*

2、下载pdksh-5.2.14-21.x86_64.rpm

3、安装

[root@localhost Desktop]#rpm-ivhpdksh-5.2.14-21.x86_64.rpm--force--nodeps

按提示解决缺少的依赖包,之后点击 “Check Again”

4、弹窗,第一个看不到按键alt+y;第二个弹窗看不到按键enter。

可以忽略缺少的32bit依赖包

41、==++Summary++==

点击 “Finsh”

42、==++Install Product++==

在此过程中,安装界面会变成黑色,有一长条出现(其实是一个提示框),调整高度与宽度查看,

或者可以直接右键选择close

43、==++Finish++==

执行:/data/oracle/app/oracle/product/11.2.0/dbhome_1/root.sh
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 158,117评论 4 360
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 66,963评论 1 290
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 107,897评论 0 240
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 43,805评论 0 203
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,208评论 3 286
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,535评论 1 216
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,797评论 2 311
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,493评论 0 197
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,215评论 1 241
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,477评论 2 244
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 31,988评论 1 258
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,325评论 2 252
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 32,971评论 3 235
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,055评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,807评论 0 194
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,544评论 2 271
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,455评论 2 266

推荐阅读更多精彩内容