Last Modified 2022.2.8

Java Development Environment on Ubutnu 18.04

How to install Oracle 11g XE on Ubuntu

Ubuntu is not a Linux distribution officially supported by Oracle.

You can install Oracle 11g XE on Ubuntu with a few tricks.
Origin: http://meandmyubuntulinux.blogspot.kr/2012/05/installing-oracle-11g-r2-express.html

Visit https://www.oracle.com/database/technologies/xe-prior-release-downloads.html. For 64-bit systems, choose Oracle Database Express Edition 11g Release 2 for Linux x64. You need to log in to download the file. --Sign up if you are not a member of the Oracle website-- When you log in to the site, the download begins. After downloading, go to the directory where the file exists and execute the following command.

unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip
sudo apt install alien unixodbc
sudo apt install libaio1
sudo apt install libaio1 fails in Ubuntu 24.04
Ubuntu 24.04 does not support libaio1.
Install libaio-dev instead.
sudo apt install libaio-dev
Oracle 11g XE still expecting libaio.so.1, so create the following symbolic link:
sudo ln -s /usr/lib/x86_64-linux-gnu/libaio.so.1t64 /usr/lib/x86_64-linux-gnu/libaio.so.1
cd Disk1
sudo alien --scripts -d oracle-xe-11.2.0-1.0.x86_64.rpm

Create a /sbin/chkconfig file.

sudo nano /sbin/chkconfig

Copy and Paste the following into the file.

#!/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: $remote_fs $syslog' >> $file
echo '# Required-Stop: $remote_fs $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

Save the above file and provide appropriate execute privilege.

sudo chmod 755 /sbin/chkconfig

Set the Kernel parameters.

sudo nano /etc/sysctl.d/60-oracle.conf

Copy the following. Paste it into the file.

# Oracle 11g XE kernel parameters  
fs.file-max=6815744  
net.ipv4.ip_local_port_range=9000 65000  
kernel.sem=250 32000 100 128 
kernel.shmmax=536870912

Check the swap memory.

free -m
total       used       free     shared    buffers     cached
Mem:          3942       3809        133        947         50       1571
-/+ buffers/cache:       2186       1756
Swap:         4083        378       3705

Unlike the above, if Swap doesn't exceed 4000, do the following.

sudo ln -s /usr/bin/awk /bin/awk
sudo mkdir /var/lock/subsys
sudo touch /var/lock/subsys/listener

Verify the kernel parameters.

sudo cat /etc/sysctl.d/60-oracle.conf

Load kernel parameters.

sudo service procps restart

Verify.
(In my case, it came out differently from the set value, but I was able to complete the installation)

sudo sysctl -q fs.file-max

Go to the Disk1 directory and run the following commands:

sudo dpkg --install oracle-xe_11.2.0-2_amd64.deb
sudo /etc/init.d/oracle-xe configure
  • Specify the HTTP port that will be used for Oracle Application Express: Set a value other than 8080, like 9090
  • Specify a port the database listener: (just hit Enter)
  • Set passwords for administrator accounts SYS and SYSTEM: Password for Oracle administrators, you specified
  • Do you want Oracle Database 11g Express Edition to be started on boot: (just hit Enter)
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 for database accounts.  
Press Enter to accept the defaults. 
Ctrl-C will abort.

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

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: **********

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

Starting Oracle Net Listener...Done
Configuring database...Done
Starting Oracle Database 11g Express Edition instance...Done
Installation completed successfully.

Set up the environmental variables.

nano ~/.bashrc

Add the following lines to your .bashrc:

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export ORACLE_SID=XE
export NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`
export ORACLE_BASE=/u01/app/oracle
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export PATH=$ORACLE_HOME/bin:$PATH

Execute the following command to load the changes:

source ~/.bashrc

Start the Oracle.

sudo service oracle-xe start

SCOTT Account

Log in as an SYS account and run the SCOTT account schema script.

sqlplus sys as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on 월 6월 29 12:04:33 2015

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Enter password: **********

Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

SQL> @/u01/app/oracle/product/11.2.0/xe/rdbms/admin/utlsampl.sql

MariaDB Install

sudo apt update
sudo apt install mariadb-server

If the installation is completed without errors, run the following command to set the root password. (Press the Enter key for the current password)

sudo mysql_secure_installation

Set the root user to use the mysql_native_password plugin.

sudo mysql

use mysql

update user set plugin='mysql_native_password' where user='root';
flush privileges;
exit

Restart MariaDB.

sudo service mariadb restart

Java Install

sudo apt install default-jdk

Maven Install

sudo apt install maven

Installing the Oracle JDBC driver in local repository

The Maven repository does not provide the Oracle JDBC driver. Therefore, you need to install the Oracle JDBC driver in your local repository and set the dependency on pom.xml.

Run the following.

cd /u01/app/oracle/product/11.2.0/xe/jdbc/lib

mvn install:install-file \
-Dfile=ojdbc6.jar \
-DgroupId=com.oracle \
-DartifactId=ojdbc6 \
-Dversion=11.2.0.2.0 \
-Dpackaging=jar

The following shows how to add Oracle JDBC driver to pom.xml according to the information stored in the local repository.

<dependency>
  <groupId>com.oracle</groupId>
  <artifactId>ojdbc6</artifactId>
  <version>11.2.0.2.0</version>
</dependency>

Git Install

sudo apt install git
git config --global user.name "John Doe"
git config --global user.email [email protected]
git config --global --list

Tomcat Install

sudo apt install tomcat9

Tomcat Restart

sudo service tomcat9 restart

Changing the Tomcat Root Application

Log in to the root account and run the following.

sudo nano /etc/tomcat9/Catalina/localhost/ROOT.xml

If your project is a maven project and /home/kim/javaschool is the root directory, edit ROOT.xml as shown below.

<?xml version="1.0" encoding="UTF-8"?>
<Context
  docBase="/home/kim/javaschool/src/main/webapp"
  reloadable="true">
</Context>

After installing Ubuntu 18.04, specify the root account password with the following command.

sudo passwd

Run su and enter the root account password.

su
Password:

Tomcat logs

Log in to the root account and run the following command:

tail -f /var/lib/tomcat9/logs/localhost.2019-10-05.log
tail -f /var/lib/tomcat9/logs/catalina.2019-10-05.log

Eclipse Install

Download the installer from https://www.eclipse.org/downloads/ and run the following commands in sequence.

cd Downloads
tar -xvf eclipse-inst-linux64.tar.gz
cd eclipse-installer/
./eclipse-inst

In the installation selection screen, select Eclipse IDE for Enterprise Java Developers.

Eclipse IDE for Enterprise Java Developers

Create eclipse.desktop

cd /usr/share/applications
sudo nano eclipse.desktop

Edit eclipse.desktop file as follows.

[Desktop Entry]
Name=Eclipse
Type=Application
Exec=/home/kim/eclipse/jee-2019-12/eclipse/eclipse
Terminal=false
Icon=/home/kim/eclipse/jee-2019-12/eclipse/icon.xpm
Comment=Integrated Development Environment
NoDisplay=false
Categories=Development;IDE
Name[en]=eclipse.desktop

Customize the paths for Exec and Icon.

Search for eclipse, run it, and pin it to the launcher.

Related Articles