Friday, May 8, 2009

Oracle XE on Ubuntu

Oracle XE on Ubuntu

Almost ANY left over machine can run Oracle XE on the popular Linux distro Ubuntu. Even if you've never used Linux, you can have a working database in just a few hours

This post will assume that you've already install Unbuntu Server 9.04. It goes by the cutesy name "Jaunty Jackelope".
During the install you should have created a user for Oracle - ID = oracle, password = oracle. All of the commands in this post will follow this assumption.

If you have less than 1GB of memory, you will need to create a swap file, before starting the real install:
sudo sh
dd if=/dev/zero of=/swpfs1 bs=1M count=1000
mkswap /swpfs1
swapon /swpfs1
exit

Switch to the root account:
sudo sh

Add the download to the list of update sources:
echo "deb http://oss.oracle.com/debian/ unstable main non-free" >> /etc/apt/sources.list
If you are comfortable with vi you can use it to perform the above action manually
vi /etc/apt/sources.list
scroll to the bottom of the file and press I (for insert) and type the line below
deb http://oss.oracle.com/debian/ unstable main non-free
Press Escape, then
:wq and press Enter

Import the security key from Oracle:
wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle -O- | sudo apt-key add -

Update the packages:
apt-get update

Install Oracle
apt-get install oracle-xe
That's it! This is completely unexpected, but simple

Configure Oracle
/etc/init.d/oracle-xe configure
When prompted for the Oracle Application Express port, accept the default 8080 by pressing enter
When prompted for the database listener port, accept the default 1521 by pressing enter
When prompted for the SYS and SYSTEM password, enter a password of your choice and press enter
When prompted to verify the password, enter the same password as above and press enter
When asked if you want the database to start with the system, accept the default y by pressing enter

Make sure you can still access the system:
Installing oracle actually removed your permission to become root. It's time to put it back, BEFORE you reboot.
echo "# let oracle sudo as root" >> /etc/sudoers
echo "oracle ALL=(ALL) ALL" >> /etc/sudoers

Become yourself again (not root)
exit

Set up your environment:
echo "export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server" >> .bash_profile
echo "export PATH=$ORACLE_HOME/bin:$PATH" >> .bash_profile
echo "export TNS_ADMIN=$ORACLE_HOME/network/admin" >> .bash_profile
echo "export ORACLE_SID=XE" >> .bash_profile
echo "export LD_LIBRARY_PATH=$ORACLE_HOME/lib" >> .bash_profile

Apply your changes
source .bash_profile

You now have a working Oracle installation!!!!

BUT... you're not through yet.
Because you're running server, you don't have all of the GUI goodness. You have to access it remotely, but
first you have to tell the system to allow remote connections
Start SQL*Plus and log in as SYSTEM:
sqlplus system
Enter the password you defined earlier
At the SQL prompt enter
EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);
EXIT

Reboot:
sudo shutdown -r now

NOW you're finished.

Future posts will cover installing the client, and configuring for use under VmWare

No comments:

Post a Comment