Oracle 23c Free Docker, APEX & ORDS all in one simple guide
docker run -d --name apexdb -p 1521:1521 -p 8443:8443 -e ORACLE_PWD=<SYSのパスワード> container-registry.oracle.com/database/free:latest
% docker run -d --name apexdb -p 1521:1521 -p 8443:8443 -e ORACLE_PWD=******** container-registry.oracle.com/database/free:latest
de36227ae6e65f4fefb354d3cd899573a7c6235da2981cb56bbb2217f3e0514f
% docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
de36227ae6e6 container-registry.oracle.com/database/free:latest "/bin/bash -c $ORACL…" 18 seconds ago Up 16 seconds (health: starting) 0.0.0.0:1521->1521/tcp, :::1521->1521/tcp, 0.0.0.0:8443->8443/tcp, :::8443->8443/tcp apexdb
%
状態がhealtyになったところで、手元のPCにダウンロードしたOracle APEXのインストール・メディア(を展開したもの)から、APEXのインストールを行います。コンテナにはAPEXを含めず、静的リソースはCDNから参照するようにします。
sql sys@localhost/freepdb1 as sysdba
apex % sql sys@localhost/freepdb1 as sysdba
SQLcl: 木 3月 14 15:10:15 2024のリリース23.4 Production
Copyright (c) 1982, 2024, Oracle. All rights reserved.
パスワード (**********?) ******
接続先:
Oracle Database 23c Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free
Version 23.3.0.23.09
SQL>
静的リソースの参照先としてCDNのURLを与えて、APEXをインストールします。
@apexins SYSAUX SYSAUX TEMP https://static.oracle.com/cdn/apex/23.2.0/
インストールが完了するまで待ちます。
SQL> @apexins SYSAUX SYSAUX TEMP https://static.oracle.com/cdn/apex/23.2.0/
...set_appun.sql
PL/SQLプロシージャが正常に完了しました。
:CDB
_______
YES
:CDB_ROOT
____________
NO
:META_LINK
_____________
LOCAL
...set_ufrom_and_upgrade.sql
PL/SQLプロシージャが正常に完了しました。
[中略]
APEXのインストールが終了したら、続けて日本語リソースをインストールします。
iming for: Phase 3 (Switch)
Elapsed: 1.82
timing for: Complete Installation
Elapsed: 48.33
SYS> @load_trans JAPANESE
PL/SQLプロシージャが正常に完了しました。
Installing Oracle APEX translation - JAPANESE
. ORACLE
.
. Application Express Hosted Development Service Installation.
..............................................................
PL/SQLプロシージャが正常に完了しました。
--application/set_environment
API Last Extended:20231031
[中略]
日本語リソースのインストールが終了したら、ユーザーAPEX_PUBLIC_USERをアンロックします。
...done
Adjust instance settings
PL/SQLプロシージャが正常に完了しました。
SYS> alter user apex_public_user account unlock no authentication;
User APEX_PUBLIC_USERが変更されました。
SYS>
APEXの管理者ユーザー(デフォルトはADMIN)とパスワードを設定します。
SYS> @apxchpwd
...set_appun.sql
================================================================================
This script can be used to change the password of an Oracle APEX
instance administrator. If the user does not yet exist, a user record will be
created.
================================================================================
Enter the administrator's username [ADMIN]
User "ADMIN" does not yet exist and will be created.
Enter ADMIN's email [ADMIN]
Enter ADMIN's password [] *********
Created instance administrator ADMIN.
SYS> exit
Oracle Database 23c Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free
Version 23.3.0.23.09から切断されました
apex %
% docker exec -it apexdb su
[root@de36227ae6e6 oracle]#
JDK17の最新版をダウンロードします。
curl -OL https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.rpm
[root@de36227ae6e6 oracle]# curl -OL https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.rpm
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 173M 100 173M 0 0 8354k 0 0:00:21 0:00:21 --:--:-- 7841k
[root@de36227ae6e6 oracle]#
ダウンロードしたRPMをインストールします。
dnf -y localinstall jdk-17_linux-x64_bin.rpm
[root@de36227ae6e6 oracle]# dnf -y localinstall jdk-17_linux-x64_bin.rpm
Oracle Linux 8 BaseOS Latest (x86_64) 6.3 kB/s | 3.6 kB 00:00
Oracle Linux 8 BaseOS Latest (x86_64) 6.3 MB/s | 71 MB 00:11
Oracle Linux 8 Application Stream (x86_64) 24 kB/s | 3.9 kB 00:00
Oracle Linux 8 Application Stream (x86_64) 7.6 MB/s | 55 MB 00:07
Oracle Linux 8 Development Packages (x86_64) 15 kB/s | 3.3 kB 00:00
Oracle Linux 8 Development Packages (x86_64) 7.1 MB/s | 125 MB 00:17
Last metadata expiration check: 0:01:09 ago on Thu Mar 14 07:59:17 2024.
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing:
jdk-17 x86_64 2000:17.0.10-11 @commandline 174 M
Transaction Summary
================================================================================
Install 1 Package
Total size: 174 M
Installed size: 303 M
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : jdk-17-2000:17.0.10-11.x86_64 1/1
Running scriptlet: jdk-17-2000:17.0.10-11.x86_64 1/1
jexec setup failed
Verifying : jdk-17-2000:17.0.10-11.x86_64 1/1
Installed:
jdk-17-2000:17.0.10-11.x86_64
Complete!
[root@de36227ae6e6 oracle]#
dnf -y --repofrompath ol8_oracle_software,http://yum.oracle.com/repo/OracleLinux/OL8/oracle/software/x86_64 install ords
[root@de36227ae6e6 oracle]# dnf -y --repofrompath ol8_oracle_software,http://yum.oracle.com/repo/OracleLinux/OL8/oracle/software/x86_64 install ords
Added ol8_oracle_software repo from http://yum.oracle.com/repo/OracleLinux/OL8/oracle/software/x86_64
ol8_oracle_software 175 kB/s | 109 kB 00:00
Last metadata expiration check: 0:00:02 ago on Thu Mar 14 08:04:52 2024.
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing:
ords noarch 23.4.0-8.el8 ol8_oracle_software 108 M
Installing dependencies:
lsof x86_64 4.93.2-1.el8 ol8_baseos_latest 253 k
Transaction Summary
================================================================================
Install 2 Packages
Total download size: 108 M
Installed size: 113 M
Downloading Packages:
(1/2): lsof-4.93.2-1.el8.x86_64.rpm 940 kB/s | 253 kB 00:00
(2/2): ords-23.4.0-8.el8.noarch.rpm 7.7 MB/s | 108 MB 00:14
--------------------------------------------------------------------------------
Total 7.7 MB/s | 108 MB 00:14
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : lsof-4.93.2-1.el8.x86_64 1/2
Running scriptlet: ords-23.4.0-8.el8.noarch 2/2
Installing : ords-23.4.0-8.el8.noarch 2/2
Running scriptlet: ords-23.4.0-8.el8.noarch 2/2
INFO: Before starting ORDS service, run the below command as user oracle:
ords --config /etc/ords/config install
Verifying : lsof-4.93.2-1.el8.x86_64 1/2
Verifying : ords-23.4.0-8.el8.noarch 2/2
Installed:
lsof-4.93.2-1.el8.x86_64 ords-23.4.0-8.el8.noarch
Complete!
[root@de36227ae6e6 oracle]#
ORDSを構成します。
[root@de36227ae6e6 oracle]# su - oracle
Last login: Thu Mar 14 06:03:27 UTC 2024
[oracle@de36227ae6e6 ~]$ cd /etc/ords/config
[oracle@de36227ae6e6 config]$ ords install
2024-03-14T08:07:44Z INFO ORDS has not detected the option '--config' and this will be set up to the default directory.
ORDS: Release 23.4 Production on Thu Mar 14 08:07:54 2024
Copyright (c) 2010, 2024, Oracle.
Configuration:
/etc/ords/config/
The configuration folder /etc/ords/config does not contain any configuration files.
Oracle REST Data Services - Interactive Install
Enter a number to select the type of installation
[1] Install or upgrade ORDS in the database only
[2] Create or update a database pool and install/upgrade ORDS in the database
[3] Create or update a database pool only
Choose [2]:
Enter a number to select the database connection type to use
[1] Basic (host name, port, service name)
[2] TNS (TNS alias, TNS directory)
[3] Custom database URL
Choose [1]:
Enter the database host name [localhost]:
Enter the database listen port [1521]:
Enter the database service name [orcl]: freepdb1
Provide database user name with administrator privileges.
Enter the administrator username: sys
Enter the database password for SYS AS SYSDBA: *********
Connecting to database user: SYS AS SYSDBA url: jdbc:oracle:thin:@//localhost:1521/freepdb1
Retrieving information.
Enter the default tablespace for ORDS_METADATA and ORDS_PUBLIC_USER [SYSAUX]:
Enter the temporary tablespace for ORDS_METADATA and ORDS_PUBLIC_USER [TEMP]:
Enter a number to select additional feature(s) to enable:
[1] Database Actions (Enables all features)
[2] REST Enabled SQL and Database API
[3] REST Enabled SQL
[4] Database API
[5] None
Choose [1]:
Enter a number to configure and start ORDS in standalone mode
[1] Configure and start ORDS in standalone mode
[2] Skip
Choose [1]:
Enter a number to select the protocol
[1] HTTP
[2] HTTPS
Choose [1]: 2
Enter the HTTPS port [8443]:
Enter a number to select the certificate type
[1] Use self-signed certificate (generates automatically)
[2] Use my SSL certificate (requires SSL certificate and SSL certificate private key)
Choose [1]:
Enter the SSL hostname: localhost
Enter the APEX static resources location: /home/oracle/i
2024-03-14T08:10:00.134Z WARNING The apex images folder /home/oracle/i does not exist.
The setting named: db.connectionType was set to: basic in configuration: default
The setting named: db.hostname was set to: localhost in configuration: default
The setting named: db.port was set to: 1521 in configuration: default
The setting named: db.servicename was set to: freepdb1 in configuration: default
The setting named: plsql.gateway.mode was set to: proxied in configuration: default
The setting named: db.username was set to: ORDS_PUBLIC_USER in configuration: default
The setting named: db.password was set to: ****** in configuration: default
The setting named: feature.sdw was set to: true in configuration: default
The global setting named: database.api.enabled was set to: true
The setting named: restEnabledSql.active was set to: true in configuration: default
The setting named: security.requestValidationFunction was set to: ords_util.authorize_plsql_gateway in configuration: default
The global setting named: standalone.https.port was set to: 8443
The global setting named: standalone.https.host was set to: localhost
The global setting named: standalone.static.path was set to: /home/oracle/i
The global setting named: standalone.static.context.path was set to: /i
The global setting named: standalone.context.path was set to: /ords
The global setting named: standalone.doc.root was set to: /etc/ords/config/global/doc_root
2024-03-14T08:10:04.309Z INFO Created folder /etc/ords/config/logs
2024-03-14T08:10:04.310Z INFO The log file is defaulted to the current wo
Mapped local pools from /etc/ords/config/databases:
/ords/ => default => VALID
2024-03-14T08:14:10.412Z INFO Oracle REST Data Services initialized
Oracle REST Data Services version : 23.4.0.r3461619
Oracle REST Data Services server info: jetty/10.0.18
Oracle REST Data Services java info: Java HotSpot(TM) 64-Bit Server VM 17.0.10+11-LTS-240
ファイル01_ords.shを以下の内容で作成します。
[oracle@de36227ae6e6 startup]$ cat 01_ords.sh
#!/bin/sh
nohup /usr/local/bin/ords --config /etc/ords/config serve > /home/oracle/ords.log 2>&1 &
[oracle@de36227ae6e6 startup]$
以上でORDSの構成も完了です。
docker restart apexdb
以下のURLに接続します。データベースとORDSが起動するまでに少々時間がかかります。
docker stop apexdb
docker commit apexdb apexdb:v1
保存したイメージから同じ条件でコンテナapexdb2を作成します。