Some time ago I decided to take a look at virtualbox. After using some downloadable appliances I decided to install one for myself from scratch to have it configured just the way I want. This blog describes what I did to achieve this. I am still quit pleased with virtualbox. Somebody pointed out to me that the CPU Utilization is quit high though. Some browsing on the internet and looking in the manual gave me the solution. I will talk about this later.
Installing virtualbox is very simple. Just download the installer and run it. Follow the wizard and do a next/next/finish installation. If you have a dual core PC or laptop (who hasn’t nowadays) please have a look at the end of this blog…. You might have to do some additional settings.
Installing Oracle Enterprise Linux is also very simple. First I created an empty virtual machine with a single disk of at least 15 Gb. I selected two processors and switched on all virtualization acceleration as my hardware supports that. I both tried the PIIX3 and ICH9 chipset. I could install OEL with both only with PIIX3 OEL actually booted. In total these settings resulted in a 10-20% CPU utilization when my guest is idle. Not great but acceptable. (I started with >50% with only one CPU)
Before you can install OEL you have to mounted the OEL R5U5 DVD iso as a DVD drive and start the virtual machine.
I run my virtual disks from an external eSATA disk so that’s why the DVD drive is created under the SATA Controller. First I mounted the OEL DVD iso as an IDE drive. Although the installation program initially ran it somewhere lost it and did not want to continue anymore asking me to insert the OEL installation DVD over and over again. So I created a new DVD drive under the SATA Controller and then it worked. The OEL installation program found the disk, formatted it and installed OEL on it. Again a next/next/finish installation. There is a very nice article on the installation process if you follow this link. I suggest you enter the hostname manually otherwise one is picked for you. After the installation this can be changed by changing the HOSTNAME property in the /etc/sysconfig/network file.
After accepting the terms the OEL desktop opened asking for my credentials. The first thing you have to do is add a linux kernel parameter. You need to do this to descrease the CPU usage of the virtualbox process in Windows. Open the file /boot/grub/grub.conf
file. Look for the kernel line, it will look like:
kernel /vmlinuz-2.6.18-194.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
add “divider=10” to this line:
kernel /vmlinuz-2.6.18-194.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet divider=10
I assigned only one core (CPU) to my virtual machine. In windows task manager you can force the use of one CPU by setting the affinity to one CPU. Below here you can see the CPU Utilization before and after. Before the utilization when the guest is idle is between 10 – 50% (1 complete core). Afterwards the utilization is about 5-10%.
CPU Utilization with default settings (Orange line is virtualbox process in windows)
CPU utilization after optimization (Orange line is virtualbox process in windows)
You can also add the nmi_watchdog parameter to switch watchdog off. Otherwise you get a warning during startup. Although this is nothing serious it looks better when this warning is gone.
The second thing I did was installing the virtualbox extensions mounted under /media. Unfortunatelly the error “unable to find the sources of your current Linux kernel. †was raised.
This meant some source packages were missing. Browsing the internet I found out these were:
- gcc
- kernel-devel-2.6.18-194.el5
- kernel-xen-devel-2.6.18-194.el5
When I tried to retrieve and install them using yum nothing happened. Oracle does not allow you to do this when you haven’t registered your installation and have no maintenance contract with them.
On the internet I read about the existence of a public OEL repository you can use. Here is what I did:
- Retrieve the yum configuration file
# cd /etc/yum.repos.d
# wget http://public-yum.oracle.com/public-yum-el5.repo - Enable the appropriate repository by editing the yum configuration file
a.  Open the yum configuration file in a text editor
b. Locate the section el5_u5_base
c.  Change enabled=0 to enabled=1
Now when I used yum to install the earlier mentioned packages it all worked:
To be sure I set the KERN_DIR system variable to /usr/src/kernels/2.6.18-194.el5-i686 and when I run the virtualbox extensions again it all works. The first part of my installation is finished.
I am using NAT with port forwarding to connect to services running on my guest system. This is the default network setting for virtualbox. All services on my guest system will be accessible on my windows 7 host through localhost. The IP address assigned to my guest system is always 10.0.2.15. Although assigned by DHCP it will always assign this address.
To the /etc/hosts file I have added the following entry:
10.0.2.15Â Â new-host-2.domain.local new-host-2
You could also use a Bridged network. There are some disadvantages when using bridged. You always need a network connection and you will run into trouble when you switch networks as your guest system will be assigned a different ip address. Some applications (like oracle DB) do not startup anymore. Or when you are running licensed software this sometimes checks the ip address you used when you installed the software and will not work anymore when the ip is different.
Installing oracle
First I created a separate file system for oracle mounted as /opt/oracle so all my oracle software is seperate from my root system. I combined information from two articles: the first on adding an additional disk on virtualbox. The first article missed some vital information on creating partitions. This is supplemented by the second article. In short I did the following:
- run fdisk:
# fdisk /dev/sdb  (With # fdisk –l you can check the name of your newly created device, in my case this was /dev/sdb) - create a new partition:
Enter n in the list to select new partition,next select primary, 1 (partition number) and leave the rest default (enter) - save partition table:
Enter w in the list/menu. - format  new disk:
# mkfs -t ext3 /dev/sdb1Â Â Â Â (1 for the partition number) - create /opt/oracle directory
- update etc/fstab with:
/dev/sdb1              /opt/oracle                  ext3   defaults       0 0
- Mount the disk by calling: mount /opt/oracle   (or reboot)
- Check if the new disk is there: # df –T
Your output should look like:
[root@new-host-3 apps]# df –T Filesystem   Type  1K-blocks     Used Available Use% Mounted on /dev/mapper/VolGroup00-LogVol00 ext3   11109328  2226776  8309112 22% / /dev/sda1    ext3     101086    12055    83812 13% /boot tmpfs       tmpfs    1037732        0  1037732  0% /dev/shm SharedFolders vboxsf 124930044 40895064 84034980 33% /SharedFolders /dev/sdb1    ext3   30961664   176200 29212704  1% /opt/oracle
For the installation of oracle 11gr2 itself I used the oratoolkit. This really works like a charm, installing oracle becomes like a walk in the park. I just followed the installation script as described on the site.
You must first disable secure linux by editing the /etc/selinux/config file, making sure the SELINUX flag is set as follows:
SELINUX=disabled
If you do not do this you might get an error later on during creation of the database:
After you have installed oratoolkit a user oracle (group oinstall) has been created. What I did was change the ownership of /opt/oracle to this user. Then I continued the process.
When you are at the stage of actually creating the database you have to alter the sbSetup-dev.cfg file and change the following parameters.
DB_NAME | old | dev |
new | orcl | |
ORACLE_HOME | old | $ORACLE_BASE/sesrv/11.1.0/db1 |
new | $ORACLE_BASE/sesrv/11.2.0/db1 | |
DATA01 | old | /data01/rdbms/${DB_NAME} |
new | /opt/oracle/sesrv/11.2.0/oradata/${DB_NAME} | |
DATA02 | old | /data01/rdbms/${DB_NAME} |
new | /opt/oracle/sesrv/11.2.0/oradata/${DB_NAME} | |
UTL | old | /data01/utl/$DB_NAME |
new | /opt/oracle/sesrv/11.2.0/oradata/utl/$DB_NAME | |
NCHARACTER_SET | old | UTF8 |
new | AL32UTF8 | |
LISTENER_PORT | old | 1531 |
new | 1521 |
Make sure you at least select the correct national character set! For OSB and SOA Suite this needs to be AL32UTF8. A second remark concerns the location of the Oracle data files. If you leave the data01/02 and the UTL directory to its defaults your database will not be created on the new file system but on the root.
Installing Oracle Service Bus 11gR2
Installing OSB is pretty straight forward. I just followed the instructions from the oracle documentation starting here.
On thing I encountered was the following. In the manual you can read the following:
After installing the Oracle 11g database, you must complete the following steps:
- Log in to the database as the
sys
(default) user.- Run the following scripts:
alter system set session_cached_cursors=100 scope=spfile;
alter system set processes=500 scope=spfile;- Bounce the database and continue with the installation of Repository Creation Utility (RCU) and loading of schemas.
When you do this you might get the error there is no spfile. You can create one in sqplus:
SQL> CREATE SPFILE FROM PFILE;
In short I did the following:
- Created a new linux user/group:  soa/soa  (I always use oracle as password)
Created /opt/oracle/middleware directory owned by soa - Do a
chmod 777 -fR
on the /opt/oracle/oraInventory directory. It is a little radical but you need write permissions on this folder otherwise you cannot do the next installment. - Downloaded, unpacked and installed weblogic server 10.3.3.
- Unpacked the Repository Creation Utility (RCU) and created tablespaces/Schemas
Metadata Services:ÂDEV_MDS/oracle (oracle=password)
SOA Infrastructure:DEV_SOAINFRA/oracle
User Messaging Service:ÂDEV_ORASDPM/oracle
Business Act. Monitoring:DEV_ORABAM/oracle
You can get the error when you try to startup ./rcu : xlib connection to 0.0 refused by server. See here on how to solve this. - I did some pre-installation tasks:
1. Installed a missing linux package:yum install compat-db –y
2. Added number of open files by editing /etc/security/limits.conf:
soa soft nofile 4096
soa hard nofile 4096 - Unpacked and installed the OSB software:
./runInstaller -jreLoc /opt/oracle/middleware/jdk160_18/jre
Now we continue with the configuration part of the installation:
- Use config.sh to generate a domain with (at least) the following selected extensions:
1. Oracle Enterprise Manager
2. OSB Extension: All domains Topologies
I selected the all domain topologies as I want my osb to run on a (non-clustered) seperate managed server. I named my domain: soa_domain and the machine soa_machine. I entered the hostname as the ListenAddress for my servers. Later on this hostname will be mapped in windows to localhost/127.0.0.1 so when you click on the administration console link in oracle enterprise manager you will be directed correctly. - Run nodemanager for first time to generate nodemanager.properties.
Make sure you do this as user soa. You can find the startup scripts at: /opt/oracle/middleware//wlserver_10.3/server/bin/startNodeManager.sh - Change /opt/oracle/middleware/wlserver_10.3/common/nodemanager/nodemanager.properties file:
SecureListener=false
StartScriptEnabled=true
I switched off the secure communication between the adminserver and the nodemanager. There is no need for that. When you start the adminserver please do not forget to also change the default communication in the console from SSL to plain. - Copy the nodemanager script below into the /etc/rc.d/init.d directory. Make it executable (without the extension .sh!). Now you can create the startup en kill scripts by using:Â Â Â Â
chkconfig --add nodemanager
(All done as root)
#!/bin/bash # # nodemgr Oracle Weblogic NodeManager service # # chkconfig: 345 85 15 # description: Oracle Weblogic NodeManager service # ### BEGIN INIT INFO # Provides: nodemgr # Required-Start: $network $local_fs # Required-Stop: # Should-Start: # Should-Stop: # Default-Start: 3 4 5 # Default-Stop: 0 1 2 6 # Short-Description: Oracle Weblogic NodeManager service. # Description: Starts and stops Oracle Weblogic NodeManager. ### END INIT INFO # Source function library. . /etc/rc.d/init.d/functions # set Weblogic environment defining CLASSPATH and LD_LIBRARY_PATH # to start/stop various components. export MW_HOME=/opt/oracle/middleware # # Note: # The setWLSEnv.sh not only does a good job of setting the environment, # but also advertises the fact explicitly in the console! Silence it. # source $MW_HOME/wlserver_10.3/server/bin/setWLSEnv.sh > /dev/null # set NodeManager environment export NodeManagerHome=$WL_HOME/common/nodemanager NodeManagerLockFile=$NodeManagerHome/nodemanager.log.lck # check JAVA_HOME if [ -z ${JAVA_HOME:-} ]; then export JAVA_HOME=/opt/oracle/middleware/jrockit_160_17_R28.0.0-679 fi exec=$MW_HOME/wlserver_10.3/server/bin/startNodeManager.sh prog='nodemanager' user='soa' function is_nodemgr_running() { local nodemgr_cnt=`ps -elF | \ grep -i 'java' | \ grep -i 'weblogic.NodeManager' | \ grep -v grep | \ wc -l` echo $nodemgr_cnt } function get_nodemgr_pid() { nodemgr_pid=0 if [ `is_nodemgr_running` -eq 1 ]; then nodemgr_pid=`ps -elF | \ grep -i 'java' | \ grep -i 'weblogic.NodeManager' | \ grep -v grep | \ tr -s ' ' | \ cut -d' ' -f4` fi echo $nodemgr_pid } function check_nodemgr_status () { local retval=0 local nodemgr_cnt=`is_nodemgr_running` if [ $nodemgr_cnt -eq 0 ]; then if [ -f $NodeManagerLockFile ]; then retval=2 else retval=3 fi elif [ $nodemgr_cnt -gt 1 ]; then retval=4 else retval=0 fi echo $retval } start() { [ -x $exec ] || exit 5 echo -n $"Starting $prog: " su $user -c "$exec &" retval=$? echo return $retval } stop() { echo -n $"Stopping $prog: " kill -s 9 `get_nodemgr_pid` &> /dev/null retval=$? echo [ $retval -eq 0 ] && rm -f $NodeManagerLockFile return $retval } restart() { stop start } reload() { restart } force_reload() { restart } rh_status() { local retval=`check_nodemgr_status` if [ $retval -eq 0 ]; then echo "$prog (pid:`get_nodemgr_pid`) is running..." elif [ $retval -eq 4 ]; then echo "Multiple instances of $prog are running..." else echo "$prog is stopped" fi return $retval } rh_status_q() { rh_status >/dev/null 2>&1 } case "$1" in start) rh_status_q && exit 0 $1 ;; stop) rh_status_q || exit 0 $1 ;; restart) $1 ;; reload) rh_status_q || exit 7 $1 ;; force-reload) force_reload ;; status) rh_status ;; condrestart|try-restart) rh_status_q || exit 0 restart ;; *) echo -n "Usage: $0 {" echo -n "start|" echo -n "stop|" echo -n "status|" echo -n "restart|" echo -n "condrestart|" echo -n "try-restart|" echo -n "reload|" echo -n "force-reload" echo "}" exit 2 esac exit $?
- Remove debug=true from setDomainEnv.sh. If you do not do this the managed server will not start up as the adminserver is already using the debug port. Remember you need to do that every time you do a domain extension as these files are overwritten again.
- Copy the script adminserver.sh below to $MW_HOME/user_projects/domains/osb_domain. You can also copy this script to /etc/rc.d/init.d (without .sh) and create the approriate symbolic links with: chkconfig –add adminserver. The adminserver will be started during boot.
#!/bin/bash # # admsvr Oracle Weblogic AdminServer service # # chkconfig: 345 99 01 # description: Oracle Weblogic AdminServer service # ### BEGIN INIT INFO # Provides: admsvr # Required-Start: $network $local_fs # Required-Stop: # Should-Start: # Should-Stop: # Default-Start: 3 4 5 # Default-Stop: 0 1 2 6 # Short-Description: Oracle Weblogic AdminServer service. # Description: Starts and stops Oracle Weblogic AdminServer. ### END INIT INFO export DOMAIN_HOME=/opt/oracle/middleware/user_projects/domains/soa_domain exec=${DOMAIN_HOME}/startWebLogic.sh prog=startWeblogic user='soa' function is_admin_running() { local admin_cnt=`ps -elF | \ grep -i 'java' | \ grep -i 'AdminServer' | \ grep -v grep | \ wc -l` echo $admin_cnt } function get_admin_pid() { admin_pid=0 if [ `is_admin_running` -eq 1 ]; then admin_pid=`ps -elF | \ grep -i 'java' | \ grep -i 'AdminServer' | \ grep -v grep | \ tr -s ' ' | \ cut -d' ' -f4` fi echo $admin_pid } function check_admin_status () { local retval=0 local admin_cnt=`is_admin_running` if [ $admin_cnt -eq 0 ]; then retval=1 else retval=0 fi echo $retval } start() { [ -x $exec ] || exit 5 echo "nohup $exec > /dev/null 2>&1 &" echo -n $"Starting $prog: " su $user -c "nohup $exec > /dev/null 2>&1 &" retval=$? echo return $retval } stop() { echo -n $"Stopping $prog: " kill -s 9 `get_admin_pid` & > /dev/null retval=$? echo return $retval } restart() { stop start } reload() { restart } force_reload() { restart } rh_status() { local retval=`check_admin_status` if [ $retval -eq 0 ]; then echo "$prog (pid:`get_admin_pid`) is running..." else echo "$prog is stopped" fi return $retval } rh_status_q() { rh_status > /dev/null 2>&1 } case "$1" in start) rh_status_q && exit 0 $1 ;; stop) rh_status_q || exit 0 $1 ;; restart) $1 ;; reload) rh_status_q || exit 7 $1 ;; force-reload) force_reload ;; status) rh_status ;; condrestart|try-restart) rh_status_q || exit 0 restart ;; *) echo -n "Usage: $0 {" echo -n "start|" echo -n "stop|" echo -n "status|" echo -n "restart|" echo -n "condrestart|" echo -n "try-restart|" echo -n "reload|" echo -n "force-reload" echo "}" exit 2 esac exit $?
The OSB is installed and configured now. If you reboot the adminserver and nodemanager are automatically started. I usually start managed servers manually the first time and enter the credentials when asked for. You can start the managed server from the administation console from now on. Make sure you have set the communication to plain (Environment –> Machines –> soa_machine –> configuration –> Node Manager)
Connecting from outside
I want to access the adminserver and osb_server from my host. To do this you need to do a few things:
Opening firewall in Linux
# iptables -I INPUT -p tcp –dport 7001 -j ACCEPT
# iptables -I INPUT -p tcp –dport 8001 -j ACCEPT
# iptables -I INPUT -p tcp –dport 8011 -j ACCEPT
# iptables -I INPUT -p tcp –dport 5556 -j ACCEPT
# iptables -I INPUT -p tcp –dport 1521 -j ACCEPT
# iptables -I INPUT -p tcp –dport 7890 –j ACCEPT
# iptables -I INPUT -p udp –dport 9888 -j ACCEPT
# service iptables save
7890 and 9888 are ports used by coherence. You need to open them otherwise you get problems starting the osb managed server. I opened 7890 just to be sure, it could be this is not necessary. Port 8001 I already added for SOA Suite (soa_server1)
Port forwarding in Virtualbox
Secondly you have to do port forwarding in virtualbox. As you can see port 22 is mapped to 2222. This is because you are not allowed to map to ports below 1024.
Setting windows hosts
Finally you have to add the following line to your windows hosts file (windows/system32/drivers/etc):
127.0.0.1 hostname
Now you can use the hostname both on your host and guest.
Installing SOA Suite 11gR2
There is a lot of documentation on installing SOA Suite 11g. I am not going to redo this work. I did not encounter any problems. During installation of the OSB all repository schemas were already created so I could skip the repository creation part. The installation of the SOA Suite contains of two parts. You first have to install the SOA Suite 11gR1 files and update these with the SOA Suite 11gR2 installation files. Make sure you do this as user soa otherwise the files have the wrong owner.
Finally I extended the domain I created for OSB with SOA Suite extension. I added the soa_server1 to the soa_machine I already created during the OSB configuration. I did not create a BAM server. So when I started the soa_server1 and opened the enterprise manager I saw a healthy green domain.
Mission accomplished!
This ends my journey. It was fun to do. Next time I think I will use the default oracle database installer instead of oratoolkit. It works fine oratoolkit but the oracle installer should be sufficient for a standard installation. I will also have a closer look at the performance of virtualbox and perhaps install everything on vm player just to see the difference.
Problems
1. Cannot run xterminal
error(s)
- Can’t open display: xxx.xxx.xxx.xxx:0.
- xlib connection to 0.0 refused by server
Solution
- Login as root
- # xhost +
- # su – username
- # DISPLAY=:01
- # export DISPLAY1
- # run your script/start or binary that needs x1
1 You can try it without.
Roughly how long did it take to complete this configuration?
Â
Craig
Hello John,
I know I have used it before. I did this excercise just to improve my skills on installing and configuring SOA Suite and OSB on OEL. Â Futhermore I wanted to install the Oracle Database SE instead of XE. I want to do some addional database development so I needed the full database.
Demed,
I will change this.. You are right (both the versioning and the confusing about it 😉
Izaak,
Oracle provides a pre-built VM with all of the goodies you mention already installed (except possibly OSB) -Â http://www.oracle.com/technetwork/community/developer-vm/index.html
Izaak,
Nice cheatsheet! Minor update: you probably installed 11gR1 PS2 (and not 11gR2). I have to admit that our version numbering scheme is unnecessarily complex and confusing…
Hi Izaak
Clear and good topic.
One thing I always do is to create a seperate schema for the OSB reporting provider and not integrate them into the SOAINFRA schema but that’s just a choice to make…