Installing Oracle, Apache and ORDS In Docker

Nonni World
0

In this guide, I will walk you through the process of setting up Oracle 23c Free Database, Oracle APEX (Application Express), ORDS (Oracle REST Data Services), and Oracle SQLcl in a Docker container. While the VM Appliance comes preloaded with these tools, this guide focuses on the Docker environment for greater flexibility and ease of use.


Oracle Apex, ORDS in Docker

However, you don't need to download anything now - I'll show you how to do it quickly via the command line.

If you already have Docker running, you can skip the first section about installation and proceed to the "Getting Docker to Work" section.

If you don't have Docker installed, follow the steps outlined below. The details will differ depending on your platform/OS.

Installation Steps

- For Max. First, install Brew, Colima, or Docker. You can follow the instructions in this guide.

- For Windows. The process is straightforward. Just make sure Docker is running and start Docker Desktop.

- For Unix. Install Docker using the following commands in your terminal.


Step1: Install Docker Ensure you have Docker installed on your system. you can check the version or install Docker using the following commands.:

Docker version / docker --version

# OR

sudo yum install docker -y


Step2: Pull and Run Oracle 23ai Free Database container Pull the Oracle 23ai free database docker image and run it with specific port mapping to avoid conflicts.

docker pull container-registry.oracle.com/database/free:latest 

docker run -d -it --name 23cfree -p 8521:1521 -p 8500:5500 -p 8023:8080 -p 9043:8443 -p 9922:22 -e ORACLE_PWD=oracle container-registry.oracle.com/database/free:latest 

docker exec -it 23cfree /bin/bash


Step3: Setup Oracle Apex Inside the container download and install Oracle Apex.

curl -o apex-latest.zip https://download.oracle.com/otn_software/apex/apex-latest.zip 

unzip apex-latest.zip 

rm apex-latest.zip 

cd apex


Step4: Configure Oracle Apex Allow the Oracle Database to settle, then open SQL *Plus and set the PDB.

mkdir /home/oracle/software 

mkdir /home/oracle/software/apex 

mkdir /home/oracle/software/ords 

mkdir /home/oracle/scripts 

cp -r /home/oracle/apex/images /home/oracle/software/apex

su

cat /dev/null > /etc/dnf/vars/ociregion 

dnf update -y 

dnf install sudo -y 

dnf install nano -y

nano /etc/sudoers


# in the Defaults section, add the following

Default !lecture

# Add the following at the end

oracle ALL=(ALL) NOPASSD: ALL

# This is to add oracle user in sudoes list

# so that user oracle can execute sudo command without password

save the file and exit it out.

dnf install java-17-openjdk -y 

java -version 

mkdir /etc/ords 

mkdir /etc/ords/config 

mkdir /home/oracle/logs 

chmod -R 777 /etc/ords 

yum-config-manager --add-repo=http://yum.oracle.com/repo/OracleLinux/OL8/oracle/software/x86_64 

dnf install ords -y 

export _JAVA_OPTIONS="-Xms512M -Xmx512M" 

ords --config /etc/ords/config install

# Follow the configuration steps 
Installation Type > Choose option [2] Enter 
Connection Type > Choose option [1] Enter 
host name > Enter 
listen port > Enter 
service name > FREEPDB1 
administrator username > SYS 
password > oracle 
default tablespace > Enter 
temp tablespace > Enter 
features > Enter 
Start ORDS > [1] Enter <-- Standalone Mode 
protocol > [1] < http 
port > [1] <-- 8080 
Static Resources > /home/oracle/software/apex/images

Press open for Static Resources and copy and paste the path as above
Once above step completed Press Save and Install

ORDS will then be configured. It will take 1-2 mins. You should now see below.
Oracle REST Data Service version: 23.1.0.r0861423
Oracle REST Data Services server into: jetty/10.0.12
Oracle REST Data Services java info: OpenJDK 64-Bit Server VM 17.0.6+10-LTS

you can now check http://localhost:8023/ords/ in the browser for the apex.

Step6: Create Startup and Shutdown Scripts.
Create scripts for starting, stopping, and to auto-start ORDS.

# Create an ORDS startup script 
nano /home/oracle/scripts/start_ords.sh 

# Paste in the script 
export ORDS_HOME=/usr/local/bin/ords 
export _JAVA_OPTIONS="-Xms512M -Xmx512M" 
LOGFILE=/home/oracle/logs/ords-`date +"%Y""%m""%d"`.log 
nohup ${ORDS_HOME} --config /etc/ords/config serve >> $LOGFILE 2>&1 & echo "View log file with : tail -f $LOGFILE" 

# Create a stop_ords.sh file 
nano /home/oracle/scripts/stop_ords.sh 

# Paste in the script 
kill `ps -ef | grep [o]rds.war | awk '{print $2}'` 

# create script to start ordsautomatically when image runs 
nano /opt/oracle/scripts/startup/01_auto_ords.sh 

# Paste this in the script 
sudo sh /home/oracle/scripts/start_ords.sh 

exit


Step7: Final Steps and Enjoy.

Exit the Docker container, restart the container, and access APEX, and install sqlCL if needed.

docker install 23cfree




# Wait 60 seconds and access APEX at localhost:8023/ords/apex

# Workspace > INTERNAL

# Username > ADMIN

# Password > the Complex Password

Now you can also install sqlCL if you want

dnf install sqlcl -y 

# check if sqlcl installed properly 

# sql sys/oracle as sysdba 

SQL> help 

SQL> exit

 

By following this comprehensive guide, you'll be able to run Oracle 23ai Free Database with APEX and ORDS in a Docker container, creating a flexible and scalable environment for your development needs. Enjoy the seamless integration of these powerful tools and elevate your database development experience.

Post a Comment

0 Comments
Post a Comment (0)

#buttons=(Ok, Go it!) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Ok, Go it!
To Top