2022年11月22日火曜日

Oracle APEXの環境作成(5) - APEXのインストール

作成したオラクル・データベースにOracle APEXをインストールします。


Oracle APEXのインストール



Oracle APEXのインストール・メディアをダウンロードするページを開きます。ダウンロードできる最新のOracle APEXのバージョンを確認します。
https://www.oracle.com/tools/downloads/apex-downloads.html

2023年11月15日現在、23.2が最新のバージョンです。


Oracle APEXのメディアも、仮想マシンより取得できます。Use this link for the latest version updateのリンクをcurlコマンドを使ってダウンロードします。
https://download.oracle.com/otn_software/apex/apex-latest.zip

オラクル・データベースのRPMをインストールすると、ユーザーoracleとグループoinstallが作成されます。Oracle APEXのインストールはユーザーoracleにて実行します。

su - oracle

[root@localhost ~]# su - oracle

Last login: Thu May 18 09:59:15 JST 2023 on pts/0

[oracle@localhost ~]$ 


Oracle APEXのインストールに使用するZIPファイルを取得します。作業はユーザーoracleのホーム・ディレクトリ/home/oracleで行います。

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

[oracle@localhost ~]$ curl -OL https://download.oracle.com/otn_software/apex/apex-latest.zip

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100  244M  100  244M    0     0  10.7M      0  0:00:22  0:00:22 --:--:-- 10.4M

[oracle@localhost ~]$ 


ダウンロードされたapex-latest.zipunzipします。apexというディレクトリ以下にzipファイルの内容が展開されます。

unzip apex-latest.zip

[oracle@localhost ~]$ unzip apex-latest.zip 

Archive:  apex-latest.zip

  inflating: META-INF/MANIFEST.MF    

  inflating: META-INF/ORACLE_C.SF    

  inflating: META-INF/ORACLE_C.RSA   

   creating: apex/

  inflating: apex/apxappcon.sql      

  inflating: apex/coreins4.sql       

  inflating: apex/apxremov1.sql      

  inflating: apex/dbcsconf.sql       

  inflating: apex/apexins_nocdb.sql  

  inflating: apex/apexins_cdb.sql 

   

[中略]


  inflating: apex/apex_rest_config_nocdb.sql  

  inflating: apex/apxremov_cdb.sql   

  inflating: apex/coreins3.sql       

[oracle@localhost ~]$ 


ダウンロードしたメディアのAPEXのバージョンを確認します。images以下のapex_version.txtの内容を表示します。

cat apex/images/apex_version.txt

[oracle@localhost ~]$ cat apex/images/apex_version.txt

Application Express Version:  23.2

[oracle@localhost ~]$ 


APEXのアプリケーションが必要とする静的ファイルを/i/23.2.0にコピーします。23.2.0の部分はインストールするAPEXのバージョンによって変わります。

mkdir i
cp -r -p apex/images i/23.2.0

[oracle@localhost ~]$ mkdir i

[oracle@localhost ~]$ cp -r -p apex/images i/23.2.0

[oracle@localhost ~]$ 


これらのファイルをCDNから取得するようにOracle APEXを構成する場合は、/i/23.2.0の作成は必ずしも必要ではありません。

作成されたディレクトリapexへ移動します。

cd apex

[oracle@localhost ~]$ cd apex

[oracle@localhost apex]$ 


ユーザーsysでPDB、FREEPDB1に接続し、Oracle APEXのインストール・スクリプトapexins.sqlを実行します。インストール・スクリプトに与える引数はSYSAUX SYSAUX TEMP /i/23.2.0/です。APEXのインストール先となる表領域として標準で作成済みのSYSAUXを指定しています。一時表領域としてTEMPを使い、イメージのパスには複数のAPEXのバージョンを同時にホストするため、バージョン番号を加えて/i/23.2.0/としています。

NLS_LANGとして、必ずAmerican_America.AL32UTF8を設定します。

export NLS_LANG=American_America.AL32UTF8
. oraenv
ORACLE_SID = [oracle] ? FREE
sqlplus sys/*******@localhost/freepdb1 as sysdba
@apexins SYSAUX SYSAUX TEMP /i/23.2.0/

[oracle@localhost apex]$ export NLS_LANG=American_America.AL32UTF8

[oracle@localhost apex]$ . oraenv

ORACLE_SID = [oracle] ? FREE

The Oracle base has been set to /opt/oracle

[oracle@localhost apex]$ sqlplus sys/********@localhost/freepdb1 as sysdba


SQL*Plus: Release 23.0.0.0.0 - Developer-Release on Thu May 18 10:32:09 2023

Version 23.2.0.0.0


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



Connected to:

Oracle Database 23c Free, Release 23.0.0.0.0 - Developer-Release

Version 23.2.0.0.0


SQL> @apexins SYSAUX SYSAUX TEMP /i/23.2.0/

...set_appun.sql


PL/SQL procedure successfully completed.














...set_ufrom_and_upgrade.sql


PL/SQL procedure successfully completed.







Session altered.



FOO3

------------------------------

install2023-05-18_10-32-33.log


. ORACLE

.

. Oracle APEX Installation.

..........................................


[中略]


The structure of the link to the Oracle APEX development interface is as follows:

http://host:port/ords



timing for: Phase 3 (Switch)

Elapsed:    0.22



timing for: Complete Installation

Elapsed:    6.28


SYS> 


apexins.sqlの終了後、続けて日本語リソースを導入します。load_trans.sqlに引数としてJAPANESEを与えて実行します。

@load_trans JAPANESE

SYS> @load_trans JAPANESE


PL/SQL procedure successfully completed.


Installing Oracle APEX translation - JAPANESE


. ORACLE

.

. Application Express Hosted Development Service Installation.

..............................................................


PL/SQL procedure successfully completed.


--application/set_environment

API Last Extended:20230428

Your Current Version:20230428

This import is compatible with version: 20230428

COMPATIBLE (You should be able to run this import without issues.)


[中略]


--application/pages/page_00203

--application/pages/page_00204

--application/pages/page_00205

--application/pages/page_00206

--application/end_environment

... elapsed: 3.51 sec

...done

Adjust instance settings


PL/SQL procedure successfully completed.


SYS> 


APEXの管理ユーザーの設定を行います。apxchpwd.sqlを実行します。設定するパスワードは以下のルールに従う必要があります。
  • 少なくても1文字の数値を含む。(0123456789)
  • 少なくても1文字の記号を含む。(!"#$%&()``*+,-/:;?_)
  • 少なくても1文字の大文字を含む。
@apxchpwd

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> 


データベース・ユーザーAPEX_PUBLIC_USERアンロックします。パスワードの設定は不要になりました。

alter user apex_public_user no authentication account unlock;

User altered.のメッセージが表示されないかもしれません。その場合は、気にせず継続します。

SQL> alter user apex_public_user no authentication account unlock;


User altered.


SQL> 


以上でOracle APEXのデータベースへのインストールは完了です。sqlplusよりexitします。

exit

SQL> exit

Disconnected from Oracle Database 23c Free, Release 23.0.0.0.0 - Developer-Release

Version 23.2.0.0.0

[oracle@localhost apex]$ 


この後にOracle REST Data Servicesをインストールすることにより、Oracle APEXを利用できるようになります。

続く