Thursday, May 22, 2008

How to install Oracle-Xe on ubuntu

  • Add the following repository to your /etc/apt/sources.list:
deb http://oss.oracle.com/debian unstable main non-free
  • Install the software using apt-get
sudo apt-get update
sudo apt-get install oracle-xe
  • Add your login to the 'dba' group (where your login name is username)
sudo usermod -G dba -a username
------------------------------------------------------------------------------------------

Installing Oracle Database XE on Debian, Ubuntu, and Kubuntu



by Todd Trichler



What happens when you try to install Oracle Database XE Beta on a new Linux distribution? You learn a whole lot!



Updated August 2007 - LinuxWorld Mexico Installfest



In my day job I get to work with .rpm-based Linux distros quite a bit in the form of RHEL, SLES, and Asianux. Recently I noticed that the Oracle Database XE doc mentions support for Debian. My sum experience with this could best be described as vicarious, having never before installed Oracle on a .deb-based distro.



What follows is one man's walk through the technical steps to install the beta of Oracle Database XE on Kubuntu 5.10 Breezy, a Linux distro based on the .deb package format and KDE. The lessons learned and suggestions also apply to Debian, Ubuntu, and other .deb distros.



If you are interested in the "back story" about this journey from the various PHP developers and people who helped along the way, please read the sidebar.



Update (March 2006): With Oracle Database XE in production, it is even easier to install Oracle on Debian-based distros (thanks to Joel Becker).



There is now an apt-get repository up on oss.oracle.com for XE. Just add:



deb http://oss.oracle.com/debian unstable main non-free



to /etc/apt/sources.list and then:



# wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle -O- | sudo apt-key add -

# apt-get update

# apt-get install oracle-xe



'libaio' and 'bc' are in the repository, so dependancies will pull them in if the user doesn't have them. (Note: You will need to 'sudo' or have 'root' privileges to install XE.)



Catch-all disclaimer: These steps worked for me on my configuration; they might not work on yours.



1. Download an iso of Kubuntu Breezy version and burn an install disc.



2. Do a standard install of Kubuntu. When prompted on the partioning choose "Erase entire HD and use LVM".



3. Do not set any of the kernel parameters because the latest beta versions of XE are supposed to check the parameters and increase them if neccessary. (Note: If you are using an older beta you will want to check those; better still, download the latest version.)



4. Confirm that the pre-requisite (glibc and libaio equivalent) libraries are installed. On Kubuntu and Ubuntu they are called "libc6" and "libaio1". (I used Adept, the new GUI package management tool, to install libaio1; libc6 was already installed.) As Wim Coekaerts described in his podcast on the subject, currently you need to use Debian unstable to get the equivalent packages, but in the future with Debian sid they would just be included.



5. As _root_ began installing the latest available Oracle XE beta:



todd@kubuntu:~$ su -

root@kubuntu:~# cd /home/todd/Desktop

root@kubuntu:/home/todd/Desktop# ls

DapperDevStatus02-Feb-2006.pdf oracle-xe_10.2.0.1-0.060128_i386.deb trash.desktop

root@kubuntu:/home/todd/Desktop# dpkg -i oracle-xe_10.2.0.1-0.060128_i386.deb

Selecting previously deselected package oracle-xe.

(Reading database ... 58594 files and directories currently installed.)

Unpacking oracle-xe (from oracle-xe_10.2.0.1-0.060128_i386.deb) ...

This system does not meet the minimum requirements for swap space. Based on

the amount of physical memory available on the system, Oracle Database 10g

Express Edition requires 1006 MB of swap space. This system has 799 MB

of swap space. Configure more swap space on the system and retry the installation.

dpkg: error processing oracle-xe_10.2.0.1-0.060128_i386.deb (--install):

subprocess pre-installation script returned error exit status 1

Errors were encountered while processing:

oracle-xe_10.2.0.1-0.060128_i386.deb

root@kubuntu:/home/todd/Desktop#



Note: the default 799MB of swap on Kubuntu was not sufficient for XE to install. Currently if you have 512MB physical RAM, XE will want 1GB swapspace (as in my case on a Tecra9000); if 256MB physical RAM, XE will want 1.5GB swapspace. Fortunately, XE gave me meaningful error feedback. How would I add swapspace on the fly without re-partioning? I had no clue. Maybe there is a administrative GUI? No such luck.)



6. I did get a couple of command-line responses from some of my friends on how to get around this. Here is one that worked for me:



root@kubuntu:~# dd if=/dev/zero of=/swapfile bs=1M count=600

600+0 records in

600+0 records out

629145600 bytes (629 MB) copied, 2.1237 seconds, 296 MB/s

root@kubuntu:~# mkswap /swapfile

Setting up swapspace version 1, size = 629141 kB

no label, UUID=f267d443-106e-431e-a6e5-ec2c1ebb0a37

root@kubuntu:~# swapon /swapfile



Note: I would not recommend using these types of commands to add swap unless you either understand what they are doing, or you trust the person who has recommended the fix and they are familiar with your system. Better still, add enough swap to start with. Well placed sources tell me that by the time Kubuntu 6.04 Dapper goes production (April 2006?), this might not be an issue.



7. After I upped the swapspace it installed cleanly.



root@kubuntu:/home/todd/Desktop# dpkg -i oracle-xe_10.2.0.1-0.060128_i386.deb

(Reading database ... 62016 files and directories currently installed.)

Unpacking oracle-xe (from oracle-xe_10.2.0.1-0.060128_i386.deb) ...

Setting up oracle-xe (10.2.0.1-0.060128) ...

Oracle Database 10g Express Edition is not configured. You must run

'/etc/init.d/oracle-xe configure' as the root user to configure the database.

Executing Post-install steps...





8. Although it is installed at this point you still need to configure it :



root@kubuntu:/home/todd/Desktop# /etc/init.d/oracle-xe configure

Oracle Database 10g Express Edition Configuration

-------------------------------------------------



This will configure on-boot properties of Oracle Database XE. 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 for database accounts. Press to accept the defaults. Ctrl-C will abort.



Specify the HTTP port that will be used for Oracle Application Express [8080]:



Specify a port that will be used for the database listener [1521]:



Specify a password to be used for database accounts. Note that the same

password will be used for SYS and SYSTEM. Oracle recommends the use of

different passwords for each database account. This can be done after

initial configuration:



Confirm the password: (* make sure you remember this password *)



Do you want Oracle Database 10g Express Edition to be started on boot (y/n) [y]: y



Starting Oracle Net Listener...Done

Configuring Database...Done

Starting Oracle Database 10g Express Edition Instance...Done

Installation Completed Successfully.

To access the Database Home Page go to "http://127.0.0.1:8080/apex"

root@kubuntu:/home/todd/Desktop#



9. At this point you can fire up Firefox http://127.0.0.1:8080/apex, login as 'system' with the 'password' you created during the install, and you should see the XE homepage:






-------------------------------------------------------------------------------------------
read
http://www.oracle.com/technology/tech/linux/install/xe-on-kubuntu.html

to run sqlplus from the command line:-


So long as your environment variables are set up correctly, all you should
need is to type sqlplus.



However, if you want to run this from another machine, that machine would need to have the Oracle client components installed on it.Additionally you would need to have tnsnames.ora file configured with the information about the database instance you want to connect to.



Environment variables to consider are:

ORACLE_HOME (location Oracle has been installed to)

ORACLE_SID (database that you want to connect to)

NLS_DATE_FORMAT (Format Oracle will display dates in)

Ensure that the PATH variable contains $ORACLE_HOME/bin

When you installed Oracle 10g Express Edition the install will have created a user
called oracle



Initial setup:

1. Change / set the password for that account: sudo passwd oracle



2. Log in as the oracle account: su - oracle



3. vi .profile:

Code:
export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
export ORACLE_SID=XE
export PATH=$ORACLE_HOME/bin:$PATH

Then when you login as oracle (su - oracle) your environment will be set
To gain admin access the the XE database
(created by default with Express Edition):

Code:
sqlplus '/ as sysdba'
you can then modify the sys password (example to set the sys account to "newpassword"):
Code:
alter user sys identified by newpassword;




No comments:

Post a Comment