Automating Oracle Weblogic Server installation through shell script

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
b. Download from

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 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/ /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
. $MW_HOME/wlserver/server/bin/
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
” >>
cd /u01/oracle/wlsdomains/base_domain/servers/managedserver_1/security
” >>
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 and paste the below content:

#!/usr/bin/expect -f
cd /u01/oracle/wlsdomains/base_domain/bin/
spawn ./
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 and paste the below lines:

#!/usr/bin/expect -f
cd /u01/oracle/wlsdomains/base_domain/bin/
spawn ./ 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

Please follow and like us:

Leave a Reply to Anonymous Cancel reply

Your email address will not be published. Required fields are marked *