A while ago I tried to install Oracle 11g R2 Express Edition on a 64-bit Ubuntu machine. This proved to be not as easy as you would expect. There are many blogs and articles about this subject and I tried a number of them. Unfortunately neither of the instructions seemed to work completely on my machine. With the combined information from the authors, I finally got it to work and I’ll gladly share my recipe in this blog. I have also included the installation steps for SQL Developer en Java (which is needed to install SQL Developer) in this blog. The installation was performed on a Ubuntu 12.04 VM with the following software.
Oracle Java 1.7.051. Oracle XE 11.2.0. SQL Developer 4.0.0.13.80 This cookbook works with exacty the herefore mentioned versions be aware that if you try to install a different version of one component, the steps below may not work. For example newer version of SQL Developer may require a more recent version of Java. Installing Java We start with installing Java on the machine. My personal preference is to use Oracle Java JDK.
Installing this JDK could be done easily by performing the following statements. Sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java7-installer The screen in figure 1 will appear in the terminal, hit enter to proceed.
After this, the screen in figure 2 will be shown. Navigate to using the left arrow on your keyboard and hit enter. Oracle JDK 7 will be installed. Figure 2: JDK License Agreement To validate the Java installation, execute the following command: java -version This should result in the following (or something similar). Java version “1.7.051” Java(TM) SE Runtime Environment (build 1.7.051-b13) Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode) The next next step is to set the JAVAHOME environment variable. To do this, open the /etc/bash.bashrc file by executing the following statement.
Sudo gedit /etc/bash.bashrc Scroll to the bottom of the file and add the following lines. Export JAVAHOME=/usr/lib/jvm/java-7-oracle export PATH=$JAVAHOME/bin:$PATH Save the file and close the editor. To load the changes, execute the following statement. Source /etc/bash.bashrc To validate the changes you can execute the following statement.
Echo $JAVAHOME The result of this statement should be the following. /usr/lib/jvm/java-7-oracle Installing Oracle 11g R2 Express Edition For the installation of Oracle 11g R2 Express Edition (XE), a couple of additional Linux packages are required. These packages can be installed by executing the following statement.
Sudo apt-get install alien libaio1 unixodbc The next step is to download the Oracle 11g R2 Express Edition from the Oracle website. Make sure you select the Linux x64 version from. After the download is completed, open the terminal and navigate to the download directory. In my case this can be done by executing the following statement. Cd Downloads The next step step is to unzip the downloaded file.
To do this, execute the following command. Unzip oracle-xe-11.2.0-1.0.x8664.rpm.zip A new directory (Disk1) is added to the Download directory. Navigate to this directory: cd Disk1 Now we have to convert the Red Hat package (rpm) to a Debian package.
This may be done using the alien command. The -d parameter is used to inform alien that a Debian package should be generated. When the -scripts parameter is toggled, alien will try to convert the scripts that are meant to be run when the package is installed and removed. Sudo alien -scripts -d oracle-xe-11.2.0-1.0.x8664.rpm This step may take a while, while this statement is executing we can do the following steps. Open a new terminal window for these steps. The Red Hat package, relies on the /sbin/chkconfig file, which is not used in Ubuntu. To successfully install Oracle XE we use a simple trick.
Start by creating a custom /sbin/chkconfig file by executing the following statement. Sudo gedit /sbin/chkconfig Copy and paste the following into the editor: #!/bin/bash # Oracle 11gR2 XE installer chkconfig hack for Ubuntu file=/etc/init.d/oracle-xe if ! `tail -n1 $file grep INIT` ; then echo $file echo '### BEGIN INIT INFO' $file echo '# Provides: OracleXE' $file echo '# Required-Start: $remotefs $syslog' $file echo '# Required-Stop: $remotefs $syslog' $file echo '# Default-Start: 2 3 4 5' $file echo '# Default-Stop: 0 1 6' $file echo '# Short-Description: Oracle 11g Express Edition' $file echo '### END INIT INFO' $file fi update-rc.d oracle-xe defaults 80 01 #EOF Save the file and close the editor. Now we have to provide the file with the appropriate execution privileges.
Sudo chmod 755 /sbin/chkconfig After this, we have to create the file /etc/sysctl.d/60-oracle.conf to set the additional kernel parameters. Open the file by executing the following statement.
Sudo gedit /etc/sysctl.d/60-oracle.conf Copy and paste the following into the file. Kernel.shmmax is the maximum possible value of physical RAM in bytes.
536870912 / 1024 /1024 = 512 MB. # Oracle 11g XE kernel parameters fs.file-max=6815744 net.ipv4.iplocalportrange=9000 65000 kernel.sem=250 32000 100 128 kernel.shmmax=536870912 Save the file.
The changes in this file may be verified by executing: sudo cat /etc/sysctl.d/60-oracle.conf Load the kernel parameters: sudo service procps start The changes may be verified again by executing: sudo sysctl -q fs.file-max This method should return the following: fs.file-max = 6815744 After this, execute the following statements to make some more required changes: sudo ln -s /usr/bin/awk /bin/awk mkdir /var/lock/subsys touch /var/lock/subsys/listener Close the second terminal window and return to the first terminal window. The rpm package should be converted and a new file called oracle-xe-11.2.0-2amd64.deb have been generated. To run this file, execute the following command: sudo dpkg -install oracle-xe11.2.0-2amd64.deb Execute the following to avoid getting a ORA-00845: MEMORYTARGET error. Note: replace “size=4096m” with the size of your (virtual) machine’s RAM in MBs. Sudo rm -rf /dev/shm sudo mkdir /dev/shm sudo mount -t tmpfs shmfs -o size=4096m /dev/shm Create the file /etc/rc2.d/S01shmload. Sudo gedit /etc/rc2.d/S01shmload Copy and paste the following in the file.
Note: replace “size=4096m” with the size of your machine’s RAM in MBs. #!/bin/sh case '$1' in start) mkdir /var/lock/subsys 2/dev/null touch /var/lock/subsys/listener rm /dev/shm 2/dev/null mkdir /dev/shm 2/dev/null mount -t tmpfs shmfs -o size=4096m /dev/shm;;.) echo error exit 1;; esac Save the file, close the editor and provide the appropriate execution privileges. Sudo chmod 755 /etc/rc2.d/S01shmload Configuring Oracle 11g R2 Express Edition If you have successfully installed to Oracle 11g R2 Express Edition server, it’s time to configure the server.
To start the configuration of the server, execute the following command and follow the “wizard” in the terminal. Default values are shown between brackets for each question. Sudo /etc/init.d/oracle-xe configure Now it is time to set-up some environmental variables.
Open the /etc/bash.bashrc file by executing the following statement: sudo gedit /etc/bash.bashrc Scroll to the bottom of the file and add the following lines. Export ORACLEHOME=/u01/app/oracle/product/11.2.0/xe export ORACLESID=XE export NLSLANG=`$ORACLEHOME/bin/nlslang.sh` export ORACLEBASE=/u01/app/oracle export LDLIBRARYPATH=$ORACLEHOME/lib:$LDLIBRARYPATH export PATH=$ORACLEHOME/bin:$PATH Save the file and close the editor. To load the changes, execute the following statement: source /etc/bash.bashrc To validate the changes you can execute the following statement.
Echo $ORACLEHOME This statement should result in the following output. /u01/app/oracle/product/11.2.0/xe After this step it is recommended to reboot the machine. After the reboot is completed, you should be able to start the Oracle server using the following command: sudo service oracle-xe start A file named oraclexe-gettingstarted.desktop is placed on your desktop. To make this file executable, navigate to you desktop. Cd /Desktop To make the file executable, execute the following statement. Sudo chmod a+x oraclexe-gettingstarted.desktop Installing SQL Developer Finally, after the installation of Oracle 11g R2 Express Edition and Java, SQL Developer could be installed.
This is done by performing the following steps. Download Oracle SQL Developer from the Oracle site. Select the Linux RPM package:. Open a terminal window and navigate to the Download directory: cd Downloads Convert the Red Hat package to a Ubuntu package. Note: this may take a while. Sudo alien -scripts -d sqldeveloper-4.0.0.13.80-1.noarch.rpm A file named sqldeveloper4.0.0.13.80-2all.deb will be generated. To run this file, execute the following statement: sudo dpkg -install sqldeveloper4.0.0.13.80-2all.deb Create a.sqldeveloper directory in your home folder: sudo mkdir /home/.sqldeveloper/ Run SQL Developer from the terminal. Sudo /opt/sqldeveloper/sqldeveloper.sh Now enter the full Java path.
In my case this is done as follows: /usr/lib/jvm/java-7-oracle These steps worked for me to install Oracle XE and SQL Developer on Ubuntu 64-bit, and have been validated by one of my colleagues. I am curious to know if it worked for you. Please also let me know if you find any mistakes or have any additions to make this script better. I had the same problem, I solved doing this: 1.
I have Oracle Java 8 installed from the WebUpd8 PPA. Once you have installed everything go to the terminal and do gedit.sqldeveloper/4.1.0/product.conf 3. Go to the line that says SetJavaHome and remove the entire line and put this: SetJavaHome /usr/lib/jvm/java-8-oracle 4.
I assume that you have installed Java 8 from WebUpd8 PPA, if not, it is very simple to install it, just google it! Save the file 5.
Now you can start sqldeveloper from Unity or another app launcher. Hi, Could you please help me with one issue? I have installed as per your step in this tutorial, however cannot connect to SQL.Plus. I have set up password in terminal after running command ”sudo /etc/init.d/oracle-xe configure”, but now I cannot connect as SYSTEM despite i use the same password. I encountered ORA-01017: invalid username/password; logon denied error when try to connect from SQL.Plus.
Moreover when try run ”sqlplus / as sysdba” from terminal i get ORA-01031: insufficient privileges. Could you please advise when could I make mistake? Regards, Lukasz jnewjnew.
Could you add a warning that newer version of sqldeveloper need java 8? I tried to install the 4.1.2 version and got this: /Downloads sudo /opt/sqldeveloper/sqldeveloper.sh Oracle SQL Developer Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. Type the full pathname of a JDK installation (or Ctrl-C to quit), the path will be stored in /home/engelhard/.sqldeveloper/4.1.0/product.conf /usr/lib/jvm/java-7-oracle Found /usr/lib/jvm/java-7-oracle/bin/java to run this product, and the major version of this Java is 1.7.
The mandatory minimum major version to run this product is 1.8. This product cannot run with this Java. Thanks a lot Mike. Oracle installation is successful.
In my case the only difference was, the.bashrc file was in /home path. I am facing 2 problems. Running the desktop shortcut of Oracle-XE file after the oracle installtion is completed. FYI, I have given it the execute permissionn. Whenever I am running this shortcut, is triggering: /u01/app/oracle/product/11.2.0/xe/config/scripts/gettingstarted.sh $cat gettiingstarted.sh for i in firefox mozilla konqueror; do if test -x “/usr/bin/$i”; then /usr/bin/$i exit $? Fi done $ -After double-clicking the shortcut its open a webpage with “page cannot be displayed” error. Can you help to fix this?
I am unable to download sql developer package from Oracle site. IS there any other source I can download it from?
Hi Mike, Let me tell you, I’m studying computer science in Costa Rica and this class is about database application, I’ve been trying to install Oracle 11g for over a day and until today and your very specific steps I was able to do it. There are some things in your blog that could be updated like the version of the software that you use, however I am very new using Linux terminal and I manage to get the installation done. I would like to translate your instructions to Spanish so any one can have access to this brilliant installation. Greetings, Lic. Mike, After installing Oracle Express 11g in accordance with the procedure described and starting and using Oracle quite successfully, I had occasion to shut down my computer for about an hour. Now Oracle does not run and ‘service oracle-xe start’ after a reboot will not start it.
I should also mention that, when Oracle was running, I was not able to compile some Pro.C programs I had previously written, because, when the makefile called ‘proc’, it failed with the message “PCC-F-NOERRFILE, unable to open error message file, facility PR2”. Can you help? Thank you very much/ Timothy Mann. Hello Mike, thank you for the perfect installing instructions. I also tried a few other sites and none of them worked. I noticed a few people here had trouble logging in on sqlplus, and I was actually one of them (I normally don’t use SQL Developer too much, not even at work, so didn’t install it on my PC). After we carefully follow your instructions and finish installing oracle, there’s actually more to do!
Let me share my experience: At some point during installation, a new user by the name of “oracle” is (mysteriously) created on the Ubuntu OS. After successfully installing oracle-xe according to the instructions, I started the server: sudo service oracle-xe start This is where the instructions leave off. After much fiddling around and searching the internet, I was able to log into sqlplus using the following commands: su –login oracle (here’s where the mysterious oracle user became useful!) sqlplus / as sysdba (to actually login to sqlplus) Finally, once I got into sqlplus I executed the following: SQL select. from allusers; and found out that oracle had not yet created me as a user! Which is why I couldn’t log in using sqlplus myusername/mypassword in the first place. So I did some more searching around and executed the following: SQL create user identified by; SQL grant all privileges to myusername; (there’s also: SQL grant create session, grant any privilege to myusername;) And verified I was created as a user by: SQL select.
from dbasysprivs where grantee = ‘username’; After that, I exited SQL, logged out of user ‘oracle’ and back to my user, and logged into sqlplus again using: sqlplus myusername/mypassword And that’s my story. I guess you could say I got into sqlplus through a back door! Also I updated my sqlplus to gqlplus which has command line history and convenient command editing abilities just like the OS command line. Best of luck!