centeros7 最小安裝,沉默安裝oracle
1:安裝好centos 7 作業系統;
虛擬機器安裝centos 7,在vmware中一步步來就可以成功。
2:安裝vim
最小化安裝的系統只有vi編輯器,這裡裝一下vim,個人習慣,可以不安裝, 那麼後續的vim命令請自行換成vi。
[[email protected] ~]# yum install vim
3:配置靜態IP
使用root使用者登入系統,編輯檔案:
[[email protected] ~]# vim /etc/sysconfig/network-scripts/ifcfg-eno16777736
(檔名可能不同,只要是ifcfg-eno***的就是了)
編輯如下:
劃紅線的部分是修改或者新增的。
4:更新系統
[[email protected] ~]# yum update -y
5:禁用SELINUX,關閉防火牆
[[email protected] ~]# vim /etc/sysconfig/selinux
[[email protected] ~]# systemctl stop firewalld.service
[[email protected] ~]# systemctl disable firewalld.service
6:安裝依賴包,這一步比較關鍵:
7:新增oracle使用者和組
[[email protected] ~]# groupadd oinstall
[[email protected] ~]# groupadd dba
[
[[email protected] ~]# passwd oracle
8:配置系統核心引數
[[email protected] ~]# vim /etc/sysctl.conf
複製文字在此:
fs.aio-max-nr = 1048576
fs.file-max = 6815744
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 = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
修改完成後執行命令使配置生效:
[[email protected] ~]# sysctl -p
9:修改使用者限制:
[[email protected] ~]# 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
10:修改 /etc/pam.d/login 檔案:
[[email protected] ~]# vim /etc/pam.d/login
檔案末尾增加:
複製文字在此:
session required /lib64/security/pam_limits.so
session required pam_limits.so
11:修改~/.bash_profile檔案
很多文章寫的是修改/etc/profile檔案,這裡我修改oracle使用者自己的環境變數配置檔案:
[[email protected] ~]# su - oracle
[[email protected] ~]$ vim ~/.bash_profile
修改如下:
最後五行自行加入。複製文字在此:
export ORACLE_BASE=/data/oracle
export ORACLE_HOME=
(根據自己實際情況修改)
重要提示:修改完後需執行一下: source ~/.bash_profile
12:建立安裝目錄,設定許可權:
[[email protected] ~]# mkdir -p /data/oracle/product/11.2.0
[[email protected] ~]# mkdir /data/oracle/oradata
[[email protected] ~]# mkdir /data/inventory //這個清單檔案不能和oracle同一個目錄
[[email protected] ~]# mkdir /data/oracle/fast_recovery_area
[[email protected] ~]# chown -R oracle:oinstall /data/oracle
[[email protected] ~]# chmod -R 775 /data/oracle
[[email protected] ~]# chown -R oracle:oinstall /data/inventory
[[email protected] ~]# chmod -R 775 /data/inventory
13:上傳oracle安裝檔案到centos系統
用secureCrt 執行rz命令,可以直接選擇上傳,最好是切換到oracle使用者再上傳.
(修改了整個database資料夾的許可權)
14:複製response資料夾下所有內容到home目錄:
[[email protected] database]$ cp ./response/* ~/
15:編輯資料庫安裝的響應檔案:
修改的內容如下:
oracle.install.option=INSTALL_DB_AND_CONFIG
ORACLE_HOSTNAME=192.168.37.100
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/data/inventory
SELECTED_LANGUAGES=en
ORACLE_HOME=/data/oracle/product/11.2.0
ORACLE_BASE=/data/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=orcl11g
oracle.install.db.config.starterdb.SID=orcl
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryLimit=1024
oracle.install.db.config.starterdb.password.ALL=Sa12345678 //密碼太簡單會報錯,繼續不下去
oracle.install.db.config.starterdb.password.SYS=Sa12345678
oracle.install.db.config.starterdb.password.SYSTEM=Sa12345678
oracle.install.db.config.starterdb.password.SYSMAN=Sa12345678
oracle.install.db.config.starterdb.password.DBSNMP=Sa12345678
oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/data/oracle/oradata
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=/data/oracle/fast_recovery_area
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
DECLINE_SECURITY_UPDATES=true
上面列出的各項按照配置修改,有其他文章寫的修改項要少很多,我試過,安裝後會出問題,登陸資料庫提示TNS-12547: TNS:lost contact。不知為什麼,所以還是上面列出的都配置完整吧。
密碼用的最簡單的安裝時會有警告,可以自己設定高強度的密碼。
16:靜默安裝資料庫並建立資料庫
[[email protected] database]$ ./runInstaller -silent -ignorePrereq -responseFile ~/db_install.rsp
這過程可能會提示.oui,unzip沒許可權的問題,執行chmod u+x /檔案位置 後,再執行上面的命令就可以
安裝完成會提示
The following configuration scripts need to be executed as the “root” user.
!/bin/sh
Root scripts to run
/data/oracle/inventory/orainstRoot.sh
/data/oracle/product/11.2.0/db_1/root.sh
To execute the configuration scripts:
1. Open a terminal window
2. Log in as “root”
3. Run the scripts
4. Return to this window and hit “Enter” key to continue
Successfully Setup Software.
新開一個終端,使用root登入執行上述指令碼即可:
[[email protected] ~]# /data/oracle/inventory/orainstRoot.sh
[[email protected] ~]# /data/oracle/product/11.2.0/db_1/root.sh
資料庫軟體安裝完成,並且安裝了一個例項名為orcl的資料庫。
17:靜默配置監聽
[[email protected] ~]$ netca /silent /responsFile ~/netca.rsp
18:啟動監聽
[[email protected] ~]$ lsnrctl start
19:啟動資料庫
[[email protected] ~]$ sqlplus / as sysdba
靜默安裝資料庫完成。