はじめに
LAMP環境が整っているUbuntu Server 18.04 LTSにINTER-Mediator環境を構築する。インターネットで公開する場合は、別途、セキュリティ設定をしてください。
前提条件
Ubuntu Serverを次の手順で構築している。LAMP環境が整っていないかたは、次を参考にしてください。
- Ubuntu Server 18.04 LTSのインストールUSBの作成
- Mac miniにUbuntu Server 18.04 LTSをインストール
- Ubuntu Server 18.04 LTSにLAMP環境を構築する
INTER-Mediatorのインストール
GitHubのリポジトリからINTER-Mediatorをダウンロードして設定する。
下準備
https://github.com/INTER-Mediator/INTER-Mediator にアクセス、『Clone or download』ボタンをクリックして、URLを取得する。
URL: https://github.com/INTER-Mediator/INTER-Mediator.git
ダウンロード
Apacheのドキュメントルートに任意をディレクトリを作成し、そこへ移動する。
gitコマンドでINTER-Mediatorをダウンロードする。
$ sudo mkdir /var/www/html/mywebapp
$ sudo chown ladmin:ladmin /var/www/html/mywebapp
$ cd /var/www/html/mywebapp
$ git clone https://github.com/INTER-Mediator/INTER-Mediator.git
設定
サンプルを動作させて正常に動作するかチェックします。
http://サーバのIP/mywebapp/INTER-Mediator/samples/
データベース別にサンプルが用意されているので、スクリプトを使って目的のデータベースを設定する
MariaDBの設定
『INTER-Mediator/dist-docs』に『sample_schema_mysql.txt』があるこちらが、MariaDB用のスキーマのテキストファイルです。こちらをコマンドを使って設定する。
$ cd /var/www/html/mywebapp/INTER-Mediator/dist-docs
$ sudo mysql -u root -p < sample_schema_mysql.txt
ソケットのディレクトリが違うので『INTER-Mediator/params.php』を編集する
/* PDO awares below:
*/
$dbDSN = 'mysql:host=localhost;dbname=test_db;charset=utf8mb4';
//$dbDSN = 'mysql:unix_socket=/tmp/mysql.sock;dbname=test_db;charset=utf8';
//$dbDSN = 'mysql:unix_socket=/tmp/mysql.sock;dbname=test_db;charset=utf8mb4';
$dbOption = array();
PostgreSQLの設定
『INTER-Mediator/dist-docs』に『sample_schema_pgsql.txt』がある。こちらが、PostgreSQL用のスキーマのテキストファイルです。こちらをコマンドを使って設定する。
$ cd /var/www/html/mywebapp/INTER-Mediator/dist-docs
$ sudo -s
$ su postgres
$ psql -c 'create database test_db;' -U postgres -h localhost
$ psql -U postgres -f sample_schema_pgsql.txt -h localhost test_db
postgresのパスワードを設定いない場合、root経由でpsqlコマンドを実行して、次のSQLからパスワードを設定する。
$ sudo -s
$ su postgres
$ psql
alter user postgres with password 'パスワード';
SQLiteの設定
『INTER-Mediator/dist-docs』に『sample_schema_sqlite.txt』がある。こちらが、SQlite用のスキーマのテキストファイルです。こちらをコマンドを使って設定する。
$ sudo mkdir -p /var/db/im
$ cd /var/www/html/mywebapp/INTER-Mediator/dist-docs
$ sudo sqlite3 /var/db/im/sample.sq3 < sample_schema_sqlite.txt
$ sudo chown www-data /var/db/im
$ sudo chown www-data /var/db/im/sample.sq3