During the last few days I struggled with installing Oracle XE 11g on an Ubuntu VM. And with “the last few days” I mean “the last few weeks”. Sad, but true. Here is what I learned about installing Oracle XE 11g on Ubuntu. But please note that I am not a Linux specialist nor an Oracle specialist – it was my first try. And as you will see, I try to make my life as easy as possible. But let’s start with the very basics.
About Oracle XE 11g
Oracle Database Express Edition 11g (or just Oracle XE) is the free version of Oracles 11g database. It was released in 2011 and is the second free version of Oracle’s database. The first free version was Oracles XE 10g, which was released in 2005. The latest paid version of Oracle’s database is 12c, which was released in 2013.
What is really confusing is the fact that the release date of the paid versions is different from the release date of the free versions. So don’ be confused, the latest free database from Oracle is 11g.
Version | Paid | Free |
Version 9i: | 2001 | – |
Version 10g: | 2003 | 2005 |
Version 11g: | 2007 | 2011 |
Version 12c: | 2013 | – |
By the way, the i, g and c in the database names stand for internet, grid and cloud.
You can download Oracle XE from the link below – and this is where the pain begins. First of all you need an Oracle account, but this is free and easy. Then you have the choice between two packages:
- One package for Windows which only runs on a 32-bit machine as Oracle says. But don’t worry, it also runs on a 64-bit machine (like mine) and although the unzipped installation folder is called
DISK1
there is noDISK2
or something. Just run thesetup.exe
. - One package for Linux which is meant to run on a 64-bit machine as Oracle says. And here is the first pain: The package is only available as RPM so you first have to run alien on it to convert it for Ubuntu.
#1 – Installing Oracle XE by hand
My first approach was to install Oracle XE by hand. Although this seems to be the straightforward solution, it was the most painful one. You have to convert the RPM package to a DEP package, create a chkconfig
script, create some mystic kernel parameters in a 60-oracle.conf
, set your swap space to 2GB or more, create some more folders, install the DEB package, configure the database, export some environment variables like ORACLE_HOME
(are you still with me?), reload that changes and then start the Oracle service and connect via SQLPlus. Easy, isn’t it? That’s why Oracle is making so much money with consulting 😀
And how to know all this steps? Well, use Google, because the best descriptions I found are not from Oracle. To be precise, I found no official description how to setup the Oracle XE database. Here is what I found on blogs and forums. Just choose one that suits you best. They are all really good, thanks to the people who wrote this!
- https://community.oracle.com/thread/2229554
- http://meandmyubuntulinux.blogspot.de/2012/05/installing-oracle-11g-r2-express.html
- http://sysadminnotebook.blogspot.de/2012/10/installing-oracle-11g-r2-express.html
#2 – Installing Oracle XE with Vagrant and Puppet
Vagrant is a free tool to create Linux VMs automatically. This means you can run Vagrant with a simple configuration file (called Vagrantfile
) which describes a Linux VM (e.g. how many CPUs it should have or which image should be installed). Vagrant will create a VM according to this configuration and start it. This gives you the ability to create the same machine with the exact same configuration over and over again.
Puppet is a tool to orchestrate Linux machines. This means Puppet can automatically install programs, create folders or write files. You can download and use it for free. It perfectly integrates into Vagrant. So you can create a VM with Vagrant and as soon as it is ready it can be orchestrated by Puppet.
The really great thing about Vagrant and Puppet is that such scripts can be exchanged. This means that you can write a setup of scripts for something (e.g. to install Oracle XE) and share it with other people. And this is what those to guys did:
- Matthew Baldwin wrote a complete Puppet (and Vagrant) setup to install Oracle XE on CentOS (a “RPM-Linux“). You find it here on GitHub.
- Hilverd Reker wrote a complete Puppet (and Vagrant) setup to install Oracle XE on Ubuntu 12.04 (a “DEB-Linux“). You find it here on GitHub.
Both projects work the same:
- Install Vagrant, VirtualBox and Puppet
- Checkout the GitHub repository or download it as a ZIP-file
- Download the Oracle XE installation files and put it in some folder which you can read in the README.md of the projects
- Go to the root folder of the project and run
vagrant up
. This will download a Linux image, install it to a VM and do all the rest (including installing Oracle XE). Note that this will take some time depending on your internet connection! - Now you can call
vagrant ssh
and you got a running Linux VM with Oracle XE!
Both projects work really well and install an Oracle XE instance in a couple of minutes.
#3 – Installing Oracle XE with Docker
This one is the nicest way to install Oracle XE. Docker is an application container for Linux. It is based on LXC and gives you the ability to package complete application including their dependencies to a self-containing file (called an image). These images can be exchanged and run on every Linux machine where Docker is installed! Awesome!
Docker images are also shared around the community on https://index.docker.io. And this is where this two guys come into play:
- Wei-Ming Wu made a Docker image containing Oracle XE. You can find it here.
- Alexei Ledenev extended Wei-Ming Wu’s image to also use the Oracle web console (APEX). You can find it here.
Both projects work the same:
- Install Docker on your Linux machine. You can find instructions for that at http://docs.docker.io/en/latest/installation/ubuntulinux. But it is nothing more then this:
12345sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9sudo sh -c "echo deb http://get.docker.io/ubuntu docker main> /etc/apt/sources.list.d/docker.list"sudo apt-get updatesudo apt-get install lxc-docker - Pull the image to your machine:
1docker pull alexeiled/docker-oracle-xe-11g - Run the image:
1docker run -d -p 49160:22 -p 49161:1521 -p 49162:8080 alexeiled/docker-oracle-xe-11g - That’s it. Absolutely simple.
The great thing is that those images are not as big as a virtual machine. They only contain the actual application and its environment. But they are packed in a way that they can be executed everywhere right out of the box but are still isolated. You can also make changes to the images and create another image containing your changed system.
Resources
- Download Oracle XE: http://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html
- Oracle XE installation guide (1): https://community.oracle.com/thread/2229554
- Oracle XE installation guide (2): http://meandmyubuntulinux.blogspot.de/2012/05/installing-oracle-11g-r2-express.html
- Oracle XE installation guide (3): http://sysadminnotebook.blogspot.de/2012/10/installing-oracle-11g-r2-express.html
- Download Puppet: http://info.puppetlabs.com/download-puppet-open-source
- Download Vagrant: http://www.vagrantup.com/downloads.html
- Download VirtualBox: https://www.virtualbox.org/wiki/Downloads
- Installing Docker: http://docs.docker.io/en/latest/installation/ubuntulinux
- How Docker works: https://www.docker.io/the_whole_story
- Oracle XE Docker image (1): https://index.docker.io/u/wnameless/oracle-xe-11g
- Oracle XE Docker image (2): https://index.docker.io/u/alexeiled/docker-oracle-xe-11g/
- Oracle XE Vagrant/Puppet setup for Ubuntu: https://github.com/hilverd/vagrant-ubuntu-oracle-xe
- Oracle XE Vagrant/Puppet setup for CentOS: https://github.com/matthewbaldwin/vagrant-xe11g
Best regards,
Thomas
Great post! Thanks for taking the time to write such a well written article. Clearly articulates the 3 main options and has a ton of useful external links. Brilliant! I also decided to with #3 too.
When I enter “docker pull alexeiled/docker-oracle-xe-11g” into my terminal I get the following message:
FATA[0000] Post http:///var/run/docker.sock/v1.18/images/create?fromImage=alexeiled%2Fdocker-oracle-xe-11g%3Alatest: dial unix /var/run/docker.sock: permission denied. Are you trying to connect to a TLS-enabled daemon without TLS?
Any ideas as to why?
Thank you very much. You just made my day, I cannot express with words how grateful I am 🙂
Great post, really. But unfortunately #3 didn’t set up apex, don’t know why. Nothing is listening on port 49162. The other two ports are open, instead.
Just want to mention this way to install docker (yours and the one published on docker website did not work on my machine, probably proxy problem):
curl -sSLhttps://get.docker.com/ | sh
I’ll try with vagrant…
I ended up with a new fork at the end 🙂
https://github.com/lucaventurini/vagrant-xe11g
I use docker for the first time… everything install perfectly… sql is running… but i have no idea how to manage it… How can i create database, password etc…
If you used the Docker image “alexeiled/docker-oracle-xe-11g” which I mentioned in my post, you will be able to connect with the following credentials:
You can create tables, users and so on via common SQL. Or you can create an SQL init script to do your setup. Read more at: https://hub.docker.com/r/alexeiled/docker-oracle-xe-11g
sudo docker
I had to sudo docker on 16.04.
If you are using ubuntu 14.x, 15.x, 16.x you do not have to go through all the work you have mentioned
above ….
sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
sudo sh -c “echo deb http://get.docker.io/ubuntu docker main
> /etc/apt/sources.list.d/docker.list”
sudo apt-get update
sudo apt-get install lxc-docker
————————————————————————
ONLY use
apt-get install docker.io
and you have it installed Docker and
Pull the image to your machine:
1
docker pull alexeiled/docker-oracle-xe-11g
Run the image:
1
docker run -d -p 49160:22 -p 49161:1521 -p 49162:8080 alexeiled/docker-oracle-xe-11g
Thank you very much.
Living in France is one thing desired by many individuals. If you want to live in France then you have to get French property. You can read the advertisement section of the newspapers which has the section of houses for sale in France. After making a suitable choice, you should research about the properties for sale in France. French property is now a days very much wanted also.
If you want to live in France and spend your life there you should select a proper house. French property is not cheap and you need to make a major investment. You must also know about the properties for sale in France at various locations. The houses for sale in France come in different prices depending on the location
thanks very much for the easiest way to install Oracle XE 11g on Ubuntu… Docker image !! very nice, I have shared with people in my circle to inform them, how easy is it to have working Oracle DB machine for Apex Developers with all installation steps.
regards
https://www.youtube.com/watch?v=jOrarHqj7X8&t=111s
This is easy i guess.
The docker hub repository may not exist anymore.
Use this instead:
https://hub.docker.com/r/orangehrm/oracle-xe-11g