centos 安裝oracle 11g r2(一)-----軟件安裝
1、進(jìn)入管理員權(quán)限
[anzerong@localhost ~]# su - root password?
[root@localhost ~]#
2、創(chuàng)建用戶組oinstall
[root@localhost ~]# groupadd oinstall
3两入、創(chuàng)建用戶組dba
[root@localhost ~]# groupadd dba
4单雾、創(chuàng)建oracle用戶歪沃,并加入到oinstall和dba用戶組
[root@localhost ~]# useradd -g oinstall -g dba -m oracle
5竣蹦、設(shè)置用戶oracle的登陸密碼筝野,不設(shè)置密碼晌姚,在CentOS的圖形登陸界面沒(méi)法登陸
[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歇竟、進(jìn)入根目錄
[root@localhost ~]# cd /.
8挥唠、創(chuàng)建oracle數(shù)據(jù)庫(kù)安裝目錄
[root@localhost /]# mkdir -p /data/oracle
9、創(chuàng)建oracle數(shù)據(jù)庫(kù)配置文件目錄
[root@localhost /]# mkdir -p /data/oraInventory
10焕议、創(chuàng)建oracle數(shù)據(jù)庫(kù)軟件包解壓目錄
[root@localhost /]# mkdir -p /data/database
11宝磨、創(chuàng)建完后檢查一下
[root@localhost /]# cd /data
[root@localhostdata]# ls database oracle? oraInventory
12、設(shè)置目錄所有者為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系統(tǒng)標(biāo)識(shí)(oracle默認(rèn)不支持CentOS系統(tǒng)安裝唤锉,但是centos與redhat的關(guān)系自行百度)
[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數(shù)據(jù)庫(kù)所需要的軟件包
[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别瞭、查看防火墻狀態(tài)(運(yùn)行中)
[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窿祥、關(guān)閉防火墻
[root@localhostdata]# systemctl stop firewalld.service
17、查看防火墻狀態(tài)(已關(guān)閉)
[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晒衩、關(guān)閉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、修改內(nèi)核參數(shù)(加入斜體部分)
[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
#設(shè)置最大打開(kāi)文件數(shù)
fs.file-max = 6815744
fs.aio-max-nr = 1048576
#共享內(nèi)存的總量墙歪,8G內(nèi)存設(shè)置:2097152*4k/1024/1024
kernel.shmall = 2097152
#最大共享內(nèi)存的段大小
kernel.shmmax = 2147483648
#整個(gè)系統(tǒng)共享內(nèi)存端的最大數(shù)
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听系、使配置修改內(nèi)核的參數(shù)生效
[root@localhostdata]# sysctl -p
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.conf.all.rp_filter = 1
#設(shè)置最大打開(kāi)文件數(shù)
fs.file-max = 6815744
fs.aio-max-nr = 1048576
#共享內(nèi)存的總量,8G內(nèi)存設(shè)置:2097152*4k/1024/1024
kernel.shmall = 2097152
#最大共享內(nèi)存的段大小
kernel.shmmax = 2147483648
#整個(gè)系統(tǒng)共享內(nèi)存端的最大數(shù)
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虹菲、對(duì)oracle用戶設(shè)置限制靠胜,提高軟件運(yùn)行性能(斜體為添加部分)
[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、配置用戶的環(huán)境變量(斜體部分為添加代碼)
[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數(shù)據(jù)庫(kù)安裝目錄
export ORACLE_BASE=/data/oracle/app
#oracle數(shù)據(jù)庫(kù)路徑
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
#oracle啟動(dòng)數(shù)據(jù)庫(kù)實(shí)例名
export ORACLE_SID=orcl
#xterm窗口模式安裝
export ORACLE_TERM=xterm
#添加系統(tǒng)環(huán)境變量
export PATH=$ORACLE_HOME/bin:/usr/sbin:PATH
#添加系統(tǒng)環(huán)境變量
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
#防止安裝過(guò)程出現(xiàn)亂碼
export LANG=C
#設(shè)置Oracle客戶端字符集,必須與Oracle安裝時(shí)設(shè)置的字符集保持一致
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
24浪漠、使用戶的環(huán)境變量配置立即生效
[root@localhostdata]# source /home/oracle/.bash_profile
25菠赚、將安裝包移動(dòng)到/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、重啟系統(tǒng)郑藏,確保所有設(shè)置生效
[root@localhost Desktop]# reboot
27、從oracle用戶進(jìn)入/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瘩欺、解壓兩個(gè)軟件包至/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必盖、進(jìn)入管理員權(quán)限
[oracle@localhostsrc]$ su root Password:
30、設(shè)置目錄所有者為oinstall用戶組的oracle用戶
[root@localhost src]#chown -R oracle:oinstall /data/database/database/
31俱饿、執(zhí)行安裝腳本
[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...
(省略...)
如失敗歌粥,執(zhí)行下面命令
./runInstaller -jreLoc /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64/jre/
oracle圖形化安裝界面打開(kāi)
圖形界面打不開(kāi)執(zhí)行下面代碼
root用戶,在同一和命令窗口下拍埠,命令:(一行一個(gè))
export DISPLAY=localhost:1.0
xhost +
32失驶、==++Configure Security Updates++==
去掉 I wish to receive security updates via My Oracle Support.
點(diǎn)擊 “Nest >”
33、==++Installation Option++==
選擇第二項(xiàng) Install database software only
點(diǎn)擊 “Nest >”
34枣购、==++Grid Options++==
選擇單例模式 Single instance database installation
點(diǎn)擊 “Nest >”
35嬉探、==++Product Languages++==
選擇英語(yǔ) English(根據(jù)系統(tǒng)默認(rèn)選擇好了)
點(diǎn)擊 “Nest >”
36、==++Database Edition++==
選擇第一個(gè)企業(yè)版
37棉圈、==++Installation Location++==
確定數(shù)據(jù)軟件的安裝路徑涩堤,自動(dòng)讀取前面Oracle環(huán)境變量中配置的值
點(diǎn)擊 “Nest >”
38、==++Create Inventory++==
選擇默認(rèn)分瘾,不做修改
點(diǎn)擊 “Nest >”
39胎围、==++Operation System Groups++==
全部使用dba用戶組
點(diǎn)擊 “Nest >”
40、==++Prepequisite Checks++==
按照提示信息一個(gè)一個(gè)解決
點(diǎn)擊 “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
按提示解決缺少的依賴包上岗,之后點(diǎn)擊 “Check Again”
4福荸、彈窗,第一個(gè)看不到按鍵alt+y液茎;第二個(gè)彈窗看不到按鍵enter逞姿。
可以忽略缺少的32bit依賴包
41、==++Summary++==
點(diǎn)擊 “Finsh”
42捆等、==++Install Product++==
在此過(guò)程中滞造,安裝界面會(huì)變成黑色,有一長(zhǎng)條出現(xiàn)(其實(shí)是一個(gè)提示框)栋烤,調(diào)整高度與寬度查看谒养,
或者可以直接右鍵選擇close
43、==++Finish++==