firewalldの構成
ORDSは一般ユーザーの権限で動作させるため、HTTPやHTTPSのポート(80および443)の接続を待ち受けることはできません。代わりにポート8080と8443を使用します。firewalldではHTTP(ポート80)の接続をポート8080、HTTPS(ポート443)の接続をポート8443へ転送します。また、HTTPとHTTPSへの接続を許可します。
firewall-cmd --add-service=https
firewall-cmd --add-service=http
firewall-cmd --add-forward-port=port=443:proto=tcp:toport=8443
firewall-cmd --add-forward-port=port=80:proto=tcp:toport=8080
firewall-cmd --runtime-to-permanent
firewall-cmd --reload
firewall-cmd --list-all
[root@localhost ~]# firewall-cmd --add-service=https
success
[root@localhost ~]# firewall-cmd --add-service=http
success
[root@localhost ~]# firewall-cmd --add-forward-port=port=443:proto=tcp:toport=8443
success
[root@localhost ~]# firewall-cmd --add-forward-port=port=80:proto=tcp:toport=8080
success
[root@localhost ~]# firewall-cmd --runtime-to-permanent
success
[root@localhost ~]# firewall-cmd --reload
success
[root@localhost ~]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: enp0s3
sources:
services: cockpit dhcpv6-client http https ssh
ports:
protocols:
forward: no
masquerade: no
forward-ports:
port=443:proto=tcp:toport=8443:toaddr=
port=80:proto=tcp:toport=8080:toaddr=
source-ports:
icmp-blocks:
rich rules:
[root@localhost ~]#
Java Development Kitのインストール
Oracle Javaのページを開き、Download Javaをクリックしてダウンロード・ページに移動します。
[root@localhost ~]# 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 10.5M 0 0:00:16 0:00:16 --:--:-- 10.8M
[root@localhost ~]#
[root@localhost ~]# dnf -y localinstall jdk-17_linux-x64_bin.rpm
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 0:53:37 ago on Wed Nov 15 11:31:17 2023.
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing:
jdk-17 x86_64 2000:17.0.9-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.9-11.x86_64 1/1
Running scriptlet: jdk-17-2000:17.0.9-11.x86_64 1/1
Verifying : jdk-17-2000:17.0.9-11.x86_64 1/1
Installed:
jdk-17-2000:17.0.9-11.x86_64
Complete!
[root@localhost ~]#
[root@localhost ~]# java -version
java version "17.0.9" 2023-10-17 LTS
Java(TM) SE Runtime Environment (build 17.0.9+11-LTS-201)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.9+11-LTS-201, mixed mode, sharing)
[root@localhost ~]#
Oracle REST Data Servicesのインストール
https://yum.oracle.com/repo/OracleLinux/OL8/oracle/software/x86_64/
dnf -y --repofrompath ol8_oracle_software,http://yum.oracle.com/repo/OracleLinux/OL8/oracle/software/x86_64 install ords
[root@localhost ~]# dnf -y --repofrompath ol8_oracle_software,http://yum.oracle.com/repo/OracleLinux/OL8/oracle/software/x86_64 install ords
Failed to set locale, defaulting to C.UTF-8
Added ol8_oracle_software repo from http://yum.oracle.com/repo/OracleLinux/OL8/oracle/software/x86_64
ol8_oracle_software 40 kB/s | 105 kB 00:02
Last metadata expiration check: 0:00:01 ago on Wed Nov 15 12:26:59 2023.
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing:
ords noarch 23.3.0-10.el8 ol8_oracle_software 107 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 376 kB/s | 253 kB 00:00
(2/2): ords-23.3.0-10.el8.noarch.rpm 3.2 MB/s | 107 MB 00:33
--------------------------------------------------------------------------------
Total 3.2 MB/s | 108 MB 00:33
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.3.0-10.el8.noarch 2/2
Installing : ords-23.3.0-10.el8.noarch 2/2
Running scriptlet: ords-23.3.0-10.el8.noarch 2/2
INFO: Before starting ORDS service, run the below command as user oracle:
ords --config /etc/ords/config install
INFO: To enable the ORDS service during startup, run the below command:
sudo systemctl enable ords
Verifying : lsof-4.93.2-1.el8.x86_64 1/2
Verifying : ords-23.3.0-10.el8.noarch 2/2
Installed:
lsof-4.93.2-1.el8.x86_64 ords-23.3.0-10.el8.noarch
Complete!
[root@localhost ~]#
Oracle REST Data Servicesの構成
ORDSコマンドを実行するときに構成ディレクトリが未指定だとカレント・ディレクトリを構成ディレクトリと見做します。作業は/etc/ords/config上で実施します。
[root@localhost ~]# su - oracle
Last login: Thu May 18 11:04:18 JST 2023 on pts/0
[oracle@localhost ~]$ export PATH=/usr/local/bin:$PATH
[oracle@localhost ~]$ cd /etc/ords/config
[oracle@localhost config]$
ords install
[oracle@localhost config]$ ords install
2023-05-18T02:06:00Z INFO ORDS has not detected the option '--config' and this will be set up to the default directory.
ORDS: Release 23.1 Production on Thu May 18 02:06:02 2023
Copyright (c) 2010, 2023, 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]:
Enter the HTTP port [8080]:
Enter the APEX static resources location: /home/oracle/i
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.http.port was set to: 8080
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
2023-05-18T02:07:03.819Z INFO Installing Oracle REST Data Services version 23.1.2.r1151944 in FREEPDB1
------------------------------------------------------------
Date : 18 May 2023 02:07:03
Release : Oracle REST Data Services 23.1.2.r1151944
Type : ORDS Install
Database : Oracle Database 23c Free,
DB Version : 23.2.0.0.0
------------------------------------------------------------
Container Name: FREEPDB1
[中略]
Mapped local pools from /etc/ords/config/databases:
/ords/ => default => VALID
2023-05-18T02:07:32.334Z INFO Oracle REST Data Services initialized
Oracle REST Data Services version : 23.1.2.r1151944
Oracle REST Data Services server info: jetty/10.0.12
Oracle REST Data Services java info: Java HotSpot(TM) 64-Bit Server VM 17.0.7+8-LTS-224
Oracle APEXの接続確認
ORDSの自動起動の設定
Oracle REST Data Services java info: Java HotSpot(TM) 64-Bit Server VM 17.0.7+8-LTS-224
^C[oracle@localhost config]$
[oracle@localhost config]$
ords config set --global db.invalidPoolTimeout 30s
[oracle@localhost config]$ ords config set --global db.invalidPoolTimeout 30s
2023-05-22T09:35:27Z INFO ORDS has not detected the option '--config' and this will be set up to the default directory.
ORDS: Release 23.1 Production on Mon May 22 09:35:29 2023
Copyright (c) 2010, 2023, Oracle.
Configuration:
/etc/ords/config/
The global setting named: db.invalidPoolTimeout was set to: 30s
[oracle@localhost config]$
[oracle@localhost config]$ exit
logout
[root@localhost ~]#
systemctl enable ords
[root@localhost ~]# systemctl enable ords
Synchronizing state of ords.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable ords
Created symlink /etc/systemd/system/multi-user.target.wants/ords.service → /etc/systemd/system/ords.service.
Created symlink /etc/systemd/system/graphical.target.wants/ords.service → /etc/systemd/system/ords.service.
[root@localhost ~]#
systemctl stop ords
systemctl start ords
[root@localhost ~]# systemctl stop ords
[root@localhost ~]# systemctl start ords
[root@localhost ~]#
先ほどと同様にOracle APEXの管理サービスに接続できることを確認します。