20
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. 720041 US 1 Simon Coter Director of Product Management, Oracle [email protected] HOL-6394 Oracle Database 18c: Reliable DevOps with Vagrant, VirtualBox and Oracle Linux

HOL-6394 Oracle Database 18c: Reliable DevOps … Install Oracle Linux 7.5 (64 bits) as host operating system (the lab can also run on Windows or macOS). o Install Oracle VM VirtualBox

Embed Size (px)

Citation preview

Page 1: HOL-6394 Oracle Database 18c: Reliable DevOps … Install Oracle Linux 7.5 (64 bits) as host operating system (the lab can also run on Windows or macOS). o Install Oracle VM VirtualBox

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. 720041 US

1

Simon Coter Director of Product Management, Oracle

[email protected]

HOL-6394 Oracle Database 18c: Reliable DevOps with Vagrant, VirtualBox and Oracle Linux

Page 2: HOL-6394 Oracle Database 18c: Reliable DevOps … Install Oracle Linux 7.5 (64 bits) as host operating system (the lab can also run on Windows or macOS). o Install Oracle VM VirtualBox

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. 720041 US

2

CONTENTS

Introduction..............................................................................................................................................................3

Preparation (done before LAB) ................................................................................................................................4

Summary of the Lab steps ........................................................................................................................................5

Global picture ...........................................................................................................................................................5

Vagrant & VirtualBox ................................................................................................................................................6

Create first virtual machine by Vagrant and VirtualBox ................................................................................................................ 6

Create second virtual machine by Vagrant and VirtualBox ......................................................................................................... 13

Summary ............................................................................................................................................................... 17

Appendix A: preparing the environment to run the lab from your home or office ............................................. 18

Find a Suitable Machine ............................................................................................................................................................... 18

Download required binaries ........................................................................................................................................................ 18

Install Oracle VM VirtualBox and Vagrant ................................................................................................................................... 19

Appendix B: References ........................................................................................................................................ 20

Page 3: HOL-6394 Oracle Database 18c: Reliable DevOps … Install Oracle Linux 7.5 (64 bits) as host operating system (the lab can also run on Windows or macOS). o Install Oracle VM VirtualBox

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. 720041 US

3

INTRODUCTION This document details all actions that were done during Oracle Open World 2018 session Hands-On Lab 6394. This hands-on lab takes you through different examples and approaches on how-to build a DevOps environment by leveraging open-source utilities like Vagrant, VirtualBox, Oracle Linux and Docker. Vagrant is an open-source software product for building and maintaining portable virtual software development environments, e.g. for VirtualBox. The core idea behind it lies in the fact that the environment maintenance of virtualizations becomes increasingly difficult in a large software development project. Vagrant simplifies the necessary software configuration management in order to increase development productivity. Vagrant is written in the Ruby language, but its ecosystem supports development in almost all major languages.

Oracle VM VirtualBox is a free and open-source hypervisor for x86 computers being developed by Oracle Corporation. VirtualBox may be installed on a number of host operating systems, including: Linux, macOS, Windows and Solaris; It supports the creation and management of guest virtual machines running versions and derivations of Windows, Linux, BSD, OS/2, Solaris, macOS and others. For some guest operating systems, a "Guest Additions" package of device drivers and system applications is available which typically improves performance.

Oracle Linux (OL) is a Linux distribution packaged and freely distributed by Oracle, available partially under the GNU General Public License since late 2006. It is compiled from Red Hat Enterprise Linux source code, replacing Red Hat branding by Oracle's. It also used by Oracle Cloud and Oracle Engineered Systems such as Oracle Exadata and others. Potential users can freely download Oracle Linux through Oracle's E-delivery service (Oracle Software Delivery Cloud) or from a variety of mirror sites, and can deploy and distribute it without cost.

Page 4: HOL-6394 Oracle Database 18c: Reliable DevOps … Install Oracle Linux 7.5 (64 bits) as host operating system (the lab can also run on Windows or macOS). o Install Oracle VM VirtualBox

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. 720041 US

4

PREPARATION (DONE BEFORE LAB) To save time and fit in the one-hour slot of Oracle Open World labs, the following actions were performed before the actual lab.

o Install Oracle Linux 7.5 (64 bits) as host operating system (the lab can also run on Windows or macOS). o Install Oracle VM VirtualBox 5.2 plus extension-pack on the host OS. o Install Vagrant on the host operating system. o Get all ready-to-run Vagrant configuration files from https://www.github.com/oracle/vagrant-boxes

Note: To run this lab from your home or office, perform the tasks in Appendix A first to prepare your environment before you run the lab.

Page 5: HOL-6394 Oracle Database 18c: Reliable DevOps … Install Oracle Linux 7.5 (64 bits) as host operating system (the lab can also run on Windows or macOS). o Install Oracle VM VirtualBox

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. 720041 US

5

SUMMARY OF THE LAB STEPS In this lab, you will get the foundation for running Oracle Database 18c DevOps environment by using Vagrant, VirtualBox and Oracle Linux. There is no particular requirement to start with this HOL except for the “Preparation phase described above”.

GLOBAL PICTURE Figure 1 shows all the components (Oracle VM VirtualBox and Oracle VM virtual machines) with their names and configuration (memory, IP addresses, and so on).

Figure 1.Diagram of all the components and their configuration.

Page 6: HOL-6394 Oracle Database 18c: Reliable DevOps … Install Oracle Linux 7.5 (64 bits) as host operating system (the lab can also run on Windows or macOS). o Install Oracle VM VirtualBox

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. 720041 US

6

VAGRANT & VIRTUALBOX

CREATE FIRST VIRTUAL MACHINE BY VAGRANT AND VIRTUALBOX

As previously explained, we are going to use Oracle VM VirtualBox and Vagrant on our own laptop; it does not matter which OS you have on the host because both “Vagrant” and “VirtualBox” can easily run on all main x86 platforms.

• Just open a command-prompt, or a terminal on Linux, and execute the command “vagrant”.

Figure 2. Vagrant command options.

Page 7: HOL-6394 Oracle Database 18c: Reliable DevOps … Install Oracle Linux 7.5 (64 bits) as host operating system (the lab can also run on Windows or macOS). o Install Oracle VM VirtualBox

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. 720041 US

7

• Into the folder “HOL6394” we have defined two different Vagrant Projects: o ORCL-18.3.0 o APEX-18.3.0

Where “ORCL-18.3.0” is a Vagrant Box cloned from our official GitHub Repository for the Oracle Database 18c while “APEX-18.3.0” is a totally new Vagrant Box built starting from the existing “ORCL-18.3.0” Box.

• Change directory to the first Vagrant Box, ORCL-18.3.0 # cd ORCL-18.3.0

• Check the Vagrantfile content to see configuration and steps that will be executed

# cat Vagrantfile

Figure 3. Vagrantfile.

• Before starting with “vagrant’ command line utility, just look for the availability of your favorite Linux distribution; open a web-browser and connect to “Vagrant Boxes Search Engine” from Hashicorp. On this website you’ll be able to look for boxes already installed and ready-to-run with unlimited combinations of platforms, releases and software installed on top. Official “Oracle Linux” Vagrant Boxes are also available on our own website at:

Page 8: HOL-6394 Oracle Database 18c: Reliable DevOps … Install Oracle Linux 7.5 (64 bits) as host operating system (the lab can also run on Windows or macOS). o Install Oracle VM VirtualBox

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. 720041 US

8

http://yum.oracle.com/boxes

• By checking the “Vagrantfile“ you’ll note that at the end of the same an external command will be executed: # scripts/install.sh This command will proceed to the installation and configuration of the Oracle Database 18c and, the same, will use the environment variables we’ve declared

Figure 4. Vagrantfile external commands.

• So, by just executing “vagrant up” we’ll get an up & running Oracle Database 18c. The only thing required, we’ve prepared, are:

• Get Oracle Database 18c installation file available (LINUX.X64_180000_db_home.zip)

• Define Oracle Database environment variables (ORACLE_HOME, ORACLE_BASE, ORACLE_SID and so on)

Figure 5. “vagrant up” command execution.

Page 9: HOL-6394 Oracle Database 18c: Reliable DevOps … Install Oracle Linux 7.5 (64 bits) as host operating system (the lab can also run on Windows or macOS). o Install Oracle VM VirtualBox

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. 720041 US

9

• First step of the “install.sh” script is to get the Operating System packages updated to the latest releases available

Figure 6. “install.sh” script gets last updates for the OS.

• Second step of the “install.sh” script is to get “oracle-database-preinstall-18c” package installed, as requirement for

the Oracle Database 18c installation

Figure 7. “install.sh” script installs “oracle-database-preinstall-18c”.

• Third step of the “install.sh” script is the Oracle Database 18c installation

Page 10: HOL-6394 Oracle Database 18c: Reliable DevOps … Install Oracle Linux 7.5 (64 bits) as host operating system (the lab can also run on Windows or macOS). o Install Oracle VM VirtualBox

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. 720041 US

10

Figure 8. “install.sh” start the Oracle Database 18c installation.

• Fourth step of the “install.sh” script is the Oracle Database 18c listener creation

Figure 9. “install.sh” creates the Oracle Database Listener.

• Fifth step of the “install.sh” script is to create the Database

Page 11: HOL-6394 Oracle Database 18c: Reliable DevOps … Install Oracle Linux 7.5 (64 bits) as host operating system (the lab can also run on Windows or macOS). o Install Oracle VM VirtualBox

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. 720041 US

11

Figure 10. “install.sh” creates the Oracle Database.

• Sixth step of the “install.sh” script is to create the Linux service for the Oracle Database At the same time, Oracle database passwords are displayed on the output

Figure 11. “install.sh” completes the Virtual Machine deployment.

• Connect to the Virtual Machine by running “vagrant ssh” and check the Oracle Database 18c processes # vagrant ssh # sudo su – # ps -edaf |grep pmon # su - oracle -c “sqlplus / as sysdba”

Page 12: HOL-6394 Oracle Database 18c: Reliable DevOps … Install Oracle Linux 7.5 (64 bits) as host operating system (the lab can also run on Windows or macOS). o Install Oracle VM VirtualBox

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. 720041 US

12

Figure 12. Check Virtual Machine deployment result.

So, by the execution of a single command “vagrant up” we’ve been able to get:

o Latest Oracle Linux 7.5 with UEK5 kernel o Latest updates for the operating system o Oracle Database 18.3.0 installed o Oracle Database created

• Vagrant gives you also the opportunity to create one new “Vagrant Box” starting from an existing deployed one.

The convenience of this solution is related to the fact that the new Vagrant Box can, then, be re-used to add further customization steps like, for example, the application deployment. The command to get the Vagrant Box created is: # vagrant package --output mynewdatabase18c.box

The command above has to be executed within the “Vagrant Project” (folder the Vagrantfile is available).

Page 13: HOL-6394 Oracle Database 18c: Reliable DevOps … Install Oracle Linux 7.5 (64 bits) as host operating system (the lab can also run on Windows or macOS). o Install Oracle VM VirtualBox

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. 720041 US

13

This command will create a “.box” file containing all the required information for the deployment:

Figure 13. Vagrant box creation example.

NOTE: do not wait to get this step completed and proceed with the rest of the laboratory; this step is not a requirement.

CREATE SECOND VIRTUAL MACHINE BY VAGRANT AND VIRTUALBOX

The second virtual machine we’re going to deploy will start from the existing “Oracle Database 18c” we’ve created above; due to the limited time available, the same box is already available and is named “mydb18c”. Target of this example is to show that:

o It’s possible to start from an existing Vagrant Box and add further customizations o One running VirtualBox Virtual Machine can become a Vagrant Box and, by Vagrant automation, further steps can

be added o Getting a reliable and reproducible environment is very easy and, at the same time, can be easily shared

• Change directory to the second Vagrant Box, APEX-18.3.0 # cd APEX-18.3.0

• Check the Vagrantfile content to see configuration and steps that will be executed # cat Vagrantfile

Page 14: HOL-6394 Oracle Database 18c: Reliable DevOps … Install Oracle Linux 7.5 (64 bits) as host operating system (the lab can also run on Windows or macOS). o Install Oracle VM VirtualBox

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. 720041 US

14

Figure 14. Vagrantfile – APEX-18.3.0.

In the Vagrantfile above you’ll see that: o The VM will be created starting from the Vagrant Box named “mydb18c” o Port 1521 on the guest will be forwarded to port 15210 on the host (1521 on the host is already used by the other VM) o Port 5500 on the guest will be forwarded to port 55000 on the host (5500 on the host is already used by the other VM) o Port 8080 on the guest will be forwarded to port 8080 on the host

At the end of the deployment an external command will be executed on the Virtual Machine (install/script.sh). While in the first example we’ve created an Oracle Database 18c VM starting from the pure Operating System, on this example starting from the already-deployed Oracle Database 18c we’re going to get APEX (Oracle Application Express) deployed on top and, at the same time, enabling the service availability on the host.

• So, by just executing “vagrant up” we’ll get an up & running Oracle Application Express 18c. The only thing required, we’ve prepared, are:

• Get the new “Vagrant Box” created, starting from the first-one deployed

Page 15: HOL-6394 Oracle Database 18c: Reliable DevOps … Install Oracle Linux 7.5 (64 bits) as host operating system (the lab can also run on Windows or macOS). o Install Oracle VM VirtualBox

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. 720041 US

15

Figure 15. “vagrant up” command execution.

• First and unique main step of the “install.sh” script is to get Oracle Application Express deployed on the Oracle Database; all the usual manual steps are now addressed into one unique command, always the same “vagrant up”.

Figure 16. “install.sh” script deploy Oracle Application Express.

While waiting for the APEX deployment, optionally, you can also connect by “ssh” to the virtual machine and check the logs of running operations: # cd HOL6394/APEX-18.3.0 # vagrant ssh # sudo su – # cd /opt/oracle/product/18c/dbhome_1/apex/ (log path)

Page 16: HOL-6394 Oracle Database 18c: Reliable DevOps … Install Oracle Linux 7.5 (64 bits) as host operating system (the lab can also run on Windows or macOS). o Install Oracle VM VirtualBox

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. 720041 US

16

Figure 17. Oracle Application Express deployed.

So, now, the architecture that we have in place is based on: Host OS (laptop) → VirtualBox VM → Oracle Database → Oracle Application Express Architecture picture with network details could be:

Figure 35. Oracle APEX Service exposed on host laptop.

Page 17: HOL-6394 Oracle Database 18c: Reliable DevOps … Install Oracle Linux 7.5 (64 bits) as host operating system (the lab can also run on Windows or macOS). o Install Oracle VM VirtualBox

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. 720041 US

17

So, you can now open a browser and connect to the following URL, just to check that the application is reachable: # http://<vm_ip_address>:<random_redirect_port> You can get access with “admin / Welcome1” Example:

# http://localhost:8080/apex/apex_admin

Figure 36. Oracle Application Express Login Page.

SUMMARY Congratulations! You have successfully completed this Hands on Lab and started to create reliable and reproducible Oracle Database 18c environments thanks to DevOps technologies like VirtualBox, Vagrant, and Oracle Linux.

Page 18: HOL-6394 Oracle Database 18c: Reliable DevOps … Install Oracle Linux 7.5 (64 bits) as host operating system (the lab can also run on Windows or macOS). o Install Oracle VM VirtualBox

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. 720041 US

18

APPENDIX A: PREPARING THE ENVIRONMENT TO RUN THE LAB FROM YOUR HOME OR OFFICE

FIND A SUITABLE MACHINE

This appendix explains how to prepare the environment if you want to run this lab from your home or office. The first step is to find an x86 machine (server, desktop, or laptop) that has the required resources:

• At least 8 GB of RAM

• An x86 64-bit CPU (Intel or AMD) with at least four CPU threads and with virtualization extensions (Intel VT or AMD-V)—only Parallel Virtual Machine (PVM) guests are allowed on top of this architecture

• An OS supported by Oracle VM VirtualBox and Vagrant (Microsoft Windows, various Linux distributions, Oracle Solaris 10 or 11, or Apple Mac OSX)

• 100 GB of disk space Then you only need to download the required binaries, install Oracle VM VirtualBox and Vagrant on the machine.

DOWNLOAD REQUIRED BINARIES

This section lists the required binaries and explains how to download them. 1. Download the files for your x86 machine:

Oracle VM VirtualBox binaries (version 5.2.18 during writing of this document) Download the version for your OS from https://www.virtualbox.org/wiki/Downloads.

Oracle VM VirtualBox extension Pack 5.2.18 Download this from https://www.virtualbox.org/wiki/Downloads (the same file is used for all operating systems).

2. Download Vagrant for your platform:

Vagrant Binaris 2.5 Download this from https://www.vagrantup.com

Page 19: HOL-6394 Oracle Database 18c: Reliable DevOps … Install Oracle Linux 7.5 (64 bits) as host operating system (the lab can also run on Windows or macOS). o Install Oracle VM VirtualBox

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. 720041 US

19

INSTALL ORACLE VM VIRTUALBOX AND VAGRANT

1. Install the Oracle VM VirtualBox 5.2.x binaries on your x86 machine. 2. Start the Oracle VM VirtualBox console. 3. Go to File-> Preferences-> General-> Default Machine Folder and choose the folder you want to use to store the

virtual machines files. 4. Go to File-> Preferences-> Extensions and install the Oracle VM VirtualBox extension Pack you downloaded. 5. Install the “Vagrant” binary on your OS.

Page 20: HOL-6394 Oracle Database 18c: Reliable DevOps … Install Oracle Linux 7.5 (64 bits) as host operating system (the lab can also run on Windows or macOS). o Install Oracle VM VirtualBox

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. 720041 US

20

APPENDIX B: REFERENCES

Oracle VM VirtualBox Documentation: https://www.virtualbox.org/wiki/Documentation Oracle Linux 7 Documentation: https://docs.oracle.com/cd/E52668_01/index.html Vagrant Documentation: https://www.vagrantup.com/docs/

Oracle Linux Blog – From Zero to Docker sandbox in 2 minutes: https://blogs.oracle.com/linux/from-zero-to-docker-sandbox-in-2-minutes GitHub References: https://github.com/oracle/vagrant-boxes In addition, this hands-on-lab document is available at the following website:

https://blogs.oracle.com/scoter/