Install Oracle 11G Release 2 on Centos Linux 7

This article presents how to install Oracle 11G on Centos Linux 7.

Read following article how to install Centos Linux 7: Install Centos Linux 7 (for comfort set 2G memory for your virtual machine before proceeding with Oracle software installation).


Database software

linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip

OS configuration and preparation

Change hostname

####forever change
[root@localhost ~]#vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME= localhost
[root@localhost ~]# hostname
localhost
Add groups  
###required groups
su - root
/usr/sbin/groupadd -g 501 oinstall
/usr/sbin/groupadd -g 502 dba
/usr/sbin/groupadd -g 503 oper

Add user Oracle

/usr/sbin/useradd -u 502 -g oinstall -G dba,oper oracle

Change password for user

passwd oracle

Add kernel parameters to /etc/sysctl.conf

su - root
vim /etc/sysctl.conf

kernel.shmmni = 4096 
kernel.shmmax = 4398046511104
kernel.shmall = 1073741824
kernel.sem = 250 32000 100 128

fs.aio-max-nr = 1048576
fs.file-max = 6815744
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 = 1048586

Apply kernel parameters

/sbin/sysctl -p

Add following lines to set shell limits for user oracle in file /etc/security/limits.conf

su - root
vim /etc/security/limits.conf

oracle   soft   nproc    131072
oracle   hard   nproc    131072
oracle   soft   nofile   131072
oracle   hard   nofile   131072
oracle   soft   core     unlimited
oracle   hard   core     unlimited
oracle   soft   memlock  50000000
oracle   hard   memlock  50000000

The “/etc/hosts” file must contain a fully qualified name for the server.

<IP-address>  <fully-qualified-machine-name>  <machine-name>

For example

vim /etc/hosts
127.0.0.1 localhost localhost.macrocurtain

Verify your network settings

[root@localhost ~]# ping -c 3 localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.135 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.041 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.062 ms

--- localhost ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.041/0.079/0.135/0.040 ms

Modify .bash_profile for user oracle in his home directory

su - oracle

vim .bash_profile

export TMP=/tmp
export ORACLE_HOSTNAME=localhost.macrocurtain
export ORACLE_UNQNAME=ORA11G
export ORACLE_BASE=/ora01/app/oracle # oracle数据库根目录
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 # 数据库文件目录
export ORACLE_SID=ORA11G # oracle数据库实例名

PATH=/usr/sbin:$PATH:$ORACLE_HOME/bin # 命令声明的目录,例如sqlplus命令在此变量声明的目录中寻找

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; # 声明共享库目录
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;

alias cdob='cd $ORACLE_BASE'
alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'
umask 022

source .bash_profile


Check which packages are installed and which are missing

su - root
rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE}(%{ARCH})\n' binutils \
elfutils-libelf \
elfutils-libelf-devel \
gcc \
gcc-c++ \
glibc \
glibc-common \
glibc-devel \
glibc-headers \
ksh \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
make \
sysstat \
unixODBC \
unixODBC-devel

In my case it returns following

binutils-2.25.1-31.base.el7(x86_64)
elfutils-libelf-0.168-8.el7(x86_64)
package elfutils-libelf-devel is not installed
package gcc is not installed
package gcc-c++ is not installed
glibc-2.17-196.el7(x86_64)
glibc-common-2.17-196.el7(x86_64)
package glibc-devel is not installed
package glibc-headers is not installed
package ksh is not installed
libaio-0.3.109-13.el7(x86_64)
package libaio-devel is not installed
libgcc-4.8.5-16.el7(x86_64)
libstdc++-4.8.5-16.el7(x86_64)
package libstdc++-devel is not installed
make-3.82-23.el7(x86_64)
sysstat-10.1.5-12.el7(x86_64)
package unixODBC is not installed
package unixODBC-devel is not installed

Missing packages are on Centos 7 installation dvd. Other option if you are connected to internet is just use yum install command.

  • First option – use yum install command
yum -y install elfutils-libelf-devel
yum -y install gcc
yum -y install gcc-c++
yum -y install glibc-devel
yum -y install glibc-headers
yum -y install ksh
yum -y install libstdc++-devel
yum -y install unixODBC
yum -y install unixODBC-devel

or

yum -y install elfutils-libelf-devel gcc gcc-c++ glibc-devel glibc-headers ksh libaio-devel libstdc++-devel unixODBC unixODBC-devel
Installed:
  elfutils-libelf-devel.x86_64 0:0.168-8.el7                            
  gcc.x86_64 0:4.8.5-16.el7_4.2                                         
  gcc-c++.x86_64 0:4.8.5-16.el7_4.2                                     
  glibc-devel.x86_64 0:2.17-196.el7_4.2                                 
  glibc-headers.x86_64 0:2.17-196.el7_4.2                               
  ksh.x86_64 0:20120801-35.el7_4                                        
  libaio-devel.x86_64 0:0.3.109-13.el7                                  
  libstdc++-devel.x86_64 0:4.8.5-16.el7_4.2                             
  unixODBC.x86_64 0:2.3.1-11.el7                                        
  unixODBC-devel.x86_64 0:2.3.1-11.el7                                  

Dependency Installed:
  cpp.x86_64 0:4.8.5-16.el7_4.2         libmpc.x86_64 0:1.0.1-3.el7     
  zlib-devel.x86_64 0:1.2.7-17.el7     

Dependency Updated:
  glibc.x86_64 0:2.17-196.el7_4.2                                       
  glibc-common.x86_64 0:2.17-196.el7_4.2                                
  libgcc.x86_64 0:4.8.5-16.el7_4.2                                      
  libgomp.x86_64 0:4.8.5-16.el7_4.2                                     
  libstdc++.x86_64 0:4.8.5-16.el7_4.2                                   

Complete!

  • Second option – just mount dvd and install missing packages using rpm -Uvh command from directory <mount dvd>/Packages.

NOTE – I’m using x86_64 version of packages

rpm -Uvh elfutils-libelf-devel*.x86_64.rpm
rpm -Uvh libaio-devel*.x86_64.rpm
rpm -Uvh unixODBC*.x86_64.rpm
rpm -Uvh ksh*.x86_64.rpm

Create directory structure

mkdir -p /ora01/app
chown oracle:oinstall /ora01/app
chmod 775 /ora01/app

create ORACLE_BASE directory for oracle

mkdir -p /ora01/app/oracle
chown oracle:oinstall /ora01/app/oracle
chmod 775 /ora01/app/oracle

Create ORACLE_HOME directory for oracle

mkdir -p /ora01/app/oracle/product/11.2.0/db_1
chown oracle:oinstall -R /ora01/app/oracle

Disable secure linux by editing the “/etc/selinux/config” file, making sure the SELINUX flag is set as follows. It requires REBOOT to be effective(rebooting after next step) !!!

vim /etc/selinux/config
SELINUX=permissive

In Centos Linux 7 /tmp data is stored on tmpfs which consumes memory and is too small. To revert it back to storage just run following command and REBOOT machine to be effective.

systemctl mask tmp.mount
reboot now

Install database software

Let’s start with database software installation as oracle user.

su - root
cd
rz linux.x64_11gR2_database_1of2.zip
rz linux.x64_11gR2_database_1of2.zip
mv linux.x64_11gR2_database_* /home/oracle

su - oracle

###unzip software
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip

###I defined 4 aliases in .bash_profile of user oracle to make 
[oracle@localhost ~]$ alias envo cdob cdoh tns
  alias envo='env | grep ORACLE'
  alias cdob='cd $ORACLE_BASE'
  alias cdoh='cd $ORACLE_HOME'
  alias tns='cd $ORACLE_HOME/network/admin'

###run alias command envo to display environment settings
envo
ORACLE_UNQNAME=ORA11G
ORACLE_SID=ORA11G
ORACLE_BASE=/ora01/app/oracle
ORACLE_HOSTNAME=localhost.macrocurtain
ORACLE_HOME=/ora01/app/oracle/product/11.2.0/db_1

###run alias command cdob and cdoh to check ORACLE_BASE, ORACLE_HOME 
[oracle@localhost ~]$ cdob
[oracle@localhost oracle]$ pwd
/ora01/app/oracle

[oracle@localhost db_1]$ cdoh
[oracle@localhost db_1]$ pwd
/ora01/app/oracle/product/11.2.0/db_1

###run installation from install directory
cd
./database/runInstall

question:

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

key:

su – root
 
DISPLAY=:0.0; export DISPLAY # 允许使用图形界面
echo $DISPLAY
 
cd /usr/bin
./xhost
access control enabled, only authorized clients can connect
./xhost +
access control disabled, clients can connect from any host

to your physical host

su - oracle

DISPLAY=:0.0; export DISPLAY
echo $DISPLAY

cd /home/oracle/database
./runInstaller
waiting...

1. Uncheck checkbox “I wish to receive security updates via My Oracle Support” and then click “Next” button.


2. Ignore following message and click “Yes” button.


3. Select “Skip software updates” and click “Next” button.

4. Select “Create and configure a database” then click “Next” button.


5. Select “Server Class” then click “Next” button.


6. Select “Single instance database installation” and click “Next” button.


7. Select “Typical Install” and click “Next” button.


8. Enter database name, administration password for user and click “Next” button.

  • NOTE:please look at .bash_profile with user oracle,keep same with it


9. Just click “Next” button.


10. Check checkbox “Ignore All” to ignore this error.


11.Then click “Next” button.

12. Summary screen just before installation. Click “Finish” button.


13. Boring installation …


14. Database Configuration will start and create database for you,so slowly.


15. Click"OK" when Database Configuration Assistant:Warning and You should see summary screen for your new database. Click “OK” button to continue with installation.


16. In the “middle” of installation you will be asked to run 2 scripts as user root. when scripts are executed just click “OK” button. Installation will proceed.


###execute scripts
su - root
[root@localhost ~]# sh /ora01/app/oraInventory/orainstRoot.sh 
Changing permissions of /ora01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /ora01/app/oraInventory to oinstall.
The execution of the script is complete.

[root@localhost ~]# sh /ora01/app/oracle/product/11.2.0/db_1/root.sh 
Running Oracle 11g root.sh script...

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /ora01/app/oracle/product/11.2.0/db_1

Enter the full pathname of the local bin directory: [/usr/local/bin]: /usr/local/bin

17. Installation completed. Just click “Close” button.


18.You should see all details about new database in database console

http://localhost.macrocurtain:1158/em

Post installation steps

Edit the “/etc/oratab” file to set restart flag for ORA11G to ‘Y’.

su - root
vim /etc/oratab
ORA11G:/ora01/app/oracle/product/11.2.0/db_1:Y

listen program

su - oracle
lsnrctl start

start oracle instance

sqlplus /nolog
conn as sysdba-->system
startup

stop oracle instance

shutdown
exit
stop listenning program
lsnrctl stop

OK,FINE!!!

for 3 hours...






  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值