linux centos 7 with oracle 12c database

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: hps://works.bepress.com/zhi-xue_xu/10/

Upload: others

Post on 28-May-2022

23 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Linux CentOS 7 with Oracle 12c Database

San Jose State University

From the SelectedWorks of Zhi-Xue Xu

February 1, 2016

Linux CentOS 7 with Oracle 12c DatabaseZhi-Xue Xu, San Jose State University

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

Page 2: Linux CentOS 7 with Oracle 12c Database

1

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.

Page 3: Linux CentOS 7 with Oracle 12c Database

2

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.

Page 4: Linux CentOS 7 with Oracle 12c Database

3

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)

Page 5: Linux CentOS 7 with Oracle 12c Database

4

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.

Page 6: Linux CentOS 7 with Oracle 12c Database

5

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

Page 7: Linux CentOS 7 with Oracle 12c Database

6

• /(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

Page 8: Linux CentOS 7 with Oracle 12c Database

7

Fig. 9 Software Selection

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

Fig. 10 SUMMARY OF CHANGES

Page 9: Linux CentOS 7 with Oracle 12c Database

8

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

Page 10: Linux CentOS 7 with Oracle 12c Database

9

Fig. 13 User Creation

Fig. 14 Begin installation

Page 11: Linux CentOS 7 with Oracle 12c Database

10

After reboot, you get the following windows.

Fig. 15 Login window

Page 12: Linux CentOS 7 with Oracle 12c Database

11

Typing the password. After login, GNMO Window displayed.

Fig. 16 GNMO in CentOS 7

Fig. 17 Finish installation of CentOS 7

Page 13: Linux CentOS 7 with Oracle 12c Database

12

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 tools, Utilities and Other.

Fig. 18 Application in GNOME

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

Page 14: Linux CentOS 7 with Oracle 12c Database

13

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:

Page 15: Linux CentOS 7 with Oracle 12c Database

14

Fig. 20 Settings screen

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

Page 16: Linux CentOS 7 with Oracle 12c Database

15

Fig.21 Network configuration

Fig. 22 Network IPv4 Configuration

Page 17: Linux CentOS 7 with Oracle 12c Database

16

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

Page 18: Linux CentOS 7 with Oracle 12c Database

17

Fig. 24 Processing for update package

Fig. 25 Complete update all packages

Page 19: Linux CentOS 7 with Oracle 12c Database

18

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 didn’t install on the Server, we need to install SSH server, and typing the 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.

Page 20: Linux CentOS 7 with Oracle 12c Database

19

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.

Page 21: Linux CentOS 7 with Oracle 12c Database

20

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.

Page 22: Linux CentOS 7 with Oracle 12c Database

21

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

Page 23: Linux CentOS 7 with Oracle 12c Database

22

Fig. 32 Began to Install Apache Web Server

Fig. 33 Installing Apache Web Server…

Page 24: Linux CentOS 7 with Oracle 12c Database

23

Fig. 34 Finish installing Apache Web Server You can start Apache Service, and type the following commend: Sudo systemctl start httpd

Page 25: Linux CentOS 7 with Oracle 12c Database

24

Fig. 35 Start httpd Now you can test Apache Web Server, and type IP address

Fig. 36 Apache Web Page

Page 26: Linux CentOS 7 with Oracle 12c Database

25

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.

Page 27: Linux CentOS 7 with Oracle 12c Database

26

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

Page 28: Linux CentOS 7 with Oracle 12c Database

27

Fig. 39 Download Oracle 12c

2.2 Installing Oracle 12c on CentOS 7

Step 1: Checking System # hostnamectl

Fig. 40 Checking CentOS System

Page 29: Linux CentOS 7 with Oracle 12c Database

28

Step 2: Setting Hostname and Upgrading System and Setting Hostname # cat /etc/hostname

Fig.41 hostname Confirm the firewall enabled # sestatus

Page 30: Linux CentOS 7 with Oracle 12c Database

29

Fig. 42 The firewall enabled Step 3: Update the CentOS system with the latest packages # yum update –y

Page 31: Linux CentOS 7 with Oracle 12c Database

30

Fig. 43 Update the latest packages in Linux CentOS 7

Fig. 44 Finished update the latest packages

Page 32: Linux CentOS 7 with Oracle 12c Database

31

Step 4: Download Oracle 12C from Oracle Web Page

Fig. 45 Download Oracle 12C

Fig. 46 Two installation zip files for Oracle 12C

Page 33: Linux CentOS 7 with Oracle 12c Database

32

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 doesn’t have this package.

Page 34: Linux CentOS 7 with Oracle 12c Database

33

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:

Page 35: Linux CentOS 7 with Oracle 12c Database

34

# vi /etc/sysctl.conf

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

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

Page 36: Linux CentOS 7 with Oracle 12c Database

35

Check and apply the new values. # sysctl –p

Fig. 51 Loading new kernel parameters # sysctl –a

Page 37: Linux CentOS 7 with Oracle 12c Database

36

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

Page 38: Linux CentOS 7 with Oracle 12c Database

37

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_HOME/bin:$HOME/pm export PATH Step 9: Extract the zipped Oracle Database Software archives (linuxamd64_12102_database_1of2.zip, linuxamd64_12102_database_2of2.zip)

Page 39: Linux CentOS 7 with Oracle 12c Database

38

# 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

Page 40: Linux CentOS 7 with Oracle 12c Database

39

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

Page 41: Linux CentOS 7 with Oracle 12c Database

40

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.

Page 42: Linux CentOS 7 with Oracle 12c Database

41

Fig. 57 Chose Server class Click Single instance database installation, and then click “Next” button.

Fig. 58 Chose Single instance database installation

Page 43: Linux CentOS 7 with Oracle 12c Database

42

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.

Page 44: Linux CentOS 7 with Oracle 12c Database

43

Fig. 60 Typical Install Configuration After finish the definitions, and then click “Next” button.

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

Page 45: Linux CentOS 7 with Oracle 12c Database

44

Click “Next” button. The screen showed summary for installing Oracle 12C.

Fig. 62 Summary for installing Oracle 12C Begin to install …

Page 46: Linux CentOS 7 with Oracle 12c Database

45

Fig. 63 Begin to install … Execute Configuration scripts

Fig. 64 Executing Configuration scripts

Page 47: Linux CentOS 7 with Oracle 12c Database

46

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

Page 48: Linux CentOS 7 with Oracle 12c Database

47

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

Fig. 67 Password Management

Fig. 68 Continue to install Oracle 12C

Page 49: Linux CentOS 7 with Oracle 12c Database

48

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

Page 50: Linux CentOS 7 with Oracle 12c Database

49

Fig. 70 Oracle Net Configuration Assistant Listener configuration Choosing Listener configuration, and click “Next” button.

Page 51: Linux CentOS 7 with Oracle 12c Database

50

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.

Page 52: Linux CentOS 7 with Oracle 12c Database

51

Fig. 72 Local Net Service Name Configuration

Fig. 73 Database Service Name

Page 53: Linux CentOS 7 with Oracle 12c Database

52

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.

Page 54: Linux CentOS 7 with Oracle 12c Database

53

Fig. 75 Connecting Database Listener Control Utility Typing the following commend: $ Lsnrctl LSNRCTL> start

Page 55: Linux CentOS 7 with Oracle 12c Database

54

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

Page 56: Linux CentOS 7 with Oracle 12c Database

55

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

Page 57: Linux CentOS 7 with Oracle 12c Database

56

Fig. 78 Listener Status

Fig. 79 Database connection by system account The Database connection test was successful by userid:system

Page 58: Linux CentOS 7 with Oracle 12c Database

57

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.

Page 59: Linux CentOS 7 with Oracle 12c Database

58