Ajeet Raina Docker Captain, ARM Innovator & Docker Bangalore Community Leader.

Automating Oracle Weblogic Server installation through shell script

2 min read

Automation always saves your considerable time. Especially when you have to follow the similar step for hundreds of machine, automated scripts and tools have always been a great weapon for system administrators.Today I spent considerable time to setup Weblogic Server 10.3.6 on my CentOS 7.0 machine through shell script. This unattended script uses autoexpect rather than silent.xml or WLST as suggested by Oracle. Let me share the steps I followed to deploy the Weblogic Server:

Ensure you have the following software in place downloaded from Oracle Website.We can’t use wget for this as it requires Oracle Login for downloading these pieces of software.

Links for Software Downloads:

a. Download jdk-7u67-linux-i586.gz from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
b. Download wls1036_dev.zip from http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-main-097127.html

Once you download the above software, create a directory called /softwaretmp/ and download the above software into this directory:

#mkdir /softwaretmp/

#cd /softwaretmp/


2. Create an empty file called prepare.sh and paste the following shell script (shown below):

echo “Checking if WebLogic Server is already runing. If its running, stopping it and reinstalling it from scratch”
pkill -9 java
pkill -9 Weblogic
rm -fr /u01/oracle/wlsdomains/base_domain
rm -fr /u01/oracle/fmw/wlserver_10.3
rm -fr /u01/jdk/jdk7
pkill -9 java
echo “Initializing the Installation”
groupadd orainstall
useradd -g orainstall oracle
mkdir -p /u01/jdk
cd /u01/jdk
tar -zxvf /softwaretmp/jdk-7u67-linux-i586.gz
ln -s jdk1.7.0_67 jdk7
mkdir -p /u01/oracle/fmw/wlserver_10.3
cp -rf /softwaretmp/wls1036_dev.zip /u01/oracle/fmw/wlserver_10.3/
echo ”
MW_HOME=/u01/oracle/fmw/wlserver_10.3; export MW_HOME
JAVA_HOME=/u01/jdk/jdk7; export JAVA_HOME
” >> ~/.bash_profile
cd ~
. ./.bash_profile
cd /u01/oracle/fmw/wlserver_10.3
unzip wls1036_dev.zip
. $MW_HOME/wlserver/server/bin/setWLSEnv.sh
mkdir -p /u01/oracle/wlsdomains
cp -rf /softwaretmp/script.exp /u01/oracle/fmw/wlserver_10.3/wlserver/common/bin/
cd /u01/oracle/fmw/wlserver_10.3/wlserver/common/bin
echo ” Expect Script is well run”
cd /u01/oracle/wlsdomains/base_domain/
mkdir -p servers/AdminServer/security
mkdir -p servers/managedserver_1/security
cd servers/AdminServer/security
” >> boot.properties
cd /u01/oracle/wlsdomains/base_domain/servers/managedserver_1/security
” >> boot.properties
echo ” Weblogic Server 10.3.6 Configuration is all done !!”
echo “Starting the Weblogic Server”
cd /softwaretmp/

3. You need to add two more scripts to the /softwaretmp directory:

Create a empty file called startweblogic.sh and paste the below content:

#!/usr/bin/expect -f
cd /u01/oracle/wlsdomains/base_domain/bin/
spawn ./startWebLogic.sh
expect “Enter username to boot WebLogic server: ”
send “weblogic\r”
expect “$ ”
expect “Enter password to boot WebLogic server: ”
send “Oracle9ias\r”
expect “$ ”
send “exit\r”

Also, create another empty file called startManagedServer.sh and paste the below lines:

#!/usr/bin/expect -f
cd /u01/oracle/wlsdomains/base_domain/bin/
spawn ./startManagedWebLogic.sh managedserver_1
expect “Enter username to boot WebLogic server: ”
send “weblogic\r”
expect “$ ”
expect “Enter password to boot WebLogic server: ”
send “Oracle9ias\r”
expect “$ ”
send “exit\r”

Save the file.

4. Now comes the important step. You need to create script.exp file through series of steps. You can always create script.exp through the following steps:

a. Ensure that the autoexpect software through the following command:

#yum install autoexpect

b. Start the autoexpect tool through the following command:

#autoexpect -s

It will output that autoexpect has already initiated and will be saved under script.exp

c. Now run the following command under /u01/oracle/fmw/wlserver_10.3/wlserver/common/bin

#cd /u01/oracle/fmw/wlserver_10.3/wlserver/common/bin


Follow the general steps for selecting the right options as per your infrastructure.

Once completed, ensure you run the following command:


autoexpect stopped.

Once you have completed the above steps, a script.exp gets created which has to be copied to /softwaretmp directory.

Still finding difficulty? Post your questions at https://collabnix.com/forum

Have Queries? Join https://launchpass.com/collabnix

Ajeet Raina Docker Captain, ARM Innovator & Docker Bangalore Community Leader.

10 Replies to “Automating Oracle Weblogic Server installation through shell script”

  1. Someone essentially help to make seriously posts I would state. This is the first time I frequented your website page and thus far? I amazed with the research you made to make this particular publish incredible. Great job!

  2. Just want to say your article is as astonishing. The clearness in your publish is simply nice and i could think you are a professional in this subject. Fine together with your permission allow me to grab your RSS feed to stay up to date with coming near near post. Thanks a million and please continue the enjoyable work.

  3. Very nice post. I simply stumbled upon your weblog and wished to mention that I have really enjoyed surfing around your blog posts. In any case I will be subscribing on your feed and I’m hoping you write once more soon!

Leave a Reply

Your email address will not be published.