Install Oracle Express in Amazon AWS

I took this configuration out of my installation as some of you may want to run Oracle express in Amazon for other things, the main reason that this was a little tricky is that the project software needs a constant host name and therefore the Oracle needs a little help ūüôā

Launch an instance, and connect.  You need to change the host name, to do this.

vi /etc/sysconfig/network

Change the host name line to


The network needs to be restarted

cd /etc/init.d

./network restart

Download the oracle xe express database from the Oracle web site, I have yet to figure out how to do this via a command line in Linux, so download via a web browser and then upload to the server, this can be done via the pscp.exe that is shipped with putty, there are loads of tutorials on the net that will tell you how to do this.

Once uploaded and as per usual I have created a software folder, and uploaded the rpm to this folder.

cd ~

mkdir software

You need a swap space on the server to allow Oracle to be installed this can be found at survivalguides create swap space written by yours truly.

Install Oracle XE via RPM or DEB depending on your Linux distribution

cd ~/software

service iptables stop

rpm -i oracle-xe-

Run “/etc/init.d/oracle-xe configure” to configure Oracle
Specify the HTTP port that will be used for Oracle Application Express [8080]:8080
Specify a port that will be used for the database listener [1521]:1521
Specify a password to be used for database accounts. Note that the same password will be used for SYS and SYSTEM. (* make sure you remember this password *)
Do you want Oracle Database 10g Express Edition to be started on boot (y/n) [y]: y

vi /etc/profile

Insert the following lines at the bottom

export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server



You need to run the profile to get the variables

. /etc/profile

Note the space between . /

It is also worth adding these lines to the .bashrc file in the home directory

service oracle-xe stop

Again an Amazon quirk is the localhost name so add the host name that was created at the start of the procedure to the hosts file.

vi /etc/hosts

service oracle-xe start

If you get the following error

Failed to start Oracle Net Listener using /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/tnslsnr and Oracle Express Database using /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/sqlplus.


yum -y install glibc.i686

To test that this is a connection to the database use the standard Oracle test command

tnsping xe

You can also use the sqlplus client

sqlplus sys/(password for oracle)@xe as sysdba

This should give you an SQL prompt.


This will get you out of the sqlplus client.

Once the server is restarted this will stop working, again another Amazon little gotya, this is because the IP address changes and so can the host name. To get around this you need to change the tnsnames.ora file to match the new name of the server.

vi /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/tnsnames.ora

My tns file looks like this

# tnsnames.ora Network Configuration File:

XE =

(SID = PLSExtProc)

This is a read only file so you will need to use


To save the file

You also need to change the listener.ora file as this also contains the host name of the server.

vi /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/listener.ora 

My file looks like this

# listener.ora Network Configuration File:

(ORACLE_HOME = /usr/lib/oracle/xe/app/oracle/product/10.2.0/server)
(PROGRAM = extproc)



This is a read only file so you will need to use


To save the file

You need to create the following file, to recreate the hosts file every time the server is rebooted, this will allow the oracle to work properly.

The script file I called createhostfile.ksh and the contents is

getip=`/sbin/ifconfig eth0 | grep ‘inet addr’ | awk ‘{print $2}’ | sed -e ‘s/.*://’`
rm -f /etc/hosts
echo “ localhost localhost.localdomain” > /etc/hosts
echo $newhost >> /etc/hosts

Note that I called my server project, you will need to replace this with what you have call your server.

To create the file

cd /etc

vi createhostfile.ksh

paste the script above

chmod 755 createhostfile.ksh

Now we can change the oracle-xe file that is used to start and stop oracle.

vi /etc/init.d/oracle-xe

After all of the comment insert the following line


This will call the host file creating every time that oracle is started.


One Comment on “Install Oracle Express in Amazon AWS”

  1. […] Install a Linux server and install Oracle as per the Survival Guides Install Oracle Express on Amazon AWS […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s