LoginSignup
0
1

More than 1 year has passed since last update.

Oracle Database Express Edition (XE) 18c をCentOS 8.3にインストール

Posted at

はじめに

Oracle Databaseの無料版であるExpress Edition(XE)を構築していきます。今回は18cを使用して、とにかく動かすまでざっとやっていきます。OSはCentOS 8.3です。

CentOS構築

まずはDVDメディア等を使用して初期インストールを行います。ローカルリポジトリの作成の通りリポジトリを用意しておきます。

互換性パッケージをインストール

互換性パッケージをインストールする。個別にインストールが必要なものは下記2つになります。

・compat-libcap1-1.10-7.el7.x86_64.rpm
・compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm

# yum -y localinstall compat-libcap1-1.10-7.el7.x86_64.rpm
依存関係が解決しました。
===================================================================================
 パッケージ            Arch          バージョン          リポジトリー        サイズ
===================================================================================
インストール:
 compat-libcap1        x86_64        1.10-7.el7          @commandline         19 k
# yum -y localinstall compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
依存関係が解決しました。
===================================================================================
 パッケージ               Arch        バージョン           リポジトリー      サイズ
===================================================================================
インストール:
 compat-libstdc++-33      x86_64      3.2.3-72.el7         @commandline      191 k

NSLパッケージインストール

libnsl パッケージをインストールします。
「libnslとは、NIS(YP)に対するクライアントインターフェースを提供します。 これは glibc にて利用されている NIS ライブラリに置き換わるものです。」ということで何のこっちゃよくわかりませんが無いとOracleインストール時にエラーが発生します。

# dnf install libnsl
依存関係が解決しました。
===================================================================================
 パッケージ      Arch            バージョン            リポジトリー          サイズ
===================================================================================
インストール:
 libnsl          x86_64          2.28-127.el8          media-baseos           99 k

SE Linux無効化

個人的には有効で運用されているのを見たことがありません。今回も永続的に無効化します。

まずは現状態を確認します。デフォルトで有効です。

# getenforce
Enforcing

設定ファイルを編集します。

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled  ##ここをenabledからdisabledに変更した
# SELINUXTYPE= can take one of these three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

OSを再起動して再度現状態を確認します。
Disabledと表示それればOKです。

# getenforce
  Disabled

firewalld停止&無効化

今回の環境では不要なので、ファイアウォールを停止して自動起動しない設定に変更します。

# systemctl stop firewalld
# systemctl disable firewalld
# systemctl is-enabled firewalld
disabled

FTP有効化

いつも忘れるのですがよく使うので有効化しておきます。

# systemctl enable vsftpd
# systemctl start vsftpd

Oracleプレインストール

Oracleのプレインストールパッケージをします。
必要なパッケージはこれだけでほとんどインストールされます。

# yum -y localinstall oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm
依存関係が解決しました。
===================================================================================
 パッケージ           Arch   バージョン                      リポジトリー    サイズ
===================================================================================
インストール:
 oracle-database-preinstall-18c
                      x86_64 1.0-1.el7                       @commandline     18 k
依存関係のインストール:
 glibc-devel          x86_64 2.28-127.el8                    media-baseos    1.0 M
 glibc-headers        x86_64 2.28-127.el8                    media-baseos    475 k
 kernel-headers       x86_64 4.18.0-240.el8                  media-baseos    5.5 M
 ksh                  x86_64 20120801-254.el8                media-appstream 926 k
 libaio-devel         x86_64 0.3.112-1.el8                   media-baseos     19 k
 libstdc++-devel      x86_64 8.3.1-5.1.el8                   media-appstream 2.0 M
 libxcrypt-devel      x86_64 4.1.1-4.el8                     media-baseos     25 k
 lm_sensors-libs      x86_64 3.4.0-21.20180522git70f7e08.el8 media-baseos     59 k
 make                 x86_64 1:4.2.1-10.el8                  media-baseos    498 k
 sysstat              x86_64 11.7.3-5.el8                    media-appstream 425 k

トランザクションの概要
===================================================================================
以下略

Oracle Database XEインストール

まずOracle Database本体をインストールします。

# yum -y localinstall oracle-database-xe-18c-1.0-1.x86_64.rpm
依存関係が解決しました。
===================================================================================
 パッケージ                   Arch         バージョン     リポジトリー       サイズ
===================================================================================
インストール:
 oracle-database-xe-18c       x86_64       1.0-1          @commandline       2.3 G

トランザクションの概要
===================================================================================
以下略

次にConfigureを行いインスタンスを生成します。
まずは設定ファイルを確認します。文字セットにSJISを使用する場合は、ここで設定変更します。

/etc/sysconfig/oracle—xe–18c.conf
#This is a configuration file to setup the Oracle Database.
#It is used when running '/etc/init.d/oracle-xe-18c configure'.

# LISTENER PORT used Database listener, Leave empty for automatic port assignment
LISTENER_PORT=

# EM_EXPRESS_PORT Oracle EM Express URL port
EM_EXPRESS_PORT=5500

# Character set of the database
CHARSET=AL32UTF8  ### SJISで作成するにはJA16SJISを設定する

# Database file directory
# If not specified, database files are stored under Oracle base/oradata
DBFILE_DEST=

# SKIP Validations, memory, space
SKIP_VALIDATIONS=false

設定ファイルを準備したらConfigureを行います。

# /etc/init.d/oracle-xe-18c configure
Specify a password to be used for database accounts. Oracle recommends that the 
password entered should be at least 8 characters in length, contain at least 1 u
ppercase character, 1 lower case character and 1 digit [0-9]. Note that the same
 password will be used for SYS, SYSTEM and PDBADMIN accounts:  ###パスワード入力
Confirm the password:  ###確認用パスワード入力
Listener configuration succeeded.
Configuring Oracle Database XE.
SYSユーザー・パスワードを入力してください:
*********
SYSTEMユーザー・パスワードを入力してください:
********
PDBADMINユーザー・パスワードを入力してください:
**********
DB操作の準備
7%完了
データベース・ファイルのコピー中
29%完了
Oracleインスタンスの作成および起動中
30%完了
31%完了
34%完了
38%完了
41%完了
43%完了
データベース作成の完了
47%完了
50%完了
プラガブル・データベースの作成
54%完了
71%完了
構成後アクションの実行
93%完了
カスタム・スクリプトを実行中
100%完了
データベースの作成が完了しました。詳細は、次の場所にあるログ・ファイルを参照してください:
/opt/oracle/cfgtoollogs/dbca/XE。
データベース情報:
グローバル・データベース名:XE
システム識別子(SID):XE
詳細はログ・ファイル"/opt/oracle/cfgtoollogs/dbca/XE/XE.log"を参照してください。

Connect to Oracle Database using one of the connect strings:
     Pluggable database: ol7-oradbxe/XEPDB1
     Multitenant container database: ol7-oradbxe
Use https://localhost:5500/em to access Oracle Enterprise Manager for Oracle Database XE

シェルに環境変数を追加

インストールが成功したら、.bashrcに環境変数を追加します。

.bashrc
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/18c/dbhomeXE
export ORACLE_SID=XE
export PATH=$ORACLE_HOME/bin:$PATH
export LANG=ja_JP.UTF-8
export NLS_LANG=Japanese_Japan.AL32UTF8

ここてORACLE_SIDが抜けていると、下記のようにリスナー名を指定しないログインが失敗するので要注意です。

# sqlplus / as sysdba

Oracle Database自動起動設定と開始

systemctlでOS起動時に自動起動する設定を行います。

# systemctl enable oracle-xe-18c

そしてDatabaseを起動します。

# systemctl start oracle-xe-18c

最後に

CentOS8.3に最小限の設定を行い、Oracle Database XE 18cをインストールしました。18cではプラガブルDBが使えるので、色々と検証する環境が構築できました。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1