Install Oracle 12c on CentOS 7 – Part II

Note: This tutorial is just for installing/testing Oracle for personal purposes. If you are installing for some production environments, consult expert advice. This is a second part of two part blog on how to install Oracle 12c on CentOS 7. First part can be found here
Now create a user ‘oracle’ and groups ‘dba’ and ‘oracle’.
Then login into GUI using user ‘oracle’. Get the Oracle pre-requisites repo for their website. After setting up the repo, issue the command: Open the ‘terminal’ and go to the path where you have downloaded the Oracle 12 downloads
When you get the below GUI, un-tick the check box and proceed further. Follow the snapshots.
Figure 1

Figure 2

Your choice for Desktop or Server class. My choice is server class as I wanted to understand the different options.
Figure 3

Figure 4

Figure 5

Figure 6

Figure 8

As we are installing for development/testing purposes, ignoring few pre-requisites won’t matter.
Figure 9

Figure 10

Figure 11

Database creation in progress.
Figure 13

Your database details:
Figure 14

On hitting the “Password Management” in the above screen you will get this screen. Change passwords of users you want to.
Figure 15

Figure 16

We are done here installing Oracle! Now small tips. You can setup your centOS7 to start at run level 3. Refer THIS. Now with VirtualBox, you can use VBoxManage and VBoxHeadless to manage and run Virtual Machines from terminal and in background. And, install or enable SSH on your CentOS server. Refer THIS So if you have your own LAN set up. Go to network settings for this machine in VirtualBox and choose “Bridged Adapter”
Network Settings
Network Settings
To see all options of VBoxManage, hit enter after tying in VBoxManage on terminal. Now we can see that, it has listed two VM’s for me. We need CentOS7_X64. Now we will start it using VBoxHeadless. Now, get IP of your VM. And do this Set up your shell login script like below. Now logout and login again. And start your database and listeners: If port 1521 is open in firewall, then you can connect to this database from anywhere in your LAN. To shutdown database and CentOS server:

Set up local mirror of manual

I am building websites and at times I want to remain disconnected from the internet, but still want to keep looking at PHP, Javascript, jQuery or Bootstrap documentation. So here is what I do to refer documentation even when I am not connected to the internet.

What we can do is mirror the official website on our local system. The instructions are there on PHP site on how to set up official mirrors. But these official mirrors have everything, Downloads, etc. Basically a whole copy of, content that we do not need. We only need manuals. So we can set up the unofficial mirror on our local web server.

The instructions to create an official mirror for are here ->
I have modified the rsync command to meet the my requirement of downloading only the english manuals, and exclude as many things as possible. Create a shell script for it. This shell script can be used in cron to schedule a refresh with main site.
Change the variables at the start of the script to suit your system. Get the correct RRN for you from rsync distribution plan and set YOUR_RRN_HOSTNAME correctly.
localPath should be set to where you want to keep the mirror. This should also be your web directory. In the rsync command ‘manual/en‘ is for downloading English manuals. Change this to suit your language preference.
You can see at line 17, I have a sed command. This comments out the contents of .htaccess after downloading it from PHP site. The reason is that commands in it Order allow, deny are not compatible with Apache version I have on my system. I will update the post when I work on the alternative.

Now that we have got all the files required for mirroring PHP site, time to create Apache VirtualHost for this mirror. You can get the VirtualHost file provided by from the instructions about mirroring the site, link is above in this post. I am using openSuSE and in it all custom VirtualHost files are kept at /etc/apache2/vhosts.d. Check this for your system. Here is my VirtualHost file. The changes I did to make mirror work on my system are
  • Line 02: Put in actual path where site have been downloaded to. This will be localPath in the script above.
  • Line 08: Local URL of the site.
  • Line 09: We are not creating official PHP mirror site, so comment this out.
  • Line 10: Give your server admin email.
  • Line 14: Again put in actual path where site have been downloaded to. This will be localPath in the script above.
  • Line 17-18: I have commented logging as it is already configured for my Apache server. If you wish to, change the path where you want logs to be maintained.
Everything done, the mirror should be working now.
Note: The URL of the manuals will be your SITE_URL/manual/en. SITE_URL local server address to location where you have downloaded the files Here is a snapshot from my system
Working PHP unofficial mirror
Working PHP unofficial mirror

Install Oracle 12c on CentOS 7 – Part I

This is a first part of two series blog on installing Oracle 12c on CentOS 7. First part is about installing CentOS 7 on Virtualbox. In second part we will be installing Oracle 12c on that CentOS machine.

You can download CentOS 7 from Download DVD ISO or “Everything ISO”. If you downloading DVD ISO, downloading only Part 1 will be sufficient. We would not need Part 2.

For Oracle 12c You will need to have a userid on Oracle and also need to accept the OTN License before allowed to download the files. For Oracle 12c, the downloads are in two parts. Download both of them.

Assumption:Virtual Box is already installed, up and running with guest editions and extensions installed

First on the VirtualBox main window, create a new Virtual Machine. Here is the screen shot of the first window when creating a new virtual machine.
Image 1
Step 2: Put in RAM you want your virtual machine to have. As it will be running an Oracle server, I have set it as 1024 MB/1 GB VBox2 Step 3: The virtual machine will need a virtual hard disk, so create one. VBox3 Step 4: Choose your HD type. I only use Virtualbox, so leaving the default option as it is. VBox4 Step 5: Choosing “Dynamically allocated” here, as I do not want to unnecessary wastage of my HD. You can choose “Fixed size” if you want faster speed. VBox5 Step 6: Choose your HD size, 30GB has proven sufficient for me till now. Hit Create and your VM will be ready for use. VBox6 Step 7: Now, in Machine -> Settings -> Storage, mount your downloaded ISO image on Controller IDE -> Storage by clicking on the drop down as shown in the image below. With CentOS 7, there are two ISOs. Mount the first ISO, second ISO is not used for installation. VBox_iso Step 8: On the main Virtualbox window, click on Start. After a few seconds you will be booted on the to the below welcome screen. Choose your Language/Locale and then “Continue”. CentOS1 Step 9: Check your settings on next screen and then “Begin Installation”       CentOS2 Step 10: On the configuration screen, set up your “root” password. Linux guys will know how important “root” password is. For Windows audience: “Set up your root password and remember it. It’s like an Administrator account on windows, but with much greater powers, and is NEVER used to log-in to GUI or being used as any other user on the system”. CentOS3 Step 11:  Setting up my user. CentOS4 Step 12: Now my configuration screen shows Root password is set and User details are also set. And system is being installed. CentOS5 Step 13: System installation in progress….   CentOS6 Step 14: License is not accepted.. so click on the icon or text… CentOS7 Step 15: Accept the license and “Done” CentOS8 Step 16: After the system instllation is done, you will be taken to the login screen, where you can see the user you had created in Step 11. Click on it and… CentOS9 Step 17: Enter password. CentOS10 Step 11: Voila you are logged in! CentOS12 Here our installing CentOS 7 on VirtualBox is complete. In next tutorial we will be installing Oracle 12c on this Virtual CentOS 7. Part II is live now:

PHP with Oracle

I am personally working on a Project, that has web UI having Apache server, PHP on server side and Oracle as database. For this I need to configure PHP so that it can talk to my Oracle database. The first error I got while querying the database using PHP was. For this, we need to first install php5-pear and then using pecl, we need to install OCI8. As I am using openSUSE 13.2 Then install OCI8 extension for PHP This will install and compile oci8 module. This command will ask for ORACLE HOME location. If everything goes fine, this will end like Add the line to your /etc/php/apache2/php.ini and /etc/php/cli/php.ini Then restart Apache server After this when I tried to access Oracle, I got the error “Call to undefined function oci_connect()” again! When I checked in /var/log/apache2/err_log, I found this: So even though the file is present at $ORACLE_HOME/lib, I still get this error. To get over this error, we need two more steps. Create a file /etc/ and add this line it: and run “ldconfig”. Restart your Apache server again, and this time things should work!
The migration of the site is complete with SEO friendly URLs back in action. I know this is a very long time for site migration, but this was due to severe time constraints I am facing because of professional and personal commitments. Hope to start blogging in full steam soon.