Oracle® R Enterpriseインストレーションおよび管理ガイド リリース1.4.1 for Windows, Linux, Solaris, and AIX E57721-01 |
|
前 |
次 |
この付録では、Oracle R EnterpriseをLinuxサーバーおよびWindowsクライアントにインストールするための一般的な手順を説明します。この付録には、次の項が含まれます。
注意: この付録では、Oracle R Enterpriseの初期インストールについて説明します。クライアントまたはサーバーにOracle R Enterpriseコンポーネントがすでに存在する場合、第7.1項「Oracle R Enterpriseのアップグレード」を参照してください。 |
サーバー・コンピュータについて:
サーバーでOracle Linux 5が稼働しています。
サーバーからインターネットおよびOracle Public Yumにアクセスできます。
サーバーにOracle Database Enterprise Edition 12.1がインストールされています。
環境変数:
インストール実行者のLinuxユーザーID:
クライアント・コンピュータについて:
Oracle R Enterpriseをサーバー・コンピュータにインストールするには、まずOracle Databaseがインストールされていること、および第A.1項の指定のとおりに環境が構成されていることを確認します。次に、これらの手順を順序どおりに実行します。
表A-1 Oracle R Enterprise Serverの要件のチェックリスト
質問 | 回答例 |
---|---|
Linuxバージョンは何ですか。 |
% cat /etc/*-release Enterprise Linux Server release 5.6 |
インターネットにアクセスできますか。 |
ブラウザを起動します。 |
rootでログインできますか。 |
% sudo -s Password: --------- # # exit % |
Oracle Databaseはインストールされていますか。 |
% SQLPLUS / as sysdba Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bitProduction With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options > exit % |
|
% echo $ORACLE_HOME /myhome/product/12.1.0.1/dbhome_1 |
|
% echo $ORACLE_SID orcl |
|
% echo $LD_LIBRARY_PATH /myhome/product/12.1.0.1/dbhome_1/lib:.... |
|
% echo $PATH /myhome/product/12.1.0.1/dbhome_1/bin:....... |
dbaグループのメンバーですか。 |
% groups g102 dba |
|
% ls -ld $ORACLE_HOME/lib drwxr-xr-x 3 myuser g102 12288 Jan 27 15:31 /myhome/product/12.1.0.1/dbhome_1/lib/ ... |
Oracle R DistributionをOracle Public Yumからサーバーにインストールするには、次の手順を実行します。
rootでログインして、/etc/yum.repos.d
に変更します。
cd /etc/yum.repos.d
ディレクトリの内容をリストして、Yumの構成ファイルが存在しているかどうかを確認します。Oracle Linux 5用のYumの構成ファイルはpublic-yum-el5.repo
と呼ばれます。
public-yum-el5.repo
が存在しない場合は、次のコマンドを実行してOracle Public Yumからこのファイルをダウンロードします。
wget http://public-yum.oracle.com/public-yum-el5.repo
テキスト・エディタでpublic-yum-el5.repo
を開いて、latest
およびaddons
にenabled=1
を指定します。
[el5_latest] enabled=1 [el5_addons] enabled=1
次のコマンドを実行してOracle R Distribution 3.0.1をインストールします。
yum install R-3.0.1
rootユーザーを終了します。
exit
Oracle R Enterprise Serverには、Oracle Databaseのrqsys
スキーマと、Oracle R Enterpriseパッケージおよび共有ライブラリが含まれます。
Oracle R Enterprise Serverをインストールするには次の手順を実行します。
表A-1「Oracle R Enterprise Serverの要件のチェックリスト」に従って、環境を確認します。
Oracle R Enterprise Serverコンポーネントのインストール・ディレクトリを作成します。ディレクトリには任意の名前を使用できます。例:
/myhome/myoreserver/
Oracle Technology NetworkのOracle R Enterpriseのダウンロード・ページから、Oracle R Enterprise Serverインストール・ファイルおよびSupporting Packagesをダウンロードします。
ライセンス契約に同意して、ご使用のプラットフォーム用のOracle R Enterprise Serverファイルをインストール・ディレクトリにダウンロードします。
ライセンス契約に同意して、ご使用のプラットフォーム用のOracle R Enterprise Supporting Packagesをインストール・ディレクトリにダウンロードします。
インストール・ディレクトリに2つのzipファイルが配置されます。
ore-server-linux-x86-64-1.4.1.zip ore-supporting-linux-x86-64-1.4.1.zip
ファイルを解凍します。
unzip ore-server-linux-x86-64-1.4.1.zip unzip ore-supporting-linux-x86-64-1.4.1.zip
両方のファイルを解凍した後のインストール・ディレクトリは次のようになります。
/myhome/myoreserver ore-server-linux-x86-64-1.4.1.zip ore-supporting-linux-x86-64-1.4.1.zip server.sh /server /supporting
例A-1に示すように、server.sh
を実行して、Oracle R Enterprise Serverのデフォルト・インストールを実行します。スクリプトは対話的に実行されます。ユーザー入力は太字で表示されます。
注意: スクリプトによりプロンプトに[list] と表示されたら、[Enter]を押すと、選択した使用可能なアイテムのリストが表示されます。 |
ktaylor@adc2171704> ./server.sh -i Oracle R Enterprise 1.4.1 Server. Copyright (c) 2012, 2014 Oracle and/or its affiliates. All rights reserved. Checking platform .................. Pass Checking R ......................... Pass Checking R libraries ............... Pass Checking ORACLE_HOME ............... Pass Checking ORACLE_SID ................ Pass Checking sqlplus ................... Pass Checking ORACLE instance ........... Pass Checking CDB/PDB ................... Pass Checking ORE ....................... Pass Choosing RQSYS tablespaces PERMANENT tablespace to use for RQSYS [list]: EXAMPLE SYSAUX SYSTEM USERS PERMANENT tablespace to use for RQSYS [list]: SYSAUX TEMPORARY tablespace to use for RQSYS [list]: TEMP TEMPORARY tablespace to use for RQSYS [list]: TEMP Choosing RQSYS password Password to use for RQSYS: XXXXXXX Choosing ORE user ORE user to use [list]: BI HR IX OE SCOTT SH ORE user to use [list]: ruser2 Choosing RUSER2 tablespaces PERMANENT tablespace to use for RUSER2 [list]: USERS TEMPORARY tablespace to use for RUSER2 [list]: TEMP Choosing RUSER2 password Password to use for RUSER2: Current configuration R Version ...................... Oracle Distribution of R version 3.0.1 (--) R_HOME ......................... /usr/lib64/R R_LIBS_USER .................... /product/12.1.0.1/dbhome_1/R/library ORACLE_HOME .................... /product/12.1.0.1/dbhome_1 ORACLE_SID ..................... orcl Existing R Version ............. None Existing R_HOME ................ None Existing ORE data .............. None Existing ORE code .............. None Existing ORE libraries ......... None RQSYS PERMANENT tablespace ..... SYSAUX RQSYS TEMPORARY tablespace ..... TEMP ORE user type .................. New ORE user name .................. RUSER2 ORE user PERMANENT tablespace ...USERS ORE user TEMPORARY tablespace .. TEMP Grant RQADMIN role ............. No Operation ........................ Install/Upgrade/Setup Proceed? [yes] y Removing R libraries ............... Pass Installing R libraries ............. Pass Installing ORE libraries ........... Pass Installing RQSYS data .............. Pass Configuring ORE .................... Pass Installing RQSYS code .............. Pass Installing ORE packages ............ Pass Creating ORE script ................ Pass Installing migration scripts ....... Pass Installing supporting packages ..... Pass Creating ORE user .................. Pass Granting ORE privileges ............ Pass Done
Oracle R Enterpriseをクライアント・コンピュータにインストールするには、まずWindows環境が第A.1項に指定されている要件を満たしていることを確認します。次に、これらの手順を実行します。
Oracle R Enterpriseをクライアントにインストールするには、次の手順を実行します。
Oracle R Distributionをインストールする前に、ご使用のMicrosoft WindowsのバージョンがOracle R Enterpriseでサポートされていること、およびインターネットにアクセスできることを確認します。
WindowsにOracle R Distributionをインストールするには、次の手順を実行します。
Oracle R Distributionのオープン・ソース・ソフトウェアのダウンロード・ページに移動します。
「R 3.0.1 Downloads」の下で、「Windows 64 bit」の「R Distribution」を選択します。ファイルをコンピュータに保存します。
ORE-3.0.1-win.zip
ファイルを解凍すると、実行可能ファイルが抽出されます。
ORE-3.0.1-win.exe
Oracle R Distributionのインストールを開始するには、実行可能ファイルをダブル・クリックします。
説明に従って、インストールを完了してください。
Oracle R EnterpriseにはOracle Database Clientが必要です。Oracleホーム・ディレクトリにインストールする必要がある完全なDatabase Clientのかわりに、Oracle Instant Clientをインストールすることができます。
Oracle Instant Clientをダウンロードおよびインストールするには、次の手順を実行します。
Oracle R Enterpriseクライアント・コンポーネントのインストール・ディレクトリを作成します。ディレクトリには任意の名前を使用できます。例:
c:\myoreclient
Oracle Technology NetworkのOracle Database Instant Clientページに移動します。
http://www.oracle.com/technetwork/database/features/instant-client/
「See Instant Client Downloads」を選択します。
Instant Client Downloadsページで「Instant Client for Microsoft Windows (x64)」を選択します。
ライセンス契約に同意します。
Oracle Database 12.1の場合は、「Version 12.1.0.1.0」の下の「Instant Client Package - Basic」または「Instant Client Package - Basic Lite」を選択します。
ファイルを、手順1で作成したインストール・ディレクトリに保存します。たとえば、「Basic」パッケージを選択した場合は、次のファイルがダウンロードされます。
c:\myoreclient\instantclient-basic-windows.x64-12.1.0.1.0.zip
ファイルを解凍します。
ファイルを解凍すると、instantclient_12_1
サブディレクトリが作成されます。インストール・ディレクトリの内容は、次のように表示されます。
myoreclient instantclient_12_1 vc10 vc11
Instant Client Downloadsページに戻ります。
http://www.oracle.com/technetwork/topics/winx64soft-089540.html
ライセンス契約に合意して、「Instant Client Package - SDK」を選択します。ファイルを手順1で作成したディレクトリに保存します。
c:\myoreclient\instantclient-sdk-windows.x64-12.1.0.1.0.zip
ファイルを解凍します。
ファイルを解凍すると、sdk
サブディレクトリが作成されます。インストール・ディレクトリの内容は、次のように表示されます。
myoreclient instantclient_12_1 help sdk vc10 vc11
環境変数OCI_LIB64
およびPATH
にInstant Clientのフル・パスを追加します。次の手順では、これらの変数に、この例で使用しているパス、c:\myoreclient\instantclient_12_1
を設定しています。
Windowsの「コントロール・パネル」で「システム」を選択します。
「システムの詳細設定」をクリックします。
「詳細設定」タブで、「環境変数」をクリックします。
「システム環境変数」にOCI_LIB64
が存在しない場合は作成します。OCI_LIB64
の値にc:\oreclient\instantclient_12_1
を設定します。
「システム環境変数」でPATH
を編集してc:\oreclient\instantclient_12_1
を含めます。
注意: 環境変数を作成するグラフィカル・ユーザー・インタフェースは、Windowsのバージョンによってわずかに異なる場合があります。 |
次の手順に従って、Oracle R Enterpriseパッケージをダウンロードおよびインストールします。
Oracle R Enterpriseパッケージをダウンロードするには、次の手順を実行します。
Oracle Technology NetworkのOracle R Enterprise Downloadsページに移動します。
ライセンス契約に同意します。
Windows用のClient Packagesを選択します。ファイルを、第A.3.2項で作成したインストール・ディレクトリに保存します。
c:\myoreclient\ore-client-win-x86_64-1.4.1.zip
ファイルを解凍します。
ファイルを解凍すると、client
サブディレクトリが作成されます。インストール・ディレクトリの内容は、次のように表示されます。
ORE_1.4.1.zip OREbase_1.4.1.zip OREcommon_1.4.1.zip OREdm_1.4.1.zip OREeda_1.4.1.zip OREembed_1.4.1.zip OREgraphics_1.4.1.zip OREmodels_1.4.1.zip OREpredict_1.4.1.zip OREstats_1.4.1.zip ORExml_1.4.1.zip
RコンソールからOracle R Enterpriseパッケージをインストールするには、次の手順を実行します。
Windowsの「スタート」メニューからRを起動します。32ビット版および64ビット版Rの両方をインストールしている場合は、64ビット版Rを選択してください。
例A-2に示すようなRコンソールのウィンドウが表示されます。
次に示すようにパッケージをインストールします。
install.packages("c:/myoreclient/client/ORE_1.4.1.zip", repos=NULL) install.packages("c:/myoreclient/client/OREbase_1.4.1.zip", repos=NULL) install.packages("c:/myoreclient/client/OREcommon_1.4.1.zip", repos=NULL) install.packages("c:/myoreclient/client/OREdm_1.4.1.zip", repos=NULL) install.packages("c:/myoreclient/client/OREeda_1.4.1.zip", repos=NULL) install.packages("c:/myoreclient/client/OREembed_1.4.1.zip", repos=NULL) install.packages("c:/myoreclient/client/OREgraphics_1.4.1.zip", repos=NULL) install.packages("c:/myoreclient/client/OREmodels_1.4.1.zip", repos=NULL) install.packages("c:/myoreclient/client/OREpredict_1.4.1.zip", repos=NULL) install.packages("c:/myoreclient/client/OREstats_1.4.1.zip", repos=NULL) install.packages("c:/myoreclient/client/ORExml_1.4.1.zip", repos=NULL)
各パッケージのインストールが正常に完了するごとに、次のメッセージがRコンソールに表示されます。
package 'package_name' successfully unpacked and MD5 sums checked
次の手順に従って、Oracle R Enterprise Supporting Packagesをダウンロードおよびインストールします。
Oracle R Enterprise Supporting Packagesをダウンロードするには、次の手順を実行します。
Oracle Technology NetworkのOracle R Enterprise Downloadsページに移動します。
ライセンス契約に同意し、Windows用のSupporting Packagesを選択します。ファイルを、第A.3.2項で作成したインストール・ディレクトリに保存します。
c:\myoreclient\ore-supporting-win-x86_64-1.4.1.zip
ファイルを解凍します。
ファイルを解凍すると、supporting
サブディレクトリが作成されます。インストール・ディレクトリの内容は、次のように表示されます。
arules_1.1-3.zip Cairo_1.5-5.zip DBI_0.2-7.zip png_0.1-7.zip ROracle_1.1-12.zip statmod_1.4.20.zip
Supporting PackagesをRコンソールからインストールするには、次の手順を実行します。
Windowsの「スタート」メニューからRを起動します。32ビット版および64ビット版Rの両方をインストールしている場合は、64ビット版Rを選択してください。
Rコンソール・ウィンドウが表示されます。
次に示すようにパッケージをインストールします。
install.packages("c:/myoreclient/supporting/ROracle_1.1-12.zip", repos=NULL) install.packages("c:/myoreclient/supporting/DBI_0.2-7.zip", repos=NULL) install.packages("c:/myoreclient/supporting/png_0.1-7.zip", repos=NULL) install.packages("c:/myoreclient/supporting/Cairo_1.5-5.zip", repos=NULL) install.packages("c:/myoreclient/supporting/arules_1.1-3.zip", repos=NULL) install.packages("c:/myoreclient/supporting/statmod_1.4.20.zip", repos=NULL)
各パッケージのインストールが正常に完了するごとに、次のメッセージがRコンソールに表示されます。
package 'package_name' successfully unpacked and MD5 sums checked
Oracle R Enterpriseの基本的な機能が動作していることを確認するには、Oracle R Enterprise Serverへの接続を確立して、基本的なコマンドをいくつか実行してOracle R Enterpriseのデモ・プログラムの一部を実行します。
注意: Oracle R Enterpriseを起動および使用するには、ユーザーIDにOracle R Enterpriseのインストールに必要とされる権限が必要です。詳細は、第4.3.3項「ユーザー要件」を参照してください。 |
例A-2 Oracle R Enterprise Serverへの接続
Oracle R Enterprise ClientをOracle R Enterprise Serverに接続するには、次の手順を実行します。
Windowsの「スタート」メニューでR x64 3.0.1を選択します。
Rコンソールが表示されます。
次のコマンドを入力してOracle R Enterpriseを起動します。
> library(ORE)
次のコマンドを入力してOracle R Enterprise Serverに接続します。次の例では、ユーザーrquser
をサーバー・ホストserv1
上のデータベースorcl
に、ポート1521を使用して接続しています。
> ore.connect(user="rquser", sid="orcl", host="serv1", password="rquserpsw", port=1521, all=TRUE) Loading required package: ROracle Loading required package: DBI
ore.is.connected
を実行して接続を確認します。接続が正常に確立されている場合は、コマンドによってTRUE
が返されます。
> ore.is.connected() [1] TRUE
例A-3 RQUSERからアクセスできるデータベース表のリスト
ore.ls
コマンドで、現行ユーザーに利用可能なデータ・セットがリストされます。たとえば、TABLE1
およびTABLE2
がrquser
スキーマに存在している場合は、次のように表示されます。
> ore.ls() [1] "TABLE1" "TABLE2"
例A-4 Rデータ・フレームのデータ表へのプッシュ
ore.push
コマンドで、Rデータ・フレームがデータ表に、またはデータ表がRデータ・フレームにプッシュされます。例:
> cars <- ore.push(cars)
例A-5 埋込みR関数の実行
ore.doEval
コマンドで、データベース埋込みRエンジンの指定された関数の実行がスケジュール設定され、実行結果が返されます。
> ore.doEval(function() { 123 }) [1] 123
例A-6 Oracle R Enterpriseのデモ・スクリプトのリスト
Oracle R Enterpriseのデモ・スクリプトは$ORACLE_HOME/R/library/ORE/demo
にあります。demo
で、利用可能なデモのリストが表示されます。
> demo(package="ORE") Demos in package 'ORE': aggregate Aggregation analysis Basic analysis & data processing operations basic Basic connectivity to database binning Binning logic columnfns Column functions cor Correlation matrix crosstab Frequency cross tabulations datastore DataStore operations datetime Date/Time operations derived Handling of derived columns distributions Distribution, density, and quantile functions do_eval Embedded R processing freqanalysis Frequency cross tabulations glm Generalized Linear Models graphics Demonstrates visual analysis group_apply Embedded R processing by group hypothesis Hyphothesis testing functions matrix Matrix related operations nulls Handling of NULL in SQL vs. NA in R odm_ai Oracle Data Mining: attribute importance odm_dt Oracle Data Mining: decision trees odm_glm Oracle Data Mining: generalized linear models odm_kmeans Oracle Data Mining: enhanced k-means clustering odm_nb Oracle Data Mining: naive Bayes classification odm_svm Oracle Data Mining: support vector machines push_pull RDBMS <-> R data transfer rank Attributed-based ranking of observations reg Ordinary least squares linear regression row_apply Embedded R processing by row chunks sampling Random row sampling and partitioning of an ore.frame sql_like Mapping of R to SQL commands stepwise Stepwise OLS linear regression summary Summary functionality table_apply Embedded R processing of entire table
Oracle R Enterpriseのデモ・スクリプトの一部を実行することにより、インストールが正常に完了したことをさらに確認できます。エラーが発生せずスクリプトが完了した場合、デモは正常に実行されています。
例A-7 aggregateデモの実行
次の例では、aggregate
デモが出力の一部を含めて表示されています。
> demo("aggregate", package="ORE") demo(aggregate) ---- ~~~~~~~~~ Type <Return> to start : > # > # O R A C L E R E N T E R P R I S E S A M P L E L I B R A R Y > # > # Name: aggregate.R > # Description: Demonstrates aggregations > # See also summary.R > # > # > # > > ## Set page width > options(width = 80) > # Push the built-in iris data frame to the database > IRIS_TABLE <- ore.push(iris) > # Display the class of IRIS_TABLE > class(IRIS_TABLE) [1] "ore.frame" attr(,"package") [1] "OREbase" > # Select count(Petal.Length) group by species > x = aggregate(IRIS_TABLE$Petal.Length, + by = list(species = IRIS_TABLE$Species), + FUN = length) > class(x) [1] "ore.frame" attr(,"package") [1] "OREbase" . . . .
例A-8 row_applyデモの実行
次の例では、row_apply
デモが出力の一部を含めて表示されています。
> demo("row_apply", package="ORE") demo(row_apply) ---- ~~~~~~~~~ Type <Return> to start : > # > # O R A C L E R E N T E R P R I S E S A M P L E L I B R A R Y > # > # Name: row_apply.R > # Description: Execute R code on each row > # > # > > ## Set page width > options(width = 80) > # Push the built-in iris data frame to the database > IRIS_TABLE <- ore.push(iris) > # Display the class of IRIS_TABLE > class(IRIS_TABLE) [1] "ore.frame" attr(,"package") [1] "OREbase" > # Apply given R function to each row > ore.rowApply(IRIS_TABLE, + function(dat) { + # Any R code goes here. Operates on one row of IRIS_TABLE at + # a time + cbind(dat, dat$Petal.Length) + }) $`1` Sepal.Length Sepal.Width Petal.Length Petal.Width Species dat$Petal.Length 1 6.4 2.8 5.6 2.1 virginica 5.6 $`2` Sepal.Length Sepal.Width Petal.Length Petal.Width Species dat$Petal.Length 1 7.2 3 5.8 1.6 virginica 5.8 $`3` Sepal.Length Sepal.Width Petal.Length Petal.Width Species dat$Petal.Length 1 7.4 2.8 6.1 1.9 virginica 6.1 $`4` Sepal.Length Sepal.Width Petal.Length Petal.Width Species dat$Petal.Length 1 7.9 3.8 6.4 2 virginica 6.4 $`5` Sepal.Length Sepal.Width Petal.Length Petal.Width Species dat$Petal.Length 1 6.4 2.8 5.6 2.2 virginica 5.6 $`6` . . . .
例A-9 corデモの実行
次の例では、cor
デモが出力の一部を含めて表示されています。
> demo ("cor") demo(cor) ---- ~~~ Type <Return> to start : > # > # O R A C L E R E N T E R P R I S E S A M P L E L I B R A R Y > # > # Name: cor.R > # Description: Correlation matrix > # > # > # > > ## Set page width > options(width = 80) > # Push the built-in iris data frame to the database > IRIS_TABLE <- ore.push(iris) > # Display the class of IRIS_TABLE > class(IRIS_TABLE) [1] "ore.frame" attr(,"package") [1] "OREbase" > # Remove non numeric columns > iris_numeric = IRIS_TABLE[, c("Sepal.Length", "Sepal.Width", + "Petal.Length", "Petal.Width")] > # Pearson's correlation matrix > cor(iris_numeric, use = "all.obs") Sepal.Length Sepal.Width Petal.Length Petal.Width Sepal.Length 1.0000000 -0.1175698 0.8717538 0.8179411 Sepal.Width -0.1175698 1.0000000 -0.4284401 -0.3661259 Petal.Length 0.8717538 -0.4284401 1.0000000 0.9628654 Petal.Width 0.8179411 -0.3661259 0.9628654 1.0000000 . . . . Warning messages: 1: ORE object has no unique key - using random order 2: ORE object has no unique key - using random order 3: ORE object has no unique key - using random order 4: ORE object has no unique key - using random order
例A-10 stepwiseデモの実行
次の例では、stepwise
デモが出力の一部を含めて表示されています。
> demo("stepwise") demo(stepwise) ---- ~~~~~~~~ Type <Return> to start : > # > # O R A C L E R E N T E R P R I S E S A M P L E L I B R A R Y > # > # Name: stepwise.R > # Description: STEPWISE Multivariate Regression > # > # > # > > ## Set page width > options(width = 80) > # Push the built-in iris data frame to the database > IRIS_TABLE <- ore.push(iris) > # Display the class of IRIS_TABLE > class(IRIS_TABLE) [1] "ore.frame" attr(,"package") [1] "OREbase" > # Let us first project out the non numeric columns > IRIS_TABLE = IRIS_TABLE[, c("Sepal.Length", "Sepal.Width", + "Petal.Length", "Petal.Width")] > # Predict Sepal.Length based on the other 3 numeric columns > # Do it stepwise > model = ore.lm(Sepal.Length ~ ., data = IRIS_TABLE) > model Call: ore.lm(formula = Sepal.Length ~ ., data = IRIS_TABLE) Coefficients: (Intercept) Sepal.Width Petal.Length Petal.Width 1.8560 0.6508 0.7091 -0.5565 . . .