Install Oracle 12C Release 1 (12.1) on Centos Linux 7

This article presents how to install Oracle 12C(12.1.0.1) Release 1 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).

Software

Software for 12CR1 is available on OTN or edelivery

Database software

linuxamd64_12c_database_1of2.zip 
linuxamd64_12c_database_2of2.zip

OS configuration and preparation

OS configuration is executed as root. To login as root just execute following command in terminal.

su - root

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

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

For example.

127.0.0.1 centos7 centos7.dbaora.com localhost.localdomain localhost

Set hostname

hostnamectl set-hostname centos7.dbaora.com --static

Add groups

#groups for database management
/usr/sbin/groupadd -g 501 oinstall
/usr/sbin/groupadd -g 502 dba
/usr/sbin/groupadd -g 503 oper
Add user Oracle for database software
/usr/sbin/useradd -u 501 -g oinstall -G dba,oper oracle

Change password for user Oracle

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

SELINUX=permissive

Packages

Check which packages are installed and which are missing

rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE}(%{ARCH})\n' binutils \
gcc \
gcc-c++ \
glibc \
glibc-common \
glibc-devel \
glibc-headers \
ksh \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
libXext \
libXtst \
libX11 \
libXau \
libXi \
make \
sysstat \
unixODBC \
unixODBC-devel \
zlib-devel \
compat-libcap1 \
compat-libstdc++-33

In my case it returns following

binutils-2.23.52.0.1-12.el7(x86_64)
gcc-4.8.2-3.el7(x86_64)
gcc-c++-4.8.2-3.el7(x86_64)
glibc-2.17-36.el7(x86_64)
glibc-common-2.17-36.el7(x86_64)
glibc-devel-2.17-36.el7(x86_64)
glibc-headers-2.17-36.el7(x86_64)
package ksh is not installed
libaio-0.3.109-9.el7(x86_64)
package libaio-devel is not installed
libgcc-4.8.2-3.el7(x86_64)
libstdc++-4.8.2-3.el7(x86_64)
libstdc++-devel-4.8.2-3.el7(x86_64)
libXext-1.3.2-1.el7(x86_64)
libXtst-1.2.2-1.el7(x86_64)
libX11-1.6.0-1.el7(x86_64)
libXau-1.0.8-1.el7(x86_64)
libXi-1.7.2-1.el7(x86_64)
make-3.82-19.el7(x86_64)
sysstat-10.1.5-1.el7(x86_64)
package unixODBC is not installed
package unixODBC-devel is not installed
package zlib-devel is not installed
package compat-libcap1 is not installed
package compat-libstdc++-33 is not installed

You need to install missing from dvd. Just mount it and install missing packages using rpm -Uvh command from directory <mount dvd>/Packages.

NOTE – I’m using x86_64 version of packages

rpm -Uvh libaio-devel*.x86_64.rpm
rpm -Uvh unixODBC*.x86_64.rpm
rpm -Uvh zlib-devel*.x86_64.rpm
rpm -Uvh ksh*.x86_64.rpm
rpm -Uvh compat-libcap1*.x86_64.rpm
rpm -Uvh compat-libstdc++-33*.x86_64.rpm
Add kernel parameters to /etc/sysctl.conf
# kernel parameters for 12gR1 installation

fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500

Apply kernel parameters

/sbin/sysctl -p

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

# shell limits for users oracle 12gR1

oracle   soft   nofile   1024
oracle   hard   nofile   65536
oracle   soft   nproc    2047
oracle   hard   nproc    16384
oracle   soft   stack    10240
oracle   hard   stack    32768

Additional steps

Create .bash_profile for user oracle

# Oracle Settings
export TMP=/tmp

export ORACLE_HOSTNAME=centos7.dbaora.com
export ORACLE_UNQNAME=ORA12C
export ORACLE_BASE=/ora01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1
export ORACLE_SID=ORA12C

PATH=/usr/sbin:$PATH:$ORACLE_HOME/bin

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

envo

Directory structure

Create directory structure as user root

ORACLE_BASE – /ora01/app/oracle

ORACLE_HOME – /ora01/app/oracle/product/12.1.0/db_1

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

In Oracle Enterprise 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

Install database software

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

su - oracle

--unizp software it will create directory "database" 
--where you can find installation software
unzip linuxamd64_12c_database_1of2.zip
unzip linuxamd64_12c_database_2of2.zip

--I defined 4 aliases in .bash_profile of user oracle to make 
--administration heaven :)

[oracle@centos7 ~]$ 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=ORA12C
ORACLE_SID=ORA12C
ORACLE_BASE=/ora01/app/oracle
ORACLE_HOSTNAME=centos7.dbaora.com
ORACLE_HOME=/ora01/app/oracle/product/12.1.0/db_1

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

[oracle@centos7 db_1]$ cdoh
[oracle@centos7 db_1]$ pwd
/ora01/app/oracle/product/12.1.0/db_1

--run installation from "database" directory
./runInstall

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

fedora_ora12_1

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

fedora_ora12_2

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

fedora_ora12_3

4. Ignore following message. Just click “Yes” button.

fedora_ora12_4

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

fedora_ora12_5

6. Select “Desktop Class” and click “Next” button.

fedora_ora12_6

7. On the screen you need to define global database name and pluggable database name. Rest of options you can keep default. Then click “Next” button.

fedora_ora12_7

8. Accept default settings then click “Next” button.

fedora_ora12_8

9. Summary screen just before installation. It’s the last moment to make changes in previous steps. If you are ready click “Install” button.

fedora_ora12_9

10. Installation begins …

fedora_ora12_11

11. Unfortunately I received error during binaries linking

fedora_ora12_12

in log you should see

/usr/bin/ld: note: '__tls_get_addr@@GLIBC_2.3' is defined in 
DSO /lib64/ld-linux-x86-64.so.2 so try adding it to the linker 
command line /lib64/ld-linux-x86-64.so.2: could not read symbols: 
Invalid operation

INFO: collect2: error: ld returned 1 exit status

12. To solve this problem do following as user Oracle

  • remove directory /ora01/app/oracle/product/12.1.0/db_1/lib/stubs
rm -rf /ora01/app/oracle/product/12.1.0/db_1/lib/stubs
  • backup file $ORACLE_HOME/rdbms/lib/env_rdbms.mk
cd $ORACLE_HOME/rdbms/lib/
cp env_rdbms.mk env_rdbms.mk.bck
  • make changes in $ORACLE_HOME/rdbms/lib/env_rdbms.mk

modify line 176

LINKTTLIBS=$(LLIBCLNTSH) $(ORACLETTLIBS) $(LINKLDLIBS)

to

LINKTTLIBS=$(LLIBCLNTSH) $(ORACLETTLIBS) $(LINKLDLIBS) -lons

modify line 279 and 280

LINK=$(FORT_CMD) $(PURECMDS) $(ORALD) $(LDFLAGS) $(COMPSOBJS)
LINK32=$(FORT_CMD) $(PURECMDS) $(ORALD) $(LDFLAGS32) $(COMPSOBJS)

to

LINK=$(FORT_CMD) $(PURECMDS) $(ORALD) $(LDFLAGS) $(COMPSOBJS) -Wl,--no-as-needed
LINK32=$(FORT_CMD) $(PURECMDS) $(ORALD) $(LDFLAGS32) $(COMPSOBJS) -Wl,--no-as-needed

modify line 3041 and 3042

TG4PWD_LINKLINE= $(LINK) $(OPT) $(TG4PWDMAI) \
        $(LLIBTHREAD) $(LLIBCLNTSH) $(LINKLDLIBS)

to

TG4PWD_LINKLINE= $(LINK) $(OPT) $(TG4PWDMAI) \
        $(LLIBTHREAD) $(LLIBCLNTSH) $(LINKLDLIBS) -lnnz12

Once it’s done click “Retry” button on screen from point 11 to continue with installation. Linking should finish properly and binaries installation should continue.

13. In the end you will be asked to run as root two scripts. Once they are completed click “OK” button – installation will proceed.

/ora01/app/oraInventory/orainstRoot.sh
/ora01/app/oracle/product/12.1.0/db_1/root.sh

fedora_ora12_13 fedora_ora12_14

18. Once binaries are installed automatically DBCA (database configuration assistant) will start to create new database.

fedora_ora12_15

19. You should see summary screen for your database. You can click “Password Management” to unlock and change passwords for default account. Click “OK” button.

dbca_12c_centos7_1

20. Installation is finished. Click “Close” button.

fedora_ora12_17

21. Post installation steps

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

ORA12C:/u01/app/oracle/product/12.1.0/db_1:Y

Have a fun 🙂

Tomasz

11 thoughts on “Install Oracle 12C Release 1 (12.1) on Centos Linux 7

  1. Very useful, very nicely described.

    I just tried with the lastest 12.1.0.2.0. I didn’t have your problem on binary linkings.

    A line on how to open the firewall for the dabase would be helpful too. The following seems to work:

    firewall-cmd –permanent –zone=public –add-port=1521/tcp
    firewall-cmd –reload

  2. Thanks for the post..:)
    Actually I am installing oracle 12.1.0.2.0 standalone on centos 7.
    Facing many issues on configuring grid..
    Can we get similar post on 12c grid installation on Centos 7

Leave a Reply to Shaun Coughlin Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.