Lots of freelancers hate having to call up people on the phone and asking if they’ve got any work for them. If only there was a...
Running Oracle XE on OSXDorien Jorissen
If you want to run Oracle XE on OSX you’ll quickly run into the problem that Oracle only provides a Windows & Linux, but not an OSX specific version. This means we’ll need to run Oracle XE in some sort of virtualized environment and for this we’ll use the freely available Oracle VirtualBox (version 4.8.2 r83876) and CentOS (version 6.3).
If you haven’t got VirtualBox installed yet, just download & install it. We’re going to create a CentOS 6.3 x86_64 virtual machine and for this you’ll need to download the corresponding minimal ISO first: CentOS-6.3-x86_64-minimal.iso. Now we are ready to create the virtual machine by going through the following steps:
- Start VirtualBox.
- Click New to open the Create Virtual Machine dialog and give the machine a Name: CentOS 6.3 x86_64. Using the aforementioned name should already select the correct machine Type and Version, if not select Linux and Red Hat (64 bit).
- Set the Memory size to 1024 MB (or more if you think you need it for your purposes).
- Select Create a virtual hard drive now and click Create. This will open the Create Virtual Hard Drive dialog where you can change the default File location if you want, but the default should be fine.
- The default File size of 8,00 GB should be sufficient, but feel free to increase it (less won’t work for our case).
- Select VDI (VirtualBox Disk Image) as the Hard drive file type and Dynamically allocated as Storage on physical hard drive and click Create.
- After clicking Create you’ll be taken back to the main manager screen where your new image will appear in the list.
- Before starting it we’ll first need attach the downloaded ISO to the cdrom drive and set the networking to bridged. To do this select your image im the manager list and click Settings (or right click it and choose Settings).
- Go to the Storage tab and under Controller: IDE select Empty and click on the CD/DVD icon beside the IDE Secondary dropdown.
- Select Choose a virtual CD/DVD disk file and select the iso you downloaded earlier.
Go to the Network tab and for Adapter 1 select Bridged Adapter from the Attached to dropdown.
Click OK to save and close the settings dialog and click Start to boot up the new machine and start the installation of CentOS.
- Starting the machine you just configured with the ISO and the bridged networking will start the actual CentOS installation. The next steps will guide you through this.
- Select Install or upgrade an existing system.
Click Skip in the Disk Found dialog (media testing isn’t needed here).
Click Next in the graphical installer screen.
Choose your language and click Next (we’ll use English (English)).
Choose your keyboard layout and click Next (we’ll use U.S. English).
Leave Basic Storage Devices selected and click Next.
Click Yes, discard any data (there really isn’t any data on this newly created virtual disk anyway).
On the networking screen we’ll need to change a few settings so that the network interface we’ll be actually up after boot and DNS works correctly.
Change the Hostname to oraclexe and then click Configure Network.
Click Edit… for the System eth0 interface in the Wired tab.
Check the Connect automatically checkbox and in the IPv4 Settings tab select Automatic (DHCP) addresses only in the Method dropdown and add127.0.0.1,18.104.22.168,22.214.171.124 in the DNS servers field and click Apply…
Select your correct timezone and click Next (we’ll use Brussels, Europe)
Fill in a suitable root password (twice) and click Next (we’ll use oracle as password).
If it complains that the password is too weak just click Use Anyway.
Keep the Replace existing Linux System(s) selected and click Next.
Click Write changes to disk on the dialog that appears, click Next and wait while the system is being installed.
When the installation is done a screen will appear with a success message and a Reboot button.
Click the Reboot button to finish the installation and after reboot you should be presented with a terminal screen and you should be able to login in as root with the password you entered during install.
This is a good time to run yum update y so the system will be updated with the latest versions of several components, libraries and programs. It is also a good idea to run yum install unzip (to unzip the Oracle XE download) and yum install bc (needed by the Oracle XE install) as we’ll need this later on for the Oracle XE installation. The last thing we need to do before we can start the actual install of Oracle XE is to set the hostname in /etc/hosts. Open this file in vi and add the hostname you entered during the install of CentOS (in our case oraclexe) to the entry for 127.0.0.1. If the hostname isn’t correctly set or resolvable the Oracle XE configuration command will fail with an obscure error message. After this we just need to restart the machine for all the changes to take effect. Just run the shutdown -r nowcommand to reboot the machine.
At this point you’ll basically have an running and up to date CentOS 6.3 virtual machine that can be used for multiple purposes. So this is a good moment to create a snapshot that you can use to go back to in case of problems or to use as a base to clone new virtual machines from.
Now we’re ready to install Oracle XE 11g on this machine, but before we can actually start, we’ll first need to download it. Go to the Oracle XE download page, selectAccept License Agreement and click the Oracle Database Express Edition 11g Release 2 for Linux x64 link to download the correct Oracle XE distribution. After it has downloaded you can transfer the ZIP file to the virtual machine via SFTP using the credentials you entered during installation. You can find the correct IP address by running ifconfig -a and looking for the IP address of the eth0 interface.
Go to the location where you transfered the ZIP file, e.g. /opt, and unzip it. After unzipping go to the Disk1 subdirectory and run yum install oracle-xe-11.2.0-1.0.x86_64.rpm
[root@191 Disk1]# yum install oracle-xe-<span style="color: #339966;">11.2.0</span>-<span style="color: #339966;">1.0</span>.x86_64.rpm
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
* base: centos.weepeetelecom.be
* extras: centos.weepeetelecom.be
* updates: centos.weepeetelecom.be
Setting up Install Process
Examining oracle-xe-<span style="color: #339966;">11.2.0</span>-<span style="color: #339966;">1.0</span>.x86_64.rpm: oracle-xe-<span style="color: #339966;">11.2.0</span>-<span style="color: #339966;">1.0</span>.x86_64
Marking oracle-xe-<span style="color: #339966;">11.2.0</span>-<span style="color: #339966;">1.0</span>.x86_64.rpm to be installed
--> Running transaction check
---> Package oracle-xe.x86_64 <span style="color: #339966;">0</span>:<span style="color: #339966;">11</span>.<span style="color: #339966;">2</span>.<span style="color: #339966;">0</span>-<span style="color: #339966;">1</span>.<span style="color: #339966;">0</span> will be installed
--> Finished Dependency Resolution
Package Arch Version Repository Size
oracle-xe x86_64 11.2.0-1.0 /oracle-xe-11.2.0-1.0.x86_64 564 M
Install <span style="color: #339966;">1</span> Package(s)
Total size: <span style="color: #339966;">564</span> M
Installed size: <span style="color: #339966;">564</span> M
Is this ok [y/N]: y
Running Transaction Test
Transaction Test Succeeded
Installing : oracle-xe-<span style="color: #339966;">11.2.0</span>-<span style="color: #339966;">1.0</span>.x86_64 1/1
Executing post-install steps...
You must run <span style="color: #0000ff;">'/etc/init.d/oracle-xe configure'</span> as the root user to configure the database.
Verifying : oracle-xe-<span style="color: #008000;">11.2.0<span style="color: #000000;">-</span>1.0</span>.x86_64 1/1
oracle-xe.x86_64 <span style="color: #008000;">0:11.2.0</span>-<span style="color: #008000;">1</span>.m0
After the installation you’ll need to configure Oracle XE before you can actually use it. This can be done by running /etc/init.d/oracle-xe configure as root. You’ll need to provide an port for the Apex web interface (the default 8080 will do), a port for the database listener (the default 1521 will do) and a password for the SYS/SYSTEM user (we’ll use oracle).
[root@191 ~]# /etc/init.d/oracle-xe configure
Oracle Database 11g Express Edition Configuration
This will configure on-boot properties of Oracle Database 11g Express
Edition. The following questions will determine whether the database should
be starting upon system boot, the ports it will use, and the passwords that
will be used <span style="color: #360336;"><strong>for</strong></span> database accounts. Press <Enter> to accept the defaults.
Ctrl-C will abort.
Specify the HTTP port that will be used <strong><span style="color: #360336;">for</span></strong> Oracle Application Express :
Specify a port that will be used <span style="color: #360336;"><strong>for</strong></span> the database listener :
Specify a password to be used <span style="color: #360336;"><strong>for</strong></span> database accounts. Note that the same
password will be used <strong><span style="color: #360336;">for</span></strong> SYS and SYSTEM. Oracle recommends the use of
different passwords <strong><span style="color: #360336;">for</span></strong> each database account. This can be done after
Confirm the password:
Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:
Starting Oracle Net Listener...Done
Starting Oracle Database 11g Express Edition instance...Done
Installation completed successfully.
When this configuration completes successfully you should be able to tunnel the database listener port, 1521, to your local machine and connect to it using something like Oracle SQL Developer with user SYS or SYSTEM and the password you provided during the configuration step. Additional users can be created using SQL Developer using the information on this oracle tips site.