Installing Standalone Oracle Http Server 12c (12.1.0.3) on Windows 2012 R2

We’re in the middle of replacing an old Fujitsu server running Windows 2003 R2, that was reliably humming for the last 6+ years, with the new one, running Windows 2012R2. One of the things that we decided to install on new server is Oracle Http Server 12c (12.1.0.3). Based on my previous experience, I knew I’ll have to deal with the crappy Oracle distribution of Apache Http server again. The only question was, is it possible to pack and distribute Apache Httpd in creepier form than before (11g), is it possible to surpass end user experience and joy installing and configuring Standalone Oracle Http Server 12c (12.1.0.3). Oracle, again, didn’t disappoint us ;-(. Let’s begin…

Download Oracle Http Server 12c (12.1.0.3) from edelivery.oracle.com:

->"Oracle Fusion Middleware" 
->-> "Microsoft Windows x64 (64-bit)" 
->->-> "Oracle Fusion Middleware 12c Media Pack" 
->->->-> "Oracle Fusion Middleware 12c (12.1.3.0.0) HTTP Server for Microsoft Windows x64 (64-bit)" -- Part Number: V45207-01, 471MB

Unpack zip file and begin installation by running setup_fmw_12.1.3.0.0_ohs_win64.exe. Fortunately, Oracle Http Server 12.1.0.3 is certified on Windows 2012 R2, so you should be fine…here’re the screenshots from our installation:

OracleHTTP-12c-01

OracleHTTP-12c-02

OracleHTTP-12c-03

OracleHTTP-12c-04

OracleHTTP-12c-05

OracleHTTP-12c-05-1

OracleHTTP-12c-06

OracleHTTP-12c-07

OracleHTTP-12c-07-1

OracleHTTP-12c-07-2

OracleHTTP-12c-07-3

OracleHTTP-12c-07-4

OracleHTTP-12c-08

As you can see on the last screen, we’re not finished, we need to use Configuration wizard to create a “domain” and then start “Node Manager” and “Domain server”… — WTF — why we need to know anything about Weblogic Node Manager, Domain Servers, and other “weblogic parlance”…?? Oracle architects and developers, you should KISS more! ;-). Don’t forget, we’re talking about standalone Oracle Http Server which is not much more than minuscule Apache Httpd with some small proprietary code (mod_plsql…). Anyway, let’s continue…

Start configuration wizard (in our case it was located here: C:\ORACLE\OFM\OFM12\oracle_common\common\bin\config.cmd) and configure Oracle Http server in standalone mode…as you can see we left more or less everything at default:

FM-12c-configuration-01

FM-12c-configuration-02

FM-12c-configuration-03

FM-12c-configuration-04

FM-12c-configuration-05

FM-12c-configuration-06

FM-12c-configuration-07

FM-12c-configuration-08

FM-12c-configuration-09

The fun is not over yet. Your journey to the wonderland of Oracle Http server just started. If you check “Services”, you’ll (of course) find nothing, because Oracle didn’t bother to do this during configuration, it’s up to you to create service for Node Manager.

Steps for creating Windows Service for Node Manager:


Note that we installed Oracle  HttpServer 12c in ORACLE_HOME: C:\ORACLE\OFM.

1) Open command prompt (cmd) wit "Run as Administrator"

set DOMAIN_HOME_BIN=C:\ORACLE\OFM\OFM12\user_projects\domains\base_domain\bin
set PATH=%DOMAIN_HOME_BIN%;%PATH%

installNodeMgrSvc.cmd

And if everything has gone well you should see a new service named the
Oracle way, like this:

"Oracle Weblogic base_domain NodeManager (C_ORACLE_OFM_OFM12_wlserver)"

with path to executable like this:

C:\ORACLE\OFM\OFM12\wlserver\server\bin\wlsvcX64.exe

The service is installed using the default Node Manager listen port (5556).
By default Node Manager Listens only on localhost.

If you’re not yet familiar with OracleHttp server you might think that starting Node manager will also start Oracle Http server you created previously – remember, after all, our main goal from the start is to run Http server. But no, Oracle product managers believes that you need to suffer a bit more….

You can START Oracle HttpServer 12c on command line with:


set DOMAIN_HOME_BIN=C:\ORACLE\OFM\OFM12\user_projects\domains\base_domain\bin
set PATH=%DOMAIN_HOME_BIN%;%PATH%
startComponent ohs1

You’ll be asked to enter password for the Node Manager which you entered on screen 6 of Oracle Fusion Middleware Configuration Wizard.

You can STOP Oracle HttpServer 12c on command line with:


set DOMAIN_HOME_BIN=C:\ORACLE\OFM\OFM12\user_projects\domains\base_domain\bin
set PATH=%DOMAIN_HOME_BIN%;%PATH%
stopComponent ohs1

If you want to avoid entering password each time you start OHS, you can ask Oracle to save the password in local encrypted file with parameter storeUserConfig:

set DOMAIN_HOME_BIN=C:\ORACLE\OFM\OFM12\user_projects\domains\base_domain\bin
set PATH=%DOMAIN_HOME_BIN%;%PATH%
startComponent.cmd ohs1 storeUserConfig

Creating the key file can reduce the security of your system if it is not kept in a secured location after it is created. Creating new key...
The username and password that were used for this WebLogic NodeManager connection are stored in C:\Users\alesk.ACME\.wlst\nm-cfg-base_domain.props and C:\Users\alesk.ACME\.wlst\nm-key-base_domain.props.
Connecting to Node Manager ...
Successfully Connected to Node Manager.
Starting server ohs1 ...
Successfully started server ohs1 ...
Successfully disconnected from Node Manager.

What if you want to change username and password that is used to authenticate to Node Manager which we entered in step 6 of Configuration Wizard?
Checkout MOS note 1945039.1 “How to Change the Node Manager Username and Password for Oracle HTTP Server 12c in a Standalone Domain”

Basically what we did was:

1) Stop Http Server and Node Manager

C:\ORACLE\OFM\OFM12\oracle_common\common\bin>stopComponent ohs1

Open cmd with "Run as Administrator" and stop NodeManager service:

net stop "Oracle Weblogic base_domain NodeManager (C_ORACLE_OFM_OFM12_wlserver)"

2) Invoke WLST offline:

C:\ORACLE\OFM\OFM12\oracle_common\common\bin>wlst.cmd

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

wls:/offline>

3) Read in the domain (make sure you type / and not \ in the path!!)

wls:/offline> readDomain('C:/ORACLE/OFM/OFM12/user_projects/domains/base_domain')

4) Get the security MBean (Mr. Bean?):

wls:/offline/ohs_domain> cd('/SecurityConfiguration/base_domain')

5. We changed the NM user name, but you can skip this, if you only want to change the password:

wls:/offline/base_domain/SecurityConfiguration/base_domain>set('NodeManagerUsername','<new_NM_Username>')

...and my command was:

wls:/offline/base_domain/SecurityConfiguration/base_domain>set('NodeManagerUsername','weblogic')

6. We also changed NM password. In our case the encrypted password was stored in 
   C:\ORACLE\OFM\OFM12\user_projects\domains\base_domain\config\nodemanager\nm_password.properties.

wls:/offline/base_domain/SecurityConfiguration/base_domain>set('NodeManagerPasswordEncrypted','oursecretpassword')
wls:/offline/base_domain/SecurityConfiguration/base_domain>updateDomain()
wls:/offline/base_domain/SecurityConfiguration/base_domain>closeDomain()
wls:/offline/base_domain/SecurityConfiguration/base_domain>exit()

7. Start Node Manager Service

net start "Oracle Weblogic base_domain NodeManager (C_ORACLE_OFM_OFM12_wlserver)"

8. Start OHS

C:\ORACLE\OFM\OFM12\user_projects\domains\base_domain\bin> startComponent ohs1

If you already stored your password in a key store you have to delete cached key store file
(check your user profile directory) before restarting OHS component! 

And finally, let’s see where’re the config files for httpd and mod_plsql. According to Oracle Http 12c documentation there’re runtime and staging config files and we should always edit staging config files.
In our example the config file locations are (note that marvel.conf was created by us):


Domain home bin        : C:\ORACLE\OFM\OFM12\user_projects\domains\base_domain\bin
httpd.conf             : C:\ORACLE\OFM\OFM12\user_projects\domains\base_domain\config\fmwconfig\components\OHS\ohs1 
marvel.conf (mod_plsql): C:\ORACLE\OFM\OFM12\user_projects\domains\base_domain\config\fmwconfig\components\OHS\ohs1\mod_plsql\marvel.conf
include for marvel.conf: C:\ORACLE\OFM\OFM12\user_projects\domains\base_domain\config\fmwconfig\components\OHS\ohs1\moduleconf\plsql.conf

There is also a WLST tool (wlst.cmd) that allow us to manipulate with running OHS. Let’s see…

Using WLST to control OHS:


Open WLST C:\ORACLE\OFM\OFM12\oracle_common\common\bin\wlst.cmd:

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

wls:/offline> nmConnect('weblogic','mysecretpassword','localhost','5556','base_domain','C:/ORACLE/OFM/OFM12/user_projects/domains/base_domain','ssl')

// status
wls:/nm/base_domain> nmServerStatus(serverName='ohs1', serverType='OHS')

RUNNING

// soft restart
wls:/nm/base_domain> nmSoftRestart(serverName='ohs1', serverType='OHS')

// stop OHS
wls:/nm/base_domain> nmKill(serverName='ohs1', serverType='OHS')
Killing server ohs1 ...
Successfully killed server ohs1

// status
wls:/nm/base_domain> nmServerStatus(serverName='ohs1', serverType='OHS')

SHUTDOWN

// start
wls:/nm/base_domain> nmStart(serverName='ohs1', serverType='OHS')

** Edit March 2017 **
I needed a user friendly cli interface for controlling the OHS via “wlst.cmd” scripting environment for my client the other day and since wlst is controlled by Jython it was trivial to write simple python script that offers menu for basic actions, like start, stop and status.

# controlOHS.py
# Usage:
# C:\ORACLE\OFM\OFM12\oracle_common\common\bin\wlst.cmd  controlOHS.py
#
pwd = None
nmConnect('administrator',pwd,'localhost','5556','base_domain','C:/ORACLE/OFM/OFM12/user_projects/domains/base_domain','ssl')

def menu():
   print("")
   print("Available commands:")
   print("==========================================")
   print("1) softRestart     ....soft restart of OHS")
   print("2) stopOHS         ....stop OHS server")
   print("3) startOHS        ....start OHS server")
   print("4) statusOHS       ....status of OHS server")
   print("5) help            ....print this help")
   print("6) Exit            ....exit")
   print("==========================================")
   print("")

def softRestart():
   print("Soft restart...")
   nmSoftRestart(serverName='ohs1', serverType='OHS')

def stopOHS():
   print("Stop OHS....")
   nmKill(serverName='ohs1', serverType='OHS')
 
def startOHS():
   print("Start OHS...")
   nmStart(serverName='ohs1', serverType='OHS')
   
def statusOHS():
   print("Status...")
   nmServerStatus(serverName='ohs1', serverType='OHS')

while 1:  # endless loop
   menu()
   command = raw_input("Command [1..6]: ")
   
   if command == "1":
	  softRestart()
   elif command == "2":
	  stopOHS()
   elif command == "3":
	  startOHS()
   elif command == "4":
      statusOHS()
   elif command == "5":
	  menu()
   elif command == "6":
	  break
   else:
      print("Invalid choice!")
	   
   raw_input("Press Enter to continue...")

Posted on 13.02.2015, in Oracle and tagged . Bookmark the permalink. Comments Off on Installing Standalone Oracle Http Server 12c (12.1.0.3) on Windows 2012 R2.

Comments are closed.