I was trying to install Oracle Database 12c on my CentOS 7 system but seems not working very well. After several times attempting to install, finally I can get it working on my CentOS 7. I was successfully install Oracle 12c on my Oracle Linux 7. Now I want to share how to install Oracle Database 12c on CentOS 7.
There are several things we need to prepare prior to the installation. It takes some times but I think it’s worth your time. For your information, I am installing Oracle 12.2 on CentOS 7.6.
Step 1. Set the Hostname
It is important to correctly set the hostname. You may need to edit the hosts file and add the new hostname to your system.
[root@server /]# nano /etc/hosts
192.168.100.99 server.griyaku.lan server
[oracle@server /]$ cat /etc/hostname
[oracle@server /]$ cat /etc/hostname
Step 2. SELinux and Firewall configuration
In this case, I have disabled the SELinux. You can check the SELinux status using sestatus command.
[oracle@server /]$ sestatus
SELinux status: disabled
Also, it is good to check the firewalld status.
[oracle@server /]$ firewall-cmd --state
As you can see, my firewalld is not running.
Step 3. Download Oracle 12c Installation file for Linux
Navigate to the following website to download the Oracle 12c for Linux x86_64.
You will have a zip file called something like this: linuxx64_12201_database.zip. Save it to your Download directory.
Step 4. Installation Steps
The installation steps consist of several tasks.
Create users and group for Oracle database
[root@server /]# groupadd oinstall
[root@server /]# groupadd dba
[root@server /]# useradd -g oinstall -G dba oracle
[root@server /]# passwd oracle
Edit the kernel parameter
Add the following lines to the /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 1987162112
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 = 1048586
Now apply these settings using this command
[root@server ~]# sysctl -p
[root@server ~]# sysctl -a
Next, add these lines to the file /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
Extract/unzip the Oracle 12c installation file
Now we are going to extract the zip file we’ve downloaded into the /stage directory. You can change it to any directory as you like.
unzip linuxx64_12201_database.zip -d /stage
Modify permission for /stage
[root@server ~]# chown -R oracle:oinstall /stage/
Create directories for Oracle 12c software and database file. So basically, we will create two different directories. One for Oracle Database software (u01) and one for database files (u02).
[root@server ~]# mkdir /u01
[root@server ~]# mkdir /u02
[root@server ~]# chown -R oracle:oinstall /u01
[root@server ~]# chown -R oracle:oinstall /u02
[root@server ~]# chmod -R 775 /u01
[root@server ~]# chmod -R 775 /u02
[root@server ~]# chmod g+s /u01
[root@server ~]# chmod g+s /u02
Install required packages
We need to install several packages needed by Oracle. Use the following command to install:
[root@server ~]# yum install -y binutils.x86_64 compat-libcap1.x86_64 gcc.x86_64 gcc-c++.x86_64 glibc.i686 glibc.x86_64 \
glibc-devel.i686 glibc-devel.x86_64 ksh compat-libstdc++-33 libaio.i686 libaio.x86_64 libaio-devel.i686 libaio-devel.x86_64 \
libgcc.i686 libgcc.x86_64 libstdc++.i686 libstdc++.x86_64 libstdc++-devel.i686 libstdc++-devel.x86_64 libXi.i686 libXi.x86_64 \
libXtst.i686 libXtst.x86_64 make.x86_64 sysstat.x86_64
Now execute this command to open the Oracle installer GUI. Please note that you must run the following command as oracle user. Do not use root user.
[oracle@server ~]$ /stage/database/runInstaller
Then the installer GUI will show up. Follow the on screen installation wizard. Most of the wizard is pretty self explained. Pay attention to the following step.
Step 1. Security Updates
In this example, I unchecked the security update option.
Step 2. Installation Option
Select create and configure a database
Step 3. Select System Class
Choose Desktop class. Or you can also choose the server class for more advanced configuration option.
Step 4. Database Installation Option
Select Single instance database installation
Step 5. Select Install Type
Choose Typical Install
Step 6. Typical install configuration
Pay attention to the following step. We need to provide the following information. Most of these information is automatically filled. But, you will need to ensure and make any changes needed.
- Oracle base: /u01/app/oracle
- Software location: /u01/app/oracle/product/12.2.0/dbhome_1
- Database file location : /u02
- Database edition: Enterprise edition (7.5 GB)
- OSDBA group: dba
- Global Database Name: orcl.griyaku.lan
- Pluggable database name: mydb01
Make sure to make change accordingly. Most of the time, you will need to adjust the global database name and pluggable database name.
Step 7. Summary
Also the next one. You will see an installation summary for the Oracle database installation.
Hit install button to start the install process. The installation process will take some times.
Execute Configuration Script
If you see the following window appear, this mean we need to execute the command shown in the window in a Terminal console.
So, open a new Terminal and then execute those two commands as root. After the command executed, hit OK.
[root@server ~]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@server ~]# /u01/app/oracle/product/12.2.0/dbhome_1/root.sh
Performing root user operation.
The following environment variables are set as:
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin …
Copying oraenv to /usr/local/bin …
Copying coraenv to /usr/local/bin …
Creating /etc/oratab file…
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
You can follow the installation in a separated window.
Complete the installation
When the install process completes, you should see the following window. Now you can log in to the Oracle Enterprise Manager via web browser.
Now you can login to the Enterprise Manager using the url shown in the last step of the Oracle installation.
Post Installation Tasks
We still have some tasks to do to complete the Oracle 12c Installation on CentOS 7.
Modify the Oracle Environment
Edit the file .bash_profile under the oracle user home directory.
[oracle@server ~]$nano /home/oracle/.bash_profile
Then, copy and paste the following line. Do not forget to change the details with yours.
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/lib64; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
Now apply this setting with this command
[oracle@server ~]$ . .bash_profile
Now we can login to the Oracle database using sqlplus command
[oracle@server ~]$ sqlplus sys as sysdba
SQL*Plus: Release 126.96.36.199.0 Production on Fri Feb 1 05:19:54 2019
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Oracle Database 12c Enterprise Edition Release 188.8.131.52.0 - 64bit Production
Start the database
To start the database from sqlplus, execute the startup SQL command
ORACLE instance started.
Total System Global Area 2466250752 bytes
Fixed Size 8795760 bytes
Variable Size 671091088 bytes
Database Buffers 1778384896 bytes
Redo Buffers 7979008 bytes
I cannot say that installing Oracle Database 12c on CentOS 7 is for everyone. You will need a basic understanding of Linux command line and system. But don’t worry, there are many tutorials on the internet that will guide you through the installation steps. I hope you enjoy this tutorial and see you next time.