Oracle doesn't officially currently support its database on Ubuntu. However, I think that Ubuntu, especially the current release (09.10 : Karmic) is a great development platform. At my place of work there is a small development dept all busily developing and all using Ubuntu as the development platform of choice. The system we support uses Oracle 10g as its database. It followed that if we are to work productively then we needed some way of installing Oracle on Ubuntu. This guide is the result of lots of trial, error and spending time figuring out the best way to install Oracle 10g on Ubuntu.
Since Oracle doesn't support Ubuntu, installing Oracle in this way on a Production machine is very unwise. Its also even more unwise if you notice that I leave many of the defaults alone and use easily guessable passwords. However, when we deploy onto Production systems these defaults are close enough that we can deliver meaningful work without having to get a Sun server for the office. It also means we can all have our our installation of Oracle on our machines. Since its local the response time is very fast. And since no-one else is using the same Oracle install we can restart as many times as we want to...
Obviously if you think differently and install Oracle based Ubuntu into a production environment and it all goes horribly wrong you have only yourself to blame. I will not accept liability for your company going out of business because of this guide...! NB: If you are running 64-bit Ubuntu then you will need to follow the sections marked out for 64-bit Users.
Disclaimer: This has been adapted from many blogs, forums and other websites. If you see a bit of text that you think has been lifted from your blog entry, forum post or other waffling it probably might of. Please let me know and I will change. However no stealing of copyright is meant...!
This guide will take about two hours to complete, not including the time to download the file from Oracle. To fully install Oracle budget at least a morning or afternoon. The install is usually straight forward, but can throw up unexpected problems...!
You will first need to download the installation file from Oracle. For 32-bit Ubuntu use "10g Release 2 Enteprise Edition for the Linux x86 architecture" and for 64-bit Ubuntu use "Oracle Database 10g Release 2 (10.2.0.1.0) for Linux x86-64". You will then either get 10201_database_linux32.zip or 10201_database_linux_x86_64.cpio.gz depending on your choice. Put this somewhere handy...
sudo apt-get install gcc libaio1 lesstif2 lesstif2-dev make rpm libc6 sun-java6-jre
sudo apt-get install gcc-multilib libc6-dev-i386 libc6-dev-i386 libc6-i386 ia32-libs
(This avoids an compilation error because Oracle has mixed and matched 32-bit and 64-bit libraries. The Exception is "Error in invoking target 'install' of makefile '/oracle/10g/ctx/lib/ins_ctx.mk" and the compiler will have the following error :
/usr/bin/ld: skipping incompatible /lib/libpthread.so.0 when searching for /lib/libpthread.so.0
/usr/bin/ld: cannot find /lib/libpthread.so.0
Installing gcc-multilib, etc appears to avoid this)
With Ubuntu 09.10 this is no longer included in the Packages. (If you are not on Karmic, install it via Synaptic.) Install as follows:
wget "http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-3.3/libstdc++5_3.3.6-17ubuntu1_i386.deb"
ar vx libstdc++5_3.3.6-17ubuntu1_i386.deb
tar zxvf data.tar.gz
file usr/lib/libstdc++.so.5.0.7
sudo install usr/lib/libstdc++.so.5.0.7 /usr/lib32/
cd /usr/lib32
sudo ln -s libstdc++.so.5.0.7 libstdc++.so.5
cd /usr/lib
sudo ln -s /usr/lib32/libstdc++.so.5
This is the same apart from using the following first two steps:
wget "http://de.archive.ubuntu.com/ubuntu/pool/universe/g/gcc-3.3/libstdc++5_3.3.6-17ubuntu1_amd64.deb"
ar vx libstdc++5_3.3.6-17ubuntu1_amd64.deb
For Lucid:
Need to install Java 6 for the installer:
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk
For Natty:
sudo ln -s /lib/x86_64-linux-gnu/libgcc_s.so.1 /lib64/libgcc_s.so.1sudo groupadd oinstall
sudo groupadd dba
sudo groupadd nobody
sudo useradd -m oracle -g oinstall -G dba
sudo passwd oracle
Set the password to oracle... Remember to change this to something else afterwards and never leave it like this on a public facing server. (And why are you letting an Oracle Server be public facing...?). If you will be running this on your own machine don't forget to add yourself to the oinstall group. This will allow you to use sqlldr and sqlplus from the same install for development and debugging...!
sudo gedit /etc/sysctl.conf
Add:
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
And reload with:
sudo /sbin/sysctl -p
sudo gedit /etc/security/limits.conf
Add the following to the end
* soft nproc 2047
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536
sudo ln -s /usr/bin/awk /bin/awk
sudo ln -s /usr/bin/rpm /bin/rpm
sudo ln -s /lib/libgcc_s.so.1 /lib/libgcc_s.so
sudo ln -s /usr/bin/basename /bin/basename
sudo mkdir /oracle
sudo mkdir /oracle/10g
sudo chown -R oracle:oinstall /oracle
sudo chmod -R 775 /oracle
sudo gedit /etc/profile
Add the following to the end:
export ORACLE_BASE=/oracle
export ORACLE_HOME=/oracle/10g
export ORACLE_SID=orcl10
export PATH=$PATH:$ORACLE_HOME/bin
Double check...
su - oracle
echo $ORACLE_BASE
echo $ORACLE_HOME
exit
sudo gedit /etc/redhat-release
Add this :
Red Hat Enterprise Linux AS release 3 (Taroon)
Go to where you put the downloaded file and...
mkdir oracle_install
cp 10201_database_linux32.zip oracle_install/
unzip 10201_database_linux32.zip
mkdir oracle_install
cp 10201_database_linux_x86_64.cpio.gz oracle_install/
gunzip 10201_database_linux_x86_64.cpio.gz
cpio -id < 10201_database_linux_x86_64.cpio
The unzipping operation creates a subdirectory. Make this available to the Oracle user:
cd ..
sudo chown -R oracle:oinstall oracle_install/
At this point you are ready to start installing Oracle...!
To initiate the installation, you'll have to log right out of the system, and log in directly as the oracle user (alternatively, you can fiddle around with DISPLAY environment variables, but logging off and back on again is simpler and less prone to making mistakes!). See also http://excession.org.uk/blog/setting-up-xdmcp-on-karmic-koala-ubuntu-0910.html
To do this try:
gdmflexiserver --xnest
(NB: if you get authority errors then you need to make sure you have a fresh terminal window, and can this can attach application to the local screen. If problems persist, then make sure that the Remote Login for is enabled under System -> Administration -> Login Window )
Log into this window, and then...
cd to the location of the zip file
/home/oracle/database/runInstaller
It may take a while for the install to come up...
Un-tick the "Create Starter Database option", and keep hitting next. The install takes about 10 mins on a typical machine and typical rest-load.
NB: You will get an error regarding the target "collector" of makefile '/oracle/10g/sysman/lib/ins_emdb.mk' . This can be ignored as we will not be using this function. (Its used by Oracle to check data on Oracle. Since Karmic isn't a supported o/s this can be ignored...)
This error is identified by "/usr/bin/ld: i386 architecture of input file `/oracle/10g/sysman/lib/snmccolm.o' is incompatible with i386:x86-64 output" in the make log.
You will then be asked to run at least one (usually two) scripts as root. Do so... These can be run by "sudo" if you prefer.
When all this finished Oracle has been installed. Woo...! Hoo...! But there's still a way to go...!
It's not a requirement to create a Listener before you create a database, but it's a good idea to do so. A Listener is a process which listens on a well-known port for requests from remote users seeking to connect to the Oracle database. Without one, therefore, you'd only ever be able to connect to the database whilst directly logged onto the server itself, which is obviously a bit of a show-stopper!
To create a Listener, we use the Network Configuration Assistant. To invoke the Assistant, just issue the command netca (should be in path) as the oracle user in a new terminal session. Press "Next" to accept the defaults. After a bit you will get to "Finish" which is where you want to finish.
netca
First, find out the id of the oinstall group. You can find this from looking in System -> Admin -> Users and Groups -> Manage Groups. Alternatively, use:
cat /etc/group | grep oinstall
NB: The oinstall Group Id should be 1002 or similar. If the User/Group Applet is giving "0" then try double checking the Properties of the group. I've noticed that the Users/Groups Applet can be unreliable...
Then, as root, perform the following command. (NB: This can't be performed by sudo, you must be root)
echo "<dba_group_gid>" > /proc/sys/vm/hugetlb_shm_group
This allows the oinstall group access to hugetlbpages. Without this you will get error "ORA-27125: unable to create shared memory segment" when setting up the database.
Run the Database Configuration Assistant, or DBCA for short. You will need to be the Oracle user you set up earlier.
dbca
This is not a difficult thing to do: mostly, in our case, it involves clicking "Next" to walk through the wizard, accepting all defaults. You will be prompted when you actually need to enter something.
Just be sure to specify the correct database name (it should match what is set as your ORACLE_SID, but with a proper domain extension. By default the ORACLE_SID is orcl10, and can be found out by running the oraenv command in the oracle bin directory...
Use the password "oracle" for the password and write down the values it spits out at the end...!
NB: If you get a "ORA-12547- Lost Contact" error, make sure you have libaio1installed (sudo apt-get install libaio1)...
If it all went well you now have an Oracle Db on your machine. Pat yourself on the back for getting this far and sticking with it. You still have a way to go before its all installed but go and have some tea to celebrate...! And then go on to Part 2...
Comments
Great guide - thanks. This also works for Oracle 11g on Karmic Koala.For 11g note that the installer will report missing libraries, however if you set the libraries up as indicated in the guide, the subsequent linking step will indeed succeed. Thanks again.
I thought 11g might have been similar. Its good to know that just in case we ever make it off of 10...! Good to know it helped someone-else...! :)
Maybe...
...it's also worth pointing out that if you're running Compiz (to get fancy Window effects) then the modal dialog box that comes up in Database Configuration Assistant after clicking 'Finish' will be blank, making it impossible to proceed.
To fix:
Option 1: Turn off Compiz
meta-city --replace
Option 2: Make Oracle use Java6 (tested and works with dbca, haven't tested with other tools)
cd $ORACLE_HOME/bin/jdk/jre/bin
mv ./java java.old
ln -s /usr/lib/jvm/java-6-sun/jre/bin/java java
You guys rock! Well done! Can now run 10g and 11g on Karmic. Brilliant!
I got to the dbca part (remotely installing on Windows7 via putty/xming ssh). I can use the gui to configure all options, but when i click on finish – after confirmation, nothing happens. No errors either, I can go back and forth in the installer and the finish button is still clickable. Any ideas?
What happens when you try to start Oracle...?
DBCA is just used to set-up a new database rather than to start Oracle. You will need to continue to the second part of the guide to actually start Oracle.
What I mean is...
...I can't finish the dbca installer. After getting the confirmation window (database called orcl10 will be created - with the options that I selected displayed below) and clicking ok, the installer returns me to the main screen. Subsequently clicking on finish button again produces no results. We’ve installed oracle before, but always on Windows OS with no problems. My DBA says that I should get another window (progress bar?) but my X11 client doesn’t forward anything new and there is no activity.
Works now. Got mad and installed entire GUI on server - it seems my xserver Windows client (Xming) didn't forward the final oracle installer screen progress bar. Now I’m stuck with another problem (and Google seems to indicate that it’s quite common): Failed to allocate port(s) in the specified range for the following process(es): JMS 5540-5559,RMI 5520-5539,Database Control 5500-5519,EM agent 1830-1849These ports are not used, and /etc/sysctl.conf has the correct range.
Replies...
This is what I was going to suggest. Its usually the best way, although a hassle.
Have you made sure you reloaded with /sbin/sysctl -p...? (Obvious question, I know...)
Just writing to drop a line that I have the database working now
Anyhow, it turns out I can ignore the mentioned errors about failing to allocate ports if I just want to be able to access the database with remote connection (jndi, oracle client etc..) – and that's fine by me.
Here are the things I've had problems with:
1. echo "" > /proc/sys/vm/hugetlb_shm_group : I have to run this as root every time I start oracle as oracle user after rebooting the system.
2. My hostname is ubuntu (just ubuntu), but the ora Listeners has to be: host= ubuntu.local or it doesn't work remotely. I had to '$lsnrctl reload' after editing the Listeners.ora file and then with orcl - remove database orcl10, add database orcl10.
Thanks again,
Emperor
Good to know it worked out for you in the end.
I put the following line at the start of $ORACLE_HOME/bin/dbstart
export DISABLE_HUGETLBFS=1
So I don't need to do "echo "" > /proc/sys/vm/hugetlb_shm_group". There's a performance hit but I'm only running this on Test / Dev machines.
Thanks Josh for your great HOWTO which helps me a lot.I had started my own howto before finding yours.I have completed mine with a bit more of common errors descriptions and possible startup issues.I have also linked your page.If you allow, here is another Linux HOWTO on Installing Oracle 10g 64 bits on Ubuntu Karmic 64 bits.With kind regards.Gaaêl,
Apparently my html link has been rejected
Here it is again:
http://www.makina-corpus.org/blog/how-install-oracle-10g-full-64-bits-ve...
Thanks for those kind words...!
I've added the link into the second article..! Cheers..! J
For amd64...
...you can
echo 'vm.hugetlb_shm_group=' >> /etc/sysctl.conf
then sysctl -p
if you do not want to echo "" > /proc/sys/vm/hugetlb_shm_group
First things first...
...thanks for a 1A howto which helped me get 10g goning on my ubuntu box
going crazy here !
trying to get the OCI client working, and keep getting the following error
/home/oracle/oracle/product/10.2.0/db_3/lib/libocijdbc10.so: libclntsh.so.10.1: cannot open shared object file: No such file or directory
files are there and i'm running java as root, x86_64bit java and dbinstall
added the ORACLE_HOME/lib to my LD_LIBRARY_PATH and defined ORACLE_HOME
must be missing something , can anyone suggest some troubleshooting tips please .
On...
...my install I have /oracle/10g/lib/libclntsh.so.10.1 . ie, in $ORACLE_HOME/lib
So is your LD_LIBRARY_PATH set correctly...? LD_LIBRARY_PATH should include $ORACLE_HOME/lib. If you are running it as root perhaps its not set up for this user...?
You made it pretty simple and straight.I'm going to try on ubuntu 10.04 Lucid Lynx (which I already have, Just was waiting for some nice blog with straight and simple instructions. I belive oracle installation should work on this same as ubuntu karmic.With Regardspervaish
Lots of thanks to make it pretty simple and straight.
Should it work same as with ubuntu 10.04 Lucid lYNX.
With Regards
Pervaish
Yes...
...AFAIK the same installation method will work on Lucid. (My Boss at work did this) I installed my current DB onto Karmic and then upgraded when Lucid came out. It all works fine.
At some point I need to double check, but that may now wait until Maverick comes out.
If you do try it and run into problems then let me know via the Contact form...! J
Nice article...
With some modification i was success installing Oracle 10g on my Ubuntu 10.10
Thank you ;-)
Thank you for the guide. I've tried it today with Ubuntu 10.10 (32 bit) and it worked like a charm.
Thanks a lot!!! so simple and friendly.xoxo ;-)
Check...
...file /etc/hosts - there must be entry about your hostname
Hi...
... Just a quick one - been trying to get this done all day on 64 bit 11.04, without too much luck... This site put a few more pieces of the jigsaw in place - thanks! To finally make it work I had to add:
sudo ln -s /lib/x86_64-linux-gnu/libgcc_s.so.1 /lib64/libgcc_s.so.1
Don't know if this is the right way to do it, I know a bit about oracle but not a lot about linux! However, it worked!
Cheers
Bob
After my install I then ran into problems with dbca - in the end I modified cat /etc/group | grep oinstall to cat /etc/group | grep dba and this permitted database creation.Bob
Thanks...
...for letting us know what you had to do for 11.04. This will be very handy for people who are installing on Natty Narwhal...!
Again, many thanks for sharing...! Josh
Hi...
I have a question for someone out there with more Linux knowledge... I have done this install on 11.04 (see my previous comments) but I have a problem when starting the DB. I don't want the DB to start with Linux so I am quite happy starting it from scratch for each session. To do this I would normally do something like:
. oraenv
#enter the sid when requested (orcl10)
sqlplus / as sysdba
>startup
The problem with this that I get the dreaded can't create shared memory realm issue It is quite easily solved by su/sux to root and re-issuing:-
#as per previous post 1002=dba group
echo "1002" > /proc/sys/vm/hugetlb_shm_group
However, this is a pain, why is this not remembered? How can I make this modification permanent? How can I make it work for other groups than the dba group (unless I am mistaken the solution above only works with one group at a time)?
Any ideas, solutions, comments welcome :-)
Cheers
Bob
And...
...it's me again
Solved the above question from here:-
http://www.nextre.it/oracledocs/hugetlb.html
the lines needed for me in the sysctl.conf were:-
vm/nr_hugepages=2048
vm/hugetlb_shm_group=55
Now everything just works as above. Hope this is helpful to anyone else who needs it. Next experiment will be 11g
Bob
Actually...
...this may not have been one of my greatest ideas, this tried to allocate 4Gb to huge pages (it will teach me to read things more closely), all of my system RAM! In the end I went for the following:-
vm/nr_hugepages=128
vm/hugetlb_shm_group=1002
with a value of 128 (in theory giving 256mb of huge page) the DB starts even though it has a 1.1Gb SGA. Clearly I need to do some more investigation of how much Oracle actually requires.
Note also the change of group above, the one I posted originally was from the example, it should be the group number of your dba group.
Cheers
Bob
Really nice, Thanks for this.
if you don't find Install libstdc++5 then go there http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-3.3/
if you are installing on server edition means without GUI on server then you will get an error for DISPLAY or X11 . To manage these error plz use Linux Desktop client and use ssh -X oracle@hostIP ..and try to install
Thanks...
...a lot for publishing this. This does not work on Ubuntu 11.10:First (of several) errors:Error in invoking target 'install' of makefile '$ORACLE_HOME/sqlplus/lib/ins_sqlplus.mk'.
Hi, Mike. I will update the guide for 11.10 shortly. At the moment I know that this works for 11.04. You could try installing 11.04 and then update to 11.10.(I have Oracle running on 11.10)Josh
Thanks...
I did this and it worked, except that I had to soft link the expected libstdc++.so.5 to libstdc++.so.6:
sudo ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 libstdc++.so.5
I did that in both /usr/lib and /usr/lib32, but I think putting it in /usr/lib is what made it finally work.
Really nice work !!It worked for me perfectly and at the first tryThanks a lot
Start trading the forex market using a simple technique that leads to spectacular profits using micro forex account.
This post was very useful in getting my oracle install up and running. Thanks a lot.I wonder if you have managed to upgrade to Oneric (11.10) yet and if there are any updates regarding that.
Add new comment