1. 程式人生 > >【CentOS+Oracle】CentOS7.5+Oracle11gR2伺服器環境的搭建?

【CentOS+Oracle】CentOS7.5+Oracle11gR2伺服器環境的搭建?

本文借鑑https://www.cnblogs.com/muhehe/p/7816808.html
https://blog.csdn.net/m53931422/article/details/79441840
1、參照上面文章並實踐最終成功完成環境的安裝。
一、安裝的硬體要求
1.記憶體:
要求:記憶體最小1G,推薦2G或者更高。
檢視命令:# grep MemTotal /proc/meminfo
2. Swap:
要求:
RAW
Swap
1G至2G 1.5倍
2G至16G 同RAW相等
16G以上 16G
檢視命令:# grep SwapTotal /proc/meminfo

1.建立執行oracle資料庫的系統使用者和使用者組

[[email protected] ~]$ su root  #切換到root
Password:
[[email protected]]# groupadd oinstall  #建立使用者組oinstall
[[email protected]]# groupadd dba  #建立使用者組dba
[[email protected]]# useradd -g oinstall -g dba -m oracle  #建立oracle使用者,並加入到oinstall和dba使用者組
[[email protected]]# passwd oracle  #設定使用者oracle的登陸密碼,不設定密碼,在CentOS的圖形登陸介面沒法登陸
Changing password for user oracle.
New password:   # 密碼
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:   # 確認密碼
passwd: all authentication tokens updated successfully.
[
[email protected]
]# id oracle # 檢視新建的oracle使用者 uid=1001(oracle) gid=1002(dba) groups=1002(dba)

2.建立oracle資料庫安裝目錄

[[email protected]]# cd /.        #進入根目錄
[[email protected]]# mkdir -p /data/oracle  #oracle資料庫安裝目錄
[[email protected]]# mkdir -p /data/oraInventory  #oracle資料庫配置檔案目錄
[[email protected]
]# mkdir -p /data/database  #oracle資料庫軟體包解壓目錄 [[email protected]]# cd /data [[email protected] data]# ls  #建立完畢檢查一下(強迫症) database oracle oraInventory [[email protected] data]# chown -R oracle:oinstall /data/oracle  #設定目錄所有者為oinstall使用者組的oracle使用者 [[email protected] data]# chown -R oracle:oinstall /data/oraInventory [[email protected] data]# chown -R oracle:oinstall /data/database [[email protected] data]#

3.修改OS系統標識(oracle預設不支援CentOS系統安裝,但是centos其實就是redhat)

[[email protected] data]# cat /proc/version
Linux version 3.10.0-514.26.2.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) ) #1 SMP Tue Jul 4 15:04:05 UTC 2017
[[email protected] data]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
[[email protected] data]# vi /etc/redhat-release
[[email protected] data]# cat /etc/redhat-release
redhat-7

4.安裝oracle資料庫所需要的軟體包

[[email protected] data]# yum -y install binutils* compat-libcap1* compat-libstdc++* gcc* gcc-c++* glibc* glibc-devel* ksh* libaio* libaio-devel* libgcc* libstdc++* libstdc++-devel* libXi* libXtst* make* sysstat* elfutils* unixODBC*

5.關閉防火牆

[[email protected] data]# systemctl status firewalld.service    #檢視防火牆狀態(執行中)
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2017-09-13 09:23:08 CST; 25min ago
     Docs: man:firewalld(1)
 Main PID: 641 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─641 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

Sep 13 09:22:58 localhost.localdomain systemd[1]: Starting firewalld - dynami...
Sep 13 09:23:08 localhost.localdomain systemd[1]: Started firewalld - dynamic...
Hint: Some lines were ellipsized, use -l to show in full.
[[email protected] data]# systemctl stop firewalld.service    #關閉防火牆
[[email protected] data]# systemctl status firewalld.service    #檢視防火牆狀態(已關閉)
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Wed 2017-09-13 09:48:55 CST; 10s ago
     Docs: man:firewalld(1)
  Process: 641 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
 Main PID: 641 (code=exited, status=0/SUCCESS)

Sep 13 09:22:58 localhost.localdomain systemd[1]: Starting firewalld - dynami...
Sep 13 09:23:08 localhost.localdomain systemd[1]: Started firewalld - dynamic...
Sep 13 09:48:54 localhost.localdomain systemd[1]: Stopping firewalld - dynami...
Sep 13 09:48:55 localhost.localdomain systemd[1]: Stopped firewalld - dynamic...
Hint: Some lines were ellipsized, use -l to show in full.
[[email protected] data]# systemctl disable firewalld.service   #禁止使用防火牆(重啟也是禁止的)         
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.

6.關閉selinux(需重啟生效)

[[email protected] data]# vi /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 #此處修改為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

7.修改核心引數(加入斜體部分)

[[email protected] data]# vi /etc/sysctl.conf
[[email protected] data]# 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
kernel.shmall = 2097152 #共享記憶體的總量,8G記憶體設定:2097152*4k/1024/1024
kernel.shmmax = 2147483648 #最大共享記憶體的段大小
kernel.shmmni = 4096 #整個系統共享記憶體端的最大數
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500 #可使用的IPv4埠範圍
net.core.rmem_default = 262144
net.core.rmem_max= 4194304
net.core.wmem_default= 262144
net.core.wmem_max= 1048576

8.使配置修改核心的引數生效

[[email protected] data]# sysctl -p
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.conf.all.rp_filter = 1
sysctl: setting key "fs.file-max": Invalid argument
fs.file-max = 6815744 #設定最大開啟檔案數
fs.aio-max-nr = 1048576
sysctl: setting key "kernel.shmall": Invalid argument
kernel.shmall = 2097152 #共享記憶體的總量,8G記憶體設定:2097152*4k/1024/1024
sysctl: setting key "kernel.shmmax": Invalid argument
kernel.shmmax = 2147483648 #最大共享記憶體的段大小
sysctl: setting key "kernel.shmmni": Invalid argument
kernel.shmmni = 4096 #整個系統共享記憶體端的最大數
kernel.sem = 250 32000 100 128
sysctl: setting key "net.ipv4.ip_local_port_range": Invalid argument
net.ipv4.ip_local_port_range = 9000 65500 #可使用的IPv4埠範圍
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576

9.對oracle使用者設定限制,提高軟體執行效能(斜體為新增部分)

[[email protected] data]# vi /etc/security/limits.conf
[[email protected] data]# cat /etc/security/limits.conf

@student - maxlogins 4
 
*oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536*
 
End of file

10.配置使用者的環境變數(斜體部分為新增程式碼)

[[email protected] data]# vi /home/oracle/.bash_profile
[[email protected] data]# 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

export PATH

export ORACLE_BASE=/data/oracle #oracle資料庫安裝目錄
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 #oracle資料庫路徑
export ORACLE_SID=orcl #oracle啟動資料庫例項名,如果這裡不設定,安裝結束會讓重新配置
export ORACLE_UNQNAME=orcl
export ORACLE_TERM=xterm #xterm視窗模式安裝
export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH #新增系統環境變數
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib #新增系統環境變數
export LANG=C #防止安裝過程出現亂碼
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8  #設定Oracle客戶端字符集,必須與Oracle安裝時設定的字符集保持一致

11.使使用者的環境變數配置立即生效

[[email protected] data]# source /home/oracle/.bash_profile

12.將安裝包移動到/usr/local/src路徑下

[[email protected] ~]# cd /.
[[email protected] /]# cd /home/richard/Desktop/
[[email protected] Desktop]# ls
linux.x64_11gR2_database_1of2.zip  linux.x64_11gR2_database_2of2.zip
[[email protected] Desktop]# mv linux.x64_11gR2_database_1of2.zip /usr/local/src
[[email protected] Desktop]# ls
linux.x64_11gR2_database_2of2.zip
[[email protected] Desktop]# mv linux.x64_11gR2_database_2of2.zip /usr/local/src

13.重啟系統,確保所有設定生效

[[email protected] Desktop]# reboot

14.從root使用者切換oracle使用者,並從oracle使用者進入/usr/local/src目錄

[[email protected] /]#su oracle #root切換oracle直接可以,不用輸入密碼,反之則需要
[[email protected] /]$ cd /usr/local/src
[[email protected] src]$ ls
linux.x64_11gR2_database_1of2.zip  linux.x64_11gR2_database_2of2.zip

15.解壓兩個軟體包至/data/database/目錄下

如果unzip沒安裝,會報錯。unzip command not found.這時候可以執行

[[email protected] /]#yum install unzip 

進行安裝,需要是root使用者下安裝

[[email protected] src]$ unzip linux.x64_11gR2_database_1of2.zip -d /data/database/  #解壓
[[email protected] src]$ unzip linux.x64_11gR2_database_2of2.zip -d /data/database/  #解壓

16.進入管理員許可權,設定目錄所有者為oinstall使用者組的oracle使用者,執行安裝指令碼

[[email protected] src]$ su root
Password:
[[email protected] src]# chown -R oracle:oinstall /data/database/database/
[[email protected] /]$ cd /data/database/database/
[[email protected] database]$ ls
doc  install  response  rpm  runInstaller  sshsetup  stage  welcome.html
[[email protected] database]$ ./runInstaller 
Starting Oracle Universal Installer...
(省略...)

如果此處會報錯,提示DISPLAY未設定。如下設定,在root許可權下

Checking Temp space: must be greater than 120 MB.   Actual 99804 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 8191 MB    Passed
Checking monitor: must be configured to display at least 256 colors
    >>> Could not execute auto check for display colors using command /usr/bin/xdpyinfo. Check if the DISPLAY variable is set.    Failed <<<<

Some requirement checks failed. You must fulfill these requirements before

continuing with the installation,

解決如下:

[[email protected] src]# DISPLAY=:0.0;export DISPLAY
[[email protected] src]# echo $DISPLAY
[[email protected] src]# find / -name "xhost"
/usr/bin/xhost
[[email protected] src]# cd /usr/bin/
[[email protected] bin]# ./xhost
[[email protected] bin]# ./xhost +
[[email protected] bin]# su oracle
[[email protected] bin]$ DISPLAY=:0.0;export DISPLAY
[[email protected] bin]$ echo $DISPLAY

四、Oracle圖形介面選項

如果CentOS沒有安裝圖形介面,是無法用圖形介面安裝ORACLE的,所以需要額外安裝

[[email protected] bin]#yum groupinstall "X Window System"
[[email protected] bin]#yum groupinstall "GNOME Desktop"
.
.
complete!

安裝完成之後,執行命令,進入圖形介面,這裡必須是oracle使用者下進入圖形介面,否則會出問題(Could not execute auto check for display colors using command /usr/bin/xdpyi…)

[[email protected] bin]# su oracle
[[email protected] bin]$ startx

進入圖形介面
在這裡插入圖片描述
在圖形介面右擊,開啟命令列

[[email protected] root]$ cd /data/database/database/
[[email protected] database]$ ls
doc  install  response  rpm  runInstaller  sshsetup  stage  welcome.html
[[email protected] database]$ ./runInstaller
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB.   Actual 99018 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 8191 MB    Passed
Checking monitor: must be configured to display at least 256 colors.    Actual 16777216    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-11-17_10-39-00AM. Please wait ...[[email protected] database]$ 

如下:
1、去掉勾選
在這裡插入圖片描述
2、選YES
在這裡插入圖片描述

在這裡插入圖片描述
在這裡插入圖片描述
在這裡插入圖片描述
在這裡插入圖片描述
在這裡插入圖片描述
在這裡插入圖片描述
在這裡插入圖片描述
在這裡插入圖片描述

按照預設即可,如果安裝到分配記憶體那塊,執行程式卡住不動了,可以考慮,將自動分配記憶體的選項取消,“Character Sets"選擇第二項或者第三項中的"Unicode standard UTF-8…”
底下按部就班就可以成功。
OS Kernel Parameter 下的semmni的缺失是Oracle沒有檢測到,其實有,選中缺失的依賴包,如果下方詳情欄裡Expected value中有括號中標註(i386)或(i686),是在提示缺少32位的依賴包,但是實際上已經安裝了64位的依賴包,忽略它們,pdksh包已經安裝,就是之前安裝的ksh依賴包。
如果還有提示的其他缺少的依賴包沒有安裝就去安裝,按提示解決缺少的依賴包,之後點選 “Check Again”,再檢查一遍,沒有問題了,勾選ignore all,點選“Next”
後面一直到安裝完成

安裝完成,使用sys使用者進行連線嘗試,這邊選用的是oralce官方工具。

在這裡插入圖片描述

相關推薦

CentOS+OracleCentOS7.5+Oracle11gR2伺服器環境搭建

本文借鑑https://www.cnblogs.com/muhehe/p/7816808.html https://blog.csdn.net/m53931422/article/details/79441840 1、參照上面文章並實踐最終成功完成環境的安裝。

CentOS 7nginx配置web伺服器

1,安裝過程 [[email protected]_1_14_centos ~]# cd /data/ [[email protected]_1_14_centos data]# wget http://nginx.org/download/nginx-1.15.7.tar.gz

區塊鏈Ubuntu下 Hyperledger Fabric環境搭建

一、環境準備 檢視source列表 sudo vi /etc/apt/sources.list 替換資源: 因為安裝的系統的時候,如果選擇的國內就可以略過,如果選的是香港或者其他地方,需要把開頭的兩個字母換成 cn, 例如選擇香港是HK開頭,需

超詳細Centos7 安裝 Oracle 12c

bst 密碼 sts 請求 空閑 繼續 mas 進程 dfa 系統配置 CentOS 7.4 x86_64操作系統; Oracle 12 c 只支持64位的Linux系統。不支持32Linux平臺; Orache安裝配置: 內存容量:4GB及以上; Swap容量:8GB

docker學習二CentOS7.5+Docker 映象(容器)的使用

      承接上篇:https://mp.csdn.net/postedit/82744127       上文介紹了容器與映象的基本操作,這裡總結下容器的使用。 先在官網找到一個映象: https://hub.docker.

docker學習一CentOS7.5+Docker安裝及使用「安裝、檢視、pull、建立、進入映象」

記錄安裝配置以及使用的過程,可能會有多處摘抄,已註明照抄地址,侵刪。   是什麼:個人理解,是一種移植性很強的虛擬機器,支援版本控制(類似於git),同一個伺服器可以執行多個docker容器,每個docker容器都有一個獨立的虛擬環境。 本人環境: 虛擬機器:Oracle

CentOS學習一、win10+CentOS7.1雙系統恢復引導

一.首先centos預設沒有支援ntfs格式,我們需要先安裝ntfs-3g,這裡暫時演示通過yum安裝: 1.首先下載安裝包: yum install ntfs-3g,然後輸入:y 2.在輸入以下命令,就可自動將windows引導修復 grub2-mkconfig -o

伺服器CentOs7系統使用寶塔面板搭建網站,有FTP配置(保姆式教程)

內容繁多,請耐心跟著流程走,在過程中遇到問題請在下面留言(我只是小白,請專業人士噴輕點)。 這次用thinkphp5.1做演示,單純的做演示,我打算下一篇文章用typecho(部落格框架)演示。 ## 前言 上篇文章([點選跳轉][1])說到了安裝面板就沒有然後了,因為圖片實在太多,碼字卡的不行,寶塔面板

CNMP系列CentOS7.0下安裝Nginx服務

系統資源 for proxy input strong network emc -c .com 話步前言,CNMP之路,系統起步:http://www.cnblogs.com/riverdubu/p/6425028.html 這回我來講解下CentOS7.0下如何安裝和配置

Python練習題程序5

python練習 style none spa pla AS 輸出 put audio #題目:輸入三個整數x,y,z,請把這三個數由小到大輸出。 # a = input(‘請輸入整數: \n‘) # # b = input(‘請輸入整數: \n‘) # # c = i

自家測試2018-5-9

連通 point -a struct 圖片 spl 做了 clas 一位 翡翠的排擠原理【前言】一些以寶石命名的書籍,擁有神奇的能力,乃魔法之書.魔法之書會自動挑選附近有意誌講述故事的人作為原著的表演者,在現實中演繹故事,只有當故事迎來結尾,魔法之書才會合上.時至今日,故

Nginx安裝CentOS7安裝Nginx及配置

pass index root權限 zlib art 行處理 轉發 末尾 pil 【Nginx安裝】CentOS7安裝Nginx及配置 2018年03月05日 11:07:21 閱讀數:7073 Nginx是一款輕量級的網頁服務器、反向代理服

大資料CentOS6.5安裝mysql5.6(靠譜!)

  一、吐槽        我明明是跟著老師寫的書上一步一步來的,到最後出現了一堆錯誤,然後從網上找教程,網上那些人不知道咋想的,啥也往上貼,隨便一篇,除了自己能看懂沒幾個人能看懂的文章就貼到網上了。  &n

LinuxApatch TomcatCentOS7安裝不最新版Apartch Tomcat環境

1、前言   相當嫌棄,部落格園搞掉了我快寫完的 Tomcat。   請先安裝 :【Linux】【Java】CentOS7安裝最新版Java1.8.191執行開發環境   雖然安裝Tomcat沒啥技術,但是還是記錄一下,方便後面萌新學習。 2、開始   1、獲取下載地址     http://to

linux命令CentOS7使用firewalld開啟關閉防火牆與埠

FROM:CentOS7使用firewalld開啟關閉防火牆與埠 1、firewalld的基本使用 啟動: systemctl start firewalld 關閉: systemctl stop firewalld 檢視狀態: systemctl status firewalld&

Linux基礎Centos7的網路配置問題

在配置Centos7網路的時候,可能出出現虛擬機器、本地以及外網三者之間ping不通的問題,可以從以下的幾個方面排查: 1、確定需要管理員許可權才能修改配置網路,如下圖:   需要點下更改設定,然後出現下面的圖片才是正確的:  

轉載CentOS7下用yum快速搭建LAMP平臺(應用於安裝zabbix)

實驗環境: [[email protected]7 html]# cat /etc/redhat-release CentOS release 7.3.1611 (AltArch) [[email protected]-7 html]# uname -a Linux

程式碼審計CLTPHP_v5.5.3後臺任意檔案刪除漏洞分析

  0x00 環境準備 CLTPHP官網:http://www.cltphp.com 網站原始碼版本:CLTPHP內容管理系統5.5.3版本 程式原始碼下載:https://gitee.com/chichu/cltphp 預設後臺地址: http://127.0.0.1/admin/log

程式碼審計CLTPHP_v5.5.3前臺XML外部實體注入漏洞分析

0x01 環境準備 CLTPHP官網:http://www.cltphp.com 網站原始碼版本:CLTPHP內容管理系統5.5.3版本 程式原始碼下載:https://gitee.com/chichu/cltphp 預設後臺地址: http://127.0.0.1/admin/login/index

程式碼審計CLTPHP_v5.5.3後臺任意檔案下載漏洞分析

  0x00 環境準備 CLTPHP官網:http://www.cltphp.com 網站原始碼版本:CLTPHP內容管理系統5.5.3版本 程式原始碼下載:https://gitee.com/chichu/cltphp 預設後臺地址: http://127.0.0.1/admin/log