Vous êtes sur la page 1sur 59

San Jose State University

From the SelectedWorks of Zhi-Xue Xu

February 1, 2016

Linux CentOS 7 with Oracle 12c Database


Zhi-Xue Xu, San Jose State University

Available at: http://works.bepress.com/zhi-xue_xu/10/

Linux System CentOS 7 Server with Oracle 12c Database


Zhi-Xue Xu
Academic Technology
San Jose State University
Feb. 1, 2016

CentOS 7 Linux is open source and latest version. The CentOS 7 Linux distribution is a stable, predictable,
manageable and reproducible platform derived from the sources of Red Hat Enterprise Linux (RHEL). We
have practiced to CentOS 7 Linux Server with Oracle 12c database software. Linux System CentOS 7 is
the best open Linux System on the world. We have worked with Linux system CentOS 7 to install and
configure GNOME, Network, Web Server, Firewall, SSH, and Server and client by Putty. We also installed
Oracle 12c in Linux CentOS 7. The Oracle 12c also is the latest version for Oracle Database too. This
Oracle Database in Linux platform server will provide the professional database applications without any
license cost. We can develop and apply Oracle 12c for Computer Inventory Control, Textbook
Information System, Video Sharing Storage Search System, Scheduling and Classes Planning, and
Management Information System applications on campus.
1. Working with Linux system CentOS 7
CentOS (abbreviated from Community Enterprise Operating System) is a free, enterprise-class,
community-supported computing platform and Linux Operation System. It is compatible with its
upstream source, Red Hat Enterprise Linux (RHEL). CentOS 7 released on July 7, 2014. The
Maintenance updates will be until June 30, 2024.
1.1 Introduction to Linux CentOS 7
The CentOS 7 Linux is a stable, predictable, manageable and reproducible platform derived
from the sources of Red Hat Enterprise Linux. CentOS 7 conforms fully to Red Hat's
redistribution policy and aims to have full functional compatibility with the upstream
product. CentOS 7 mainly changes packages to remove Red Hat's branding and artwork.
CentOS 7 does not to follow Red Hat's usage of Installation Roles. In CentOS 7 is made
available to the users at time of installation. CentOS-7 sources are hosted at git.centos.org.
Source RPMs will also be published once the release is done, in the usual location
at http://vault.centos.org/centos/7/.
You also can be further reading on https://www.centos.org/ for CentOS 7.
1.2 Download DVD ISO for Linux CentOS 7 Server
To get a copy of CentOS 7 can be downloaded from https://www.centos.org/download/.
CentOS 7 has 64 bit platforms, and currently there is no 32 bit ISO image.

Fig.1 Download CentOS 7


1.3 Make an installation bootable Drive
After you have downloaded the ISO image, make a bootable DVD or USB drive using your
favorite CD/DVD burning software.
1.4 Work steps for Installing CentOS 7
Insert bootable CentOS7 DVD to DVD drive and boot from DVD drive. To begin installation,
click Install CentOS 7.

Fig. 2 Begin to install CentOS 7


The system will start loading media installer.

Fig.3 Loading media installer


Select your Installation Process Language, English (United States)

Fig. 4 Language for installation processing


The next step, the screen prompt is Installation Summary. It contains a lot of options to fully
customize your system.

Fig.5 Installation Summary


Click on Installation Destination menu, select the disk and choose you will configure
partitioning.

Fig. 6 Installation Destination


Click on the Installation Destination icon to change this to custom partitioning. Click on the
hard drive you want to install CentOS 7 and under the Other Storage Options, choose I will
configure partitioning then click Done.

Fig. 7 Working with Hard drive partition


If you click Automatically configure partitioning, option which will create three system
partition using XFS filesystem, automatically redistributing your hard-disk space and
gathering all LVS into one big Volume Group named centos.

/boot Non LVM

/(root) LVM
Swap LVM

Or Click I will configure partitioning, then click Done.


Click Click here to create them automatically, get partition table as follows.

Fig. 8 Creating partition table


Click SOFTWARE SELECTION, You can select GNOME Desktop and GNOME applications

Fig. 9 Software Selection


You finish hit on Done button and Accept Changes on the Summary of Changes prompt.

Fig. 10 SUMMARY OF CHANGES

Click Begin installation, Installation will begin immediately and as it proceeds you need to set up
a User and root account.

Fig. 11 Installation Summary for beginning installation

Fig. 12 Root Password

Fig. 13 User Creation

Fig. 14 Begin installation

After reboot, you get the following windows.

Fig. 15 Login window

10

Typing the password. After login, GNMO Window displayed.

Fig. 16 GNMO in CentOS 7

Fig. 17 Finish installation of CentOS 7

11

1.5 GNOME desktop Environment on CentOS 7


In installation procedure, we have chosen Gnome and Gnome Applications in Section
Software. GNOME is free and open source. GNOME is a good graphical user interface (GUI)
that has been applied to CentOS 7 Linux Operation System. GNOME has provided Linux
desktop environment.
a. Applications
Click Applications, Pop down menu will be showed. The menu includes Favorites,
Accessories, Documentation, Graphics, Internet, Office, Sound & Video, Sundry, System t
ools, Utilities and Other.

Fig. 18 Application in GNOME


b. Places
Click Places. The Pop down menu included Home, Douments, Downloads, Music, Picture
s, Videos, Computers and Browse Network.

12

Fig. 19 Places in GNOME


c. Settings in System Tools
In the System Tools menu, we can click Settings, and get Settings screen as follows:

13

Fig. 20 Settings screen


1.6 Network Configuration
In the Setting screen, click Network icon, you can get Network configuration screen. This con
figuration included Wired, Bridge and Network Proxy.

14

Fig.21 Network configuration

Fig. 22 Network IPv4 Configuration

15

1.7 Update All Linux Packages


After installing CentOS 7, we need to update all packages with following command:
Sudo yum update -y

Fig. 23 Update packages

16

Fig. 24 Processing for update package

Fig. 25 Complete update all packages

17

1.8 OpenSSH and Putty between Server and Client


OpenSSH is an open source project. You are free to get and use it for commercial and
non-commercial purposes subject. You can create the communication remotely between
Server and Client by SSH, login server from Client.
After updating packages, you can test whether your server had installed OpenSSH.
You can type the following commend:
Sudo ssh V

Fig. 26 Checking the version of Open SSH


The terminal has showed the version of OpenSSH. We can know the SSH has installed in the
Server.
If we know Open SSH didnt install on the Server, we need to install SSH server, and typing th
e following commend:
yum -y install openssh-server openssh-clients
PuTTY is an SSH and telnet client. PuTTY is open source software that is available with source
code and is developed and supported by a group of volunteers.

18

You can download PuTTY from http://www.putty.org/ and install in Windows 7, 8, and 10,
and any Linux desktop.
Click icon putty, and type IP address of CentOS 7 Server:

Fig. 27 Putty Window


Click OK, and type usename and password. You can login CentOS 7 Server.

Fig. 28 Login CentOS 7 Server by Putty


Type su to login root account.

19

Fig. 29 Login root account.


Change to different dirtory, and explore the files.

Fig. 30 working in CentOS 7 file system by Putty


The /etc/ssh/sshd_config is SSH Configuration file. You can open and edit configuration
File and change PermitRootLogin yes to no.

20

Fig. 31 SSH configuration file


1.9 Apache Web Server on CentOS 7
The Apache web server is one of the most popular and powerful web servers. It is also one
of the most secure web servers. Apache software foundation does not distinguish between
personal, internal, or commercial use of our software. Packaging and redistribution of any of
it is subject to the terms of our license.
We need to install Apache Http Server on CentOS 7.
Before we install Apache web Server we need to update all packages.
Sodu yum update y
After updating, we begin to install Apache Web Server
Sudo yum install httpd y

21

Fig. 32 Began to Install Apache Web Server

Fig. 33 Installing Apache Web Server

22

Fig. 34 Finish installing Apache Web Server


You can start Apache Service, and type the following commend:
Sudo systemctl start httpd

23

Fig. 35 Start httpd


Now you can test Apache Web Server, and type IP address

Fig. 36 Apache Web Page

24

You also can create a web page yourself, and type the following commend:
Vi /var/www/html/index.html

Fig.37 Creating a Web Page to test


Your web page showed on the Internet explorer.

25

Fig. 38 Testing Web Page showed on Internet Explore


2. Working with Oracle 12c on CentOS 7
Oracle database is the set of related data collections, we call it as Relational database
management system (RDBMS) or just Oracle. Oracle is one of the powerful DBMS with many
features such as tune-able, reliable and scalable.
The current version of oracle is 12c (C stands for Cloud) with cloud features. Oracle provides
technology supports regarding the products which includes troubleshooting supports patches
and updates, which makes it works well. Oracle 12C is very easy to organize different
applications data.
The Oracle 12C has been applied to projects in Universities, Banking and commerce related
departments. We are trying to apply and develop to the Computer Inventory, Video Sharing,
Employees Information System, Class Schedule and Plan and so on.
2.1 Download Oracle 12c software for Linux System
We can download Oracle 12C software from Oracle Web Page:
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

26

Fig. 39 Download Oracle 12c


2.2 Installing Oracle 12c on CentOS 7
Step 1: Checking System
# hostnamectl

Fig. 40 Checking CentOS System

27

Step 2: Setting Hostname and Upgrading System and Setting Hostname


# cat /etc/hostname

Fig.41 hostname
Confirm the firewall enabled
# sestatus

28

Fig. 42 The firewall enabled


Step 3: Update the CentOS system with the latest packages
# yum update y

29

Fig. 43 Update the latest packages in Linux CentOS 7

Fig. 44 Finished update the latest packages

30

Step 4: Download Oracle 12C from Oracle Web Page

Fig. 45 Download Oracle 12C

Fig. 46 Two installation zip files for Oracle 12C

31

Step 5: Installing packages for Oracle 12C installation


According to the requirement packages to install oracle 12c in centos 7, we need to install
packages 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, and sysstat.x86_64.
You type the following to install these above packages.
# yum install y binutils.x86_64

Fig. 47 Installing packages for Oracle 12C installation


When you install these packages in CentOS, the system will tell you that the package has
installed if the system has already installed.
The package will be installed if the system doesnt have this package.

32

Fig. 48 The package will be installed


Step 6: Create required OS users and groups for Oracle Database
# groupadd oinstall
# groupadd dba
# useradd -g oinstall -G dba oracle
# passwd oracle
Step 7: Add the following kernel parameters 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
Editing /etc/sysctl.conf, typing the following commend:

33

# vi /etc/sysctl.conf

Fig. 49 Editing /etc/sysctl.conf to add kernel parameters

Fig. 50 Adding kernel parameters in /etc/sysctl.conf

34

Check and apply the new values.


# sysctl p

Fig. 51 Loading new kernel parameters


# sysctl a

35

Fig. 52 Display all variable


Step 8: Specify limits for oracle user in the /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
Editing /etc/security/limits.conf

36

Fig. 53 Adding oracle soft and hard to limits.conf file


Step 8: Editing the .bash_profile in /home/oracle/ and add the following lines:
export PATH
ORACLE_BASE=/home/oracle/app
export ORACLE_BASE
ORACLE_HOME=/home/oracle/app/product/12.2.0.2
export ORACLE_HOME
ORACLE_SID=vdtst
export ORACLE_SID
LD_LIBRARY_PATH=/home/oracle/app/product/12.2.0.2/lib
export LD_LIBRARY_PATH
ORACLE_LIBRARY=/home/oracle/app/product/12.2.0.2/lib
export ORACLE_LIBRARY
PATH=$PATH:/usr/local/bin:/usr/openwin/bin:/opt/sfw/bin:/home/oracle/app/product/12.2.0.
2:/home/oracle/app/product/12.2.0.2/lib:/home/oracle/app/product/12.2.0.2/bin:$ORACLE_H
OME/bin:$HOME/pm
export PATH
Step 9: Extract the zipped Oracle Database Software archives
(linuxamd64_12102_database_1of2.zip, linuxamd64_12102_database_2of2.zip)

37

# yum install -y zip unzip


# unzip linuxamd64_12102_database_1of2.zip
# unzip linuxamd64_12102_database_2of2.zip
Step 10: Set secure Linux to permissive by editing the "/etc/selinux/config" file, making sure the
SELINUX flag is set as follows.
SELINUX=permissive
Once the change is complete, restart the server or run the following command.
# setenforce Permissive
Step 11: If you have the Linux firewall enabled, you will need to disable or configure it, as shown
here or here. To disable it, do the following
# systemctl stop firewalld
# systemctl disable firewalld
Step 12: Create the directories in which the Oracle software will be installed.
mkdir -p /oracle/home/app/oracle/product/12.1.0.2/
chown -R oracle:oinstall /home/oracle
Step 13: Running Oracle installer
Login oracle user account, go to folder /home/oracle/database, and type the following
commend:
$ ./runInstaller

38

Fig. 54 Running installer for Oracle 12c


Typing your email address to be informed of security issue, and then click Next button.

Fig. 55 Typing your email address to be informed of security issue

39

Click Create and configure a database, and then click Next button.

Fig. 56 Create and configure a database


Click Server class, and then click Next button.

40

Fig. 57 Chose Server class


Click Single instance database installation, and then click Next button.

Fig. 58 Chose Single instance database installation

41

Click Typical install, and then click Next button.

Fig. 59 Chose Typical install


On the screen you need to define global database name, Oracle base, Software location and
OSDBA group.

42

Fig. 60 Typical Install Configuration


After finish the definitions, and then click Next button.

Fig. 61 Inventory Directory: /home/oracle/oraInventory

43

Click Next button.


The screen showed summary for installing Oracle 12C.

Fig. 62 Summary for installing Oracle 12C


Begin to install

44

Fig. 63 Begin to install


Execute Configuration scripts

Fig. 64 Executing Configuration scripts

45

DBCA (database configuration assistant) will start to create new database.

Fig.65 Database Configuration Assistant starts to create new database


You can see summary for the database.

Fig. 66 Database Configuration Assistant

46

Click Password Management to unlock and change passwords for default accounts.

Fig. 67 Password Management

Fig. 68 Continue to install Oracle 12C

47

Installation is finished. Click Close button.

Fig. 69 Installation is finished.


2.3 Configurations after installation of Oracle 12c
After installation of Oracle 12C, we need to configure the local Net Service, listeners and
tnsnames files. Also, we can use Oracle Net Manager to configure network components.
2.3.1

Oracle Net Configuration Assistant


Starting Oracle Net Configuration Assistant.
From $ORACLE_HOME/bin, enter the following at the command line:
$ netca

48

Fig. 70 Oracle Net Configuration Assistant


Listener configuration
Choosing Listener configuration, and click Next button.

49

Fig.71 Listener name


Type listener name, and click Next button.
Local Net Service Name Configuration:
Choosing Local Net Service Name Configuration, and click Next button.

50

Fig. 72 Local Net Service Name Configuration

Fig. 73 Database Service Name

51

Type Database Service Name, and click Next button.


Configuring hostname
Typing hostname, and click Next button.

Fig. 74 Hostname
Connecting Database by your information in the Net Configuration Assistant.

52

Fig. 75 Connecting Database


Listener Control Utility
Typing the following commend:
$ Lsnrctl
LSNRCTL> start

53

Fig. 76 Listener start


You can use listener commands to perform basic management functions on one or
more listeners.
2.3.2

Oracle Net Manager


From $ORACLE_HOME/bin, enter the following at the command line:
Netmgr

54

Fig. 77 Oracle Net Manager


The Oracle Net Manager interfaces window contains two panes: the navigator pane
and the right pane.
When you start the listener, you can see the STATUS of the LISTENER.

55

Fig. 78 Listener Status

Fig. 79 Database connection by system account


The Database connection test was successful by userid:system

56

2.3.3

Login SQL*Plus
Now we can be working with SQL*Plus.
Type the following commend:
$ Sqlplus */ sysdba

Fig. 80 Login sql*plus


Now we can use sql*plus. SQL*Plus is an interactive and batch query tool in Oracle
Database. SQL*Plus has its own commands and environment, and it provides access
to the Oracle Database.
We have been successful to install Oracle 12c database software on the Linux Centos 7. This
Oracle Database in Linux platform will provide the professional database applications without
any license cost. I am sure that this Linux and database platform will be better to apply for
Computer Inventory Control, Textbook Information System, Video Sharing Storage Search
System, Faculty, Student and Staff Information System, Schedule and Classes System and
Management Information System on campus.

57

58

Vous aimerez peut-être aussi