ChatLuckのインストールとデータベース構築

ChatLuck (Linux+PostgreSQL) のインストールについての説明です。

Linux+PostgreSQL版のChatLuckをインストールします。

ご注意

・ここではPostgreSQL 16の稼働ポートが"5433"であることを前提に説明します。ご利用になる環境によって稼働ポートを適宜変更してください。

ChatLuckデータベースの作成と接続先設定

※本インストール手順に従ってPostgreSQL 16を構成している場合、パスワードは「postgres」です。

1. postgresユーザーで、PostgreSQLにChatLuck用のデータベースロールを作成します。
 「-p」には稼働ポート番号を指定してください。以下では、"5433"番ポートで稼働している前提で記述します。

[root@xxxxxx tmp]# su - postgres [postgres@xxxxxx ~]$ psql -d template1 -p 5433 -c "CREATE USER chatlk WITH PASSWORD 'chatlk' CREATEROLE" Password: CREATE ROLE [postgres@xxxxxx ~]$

2. psqlコマンドとpg_restoreコマンドを使用し、ChatLuck本体とログ収集用データベースを作成します。

[postgres@xxxxxx ~]$ psql -c "create database chatlkdb owner chatlk" -c "create database chatladdb owner chatlk" Password: CREATE DATABASE CREATE DATABASE [postgres@xxxxxx ~]$ pg_restore -Fc -d chatlkdb -p 5433 /var/www/cgi-bin/chatlk/dump/chatlkdb.pgdmp Password: [postgres@xxxxxx ~]$ pg_restore -Fc -d chatladdb -p 5433 /var/www/cgi-bin/chatlk/dump/chatladdb.pgdmp Password: [postgres@xxxxxx ~]$

3. ログ収集用データベースの参照先を変更します。コマンドが正常に終了したら、exitコマンドにてrootユーザーに戻してください。

psql -p 5433 -d chatladdb -c "ALTER SERVER chatdbfdw OPTIONS (set port '5433')" Password: ALTER SERVER [postgres@xxxxxx ~]$ exit [root@xxxxxx tmp]#

4. ChatLuckの設定ファイルを編集します。以下のコマンドで、設定ファイルを開きます。

[root@xxxxxx tmp]# vi /var/www/cgi-bin/chatlk/rserver/config/default.json

以下に示すように、2行修正して1行追加してください。

{ "DB" : { "dbport" : 5433, // 「5432」からPostgreSQL稼働ポート番号に変更 "dbs"           :    "localhost", "dbname"        :    "chatlkdb", "dbuser"        :    "chatlk", "dbpwd"         :    "chatlk", // カンマ「,」を追加 "logdbport"     :    5433 // 「5432」からPostgreSQL稼働ポート番号に変更 }, "node" : { "port" : 3000, "log" : { "appenders": [ { "category" : "info", "filename" : "log/rserver.log" }, { "category" : "error", "filename" : "log/error.log" } ] } } }

編集が完了したら、viコマンドの":wq"(保存して閉じる)を実行してください。

 

以上で、ChatLuckデータベースの作成と接続先設定は完了です。

「ChatLuckのインストールとデータベース構築」に戻る

 

記載の製品名および商品名は、各社の商標、または登録商標です。