カードリーダー用ドライバのインストール
$sudo apt -y install pcscd pcsc-tools libpcsclite-dev
$pcsc_scan
 最後にJapanese Chijou Digital B-CAS Card (pay TV)と出ればOK

$sudo apt install git
$git clone https://github.com/stz2012/libarib25.git
$cd libarib25/

$sudo apt install build-essential cmake pkg-config
$cmake .
$ make
$ sudo make install

recdvbインストール
$sudo apt install autoconf
$git clone https://github.com/dogeel/recdvb
$cd recdvb
pt1_dev.hのBSチャンネルを修正
************************************************************************
    {   0, CHTYPE_SATELLITE, 0, 0x4010, "151"},  /* 151ch:BS朝日 */
    {   0, CHTYPE_SATELLITE, 1, 0x4011, "161"},  /* 161ch:BS-TBS */
    {   0, CHTYPE_SATELLITE, 2, 0x4012, "171"},  /* 171ch:BSジャパン */
    {   1, CHTYPE_SATELLITE, 0, 0x4030, "191"},  /* 191ch:WOWOW prime */
    {   1, CHTYPE_SATELLITE, 1, 0x4031, "103"},  /* 103ch:NHK-BSプレミアム*/
    {   1, CHTYPE_SATELLITE, 2, 0x4632, "256"},  /* 256ch:ディズニー・チャンネル */
    {   2, CHTYPE_SATELLITE, 0, 0x4450, "192"},  /* 192ch:WOWOWライブ */
    {   2, CHTYPE_SATELLITE, 1, 0x4451, "193"},  /* 193ch:WOWOWシネマ */
    {   4, CHTYPE_SATELLITE, 0, 0x4090, "211"},  /* 211ch:BS11デジタル */
    {   4, CHTYPE_SATELLITE, 1, 0x4091, "200"},  /* 200ch:スター・チャンネル1 */
    {   4, CHTYPE_SATELLITE, 2, 0x4092, "222"},  /* 222ch:TwellV */
    {   5, CHTYPE_SATELLITE, 0, 0x46b0, "238"},  /* 238ch:FOX bs238 */
    {   5, CHTYPE_SATELLITE, 1, 0x46b1, "241"},  /* 241ch:BSスカパー! */
    {   5, CHTYPE_SATELLITE, 2, 0x46b2, "231"},  /* 231ch:放送大学テレビ1 */
    {   5, CHTYPE_SATELLITE, 2, 0x46b2, "232"},  /* 232ch:放送大学テレビ2 */
    {   5, CHTYPE_SATELLITE, 2, 0x46b2, "233"},  /* 233ch:放送大学テレビ3 */
    {   5, CHTYPE_SATELLITE, 2, 0x46b2, "531"},  /* 531ch:放送大学ラジオ */
    {   6, CHTYPE_SATELLITE, 0, 0x40d0, "141"},  /* 141ch:BS日テレ */
    {   6, CHTYPE_SATELLITE, 1, 0x40d1, "181"},  /* 181ch:BSフジ */
    {   6, CHTYPE_SATELLITE, 2, 0x46d2, "236"},  /* 236ch:BSアニマックス */
    {   7, CHTYPE_SATELLITE, 1, 0x40f1, "101"},  /* 101ch:NHK-BS1 */
    {   7, CHTYPE_SATELLITE, 1, 0x40f1, "102"},  /* 102ch:NHK-BS1臨時 */
    {   7, CHTYPE_SATELLITE, 2, 0x40f2, "201"},  /* 201ch:スター・チャンネル2 */
    {   7, CHTYPE_SATELLITE, 2, 0x40f2, "202"},  /* 202ch:スター・チャンネル3 */
    {   7, CHTYPE_SATELLITE, 2, 0x40f2, "910"},  /* 910ch:ウェザーニュース(WNI)*/
    {   8, CHTYPE_SATELLITE, 2, 0x4311, "291"},  /* 291ch:NHK総合テレビジョン(東京)*/
    {   8, CHTYPE_SATELLITE, 2, 0x4311, "292"},  /* 292ch:NHK教育テレビジョン(東京)*/
    {   8, CHTYPE_SATELLITE, 1, 0x4310, "294"},  /* 294ch:日本テレビ */
    {   8, CHTYPE_SATELLITE, 1, 0x4310, "295"},  /* 295ch:テレビ朝日 */
    {   8, CHTYPE_SATELLITE, 1, 0x4310, "296"},  /* 296ch:TBSテレビ */
    {   8, CHTYPE_SATELLITE, 1, 0x4310, "297"},  /* 297ch:テレビ東京 */
    {   8, CHTYPE_SATELLITE, 2, 0x4311, "298"},  /* 298ch:フジテレビ */
    {   9, CHTYPE_SATELLITE, 0, 0x4730, "234"},  /* 234ch:グリーンチャンネル */
    {   9, CHTYPE_SATELLITE, 1, 0x4731, "242"},  /* 242ch:J SPORTS 1 */
    {   9, CHTYPE_SATELLITE, 2, 0x4732, "243"},  /* 243ch:J SPORTS 2 */
    {  10, CHTYPE_SATELLITE, 0, 0x4750, "252"},  /* 252ch:シネフィルWOWOW */
    {  10, CHTYPE_SATELLITE, 1, 0x4751, "244"},  /* 244ch:J SPORTS 3 */
    {  10, CHTYPE_SATELLITE, 2, 0x4752, "245"},  /* 245ch:J SPORTS 4 */
    {  11, CHTYPE_SATELLITE, 0, 0x4770, "251"},  /* 251ch:BS釣りビジョン */
    {  11, CHTYPE_SATELLITE, 1, 0x4771, "255"},  /* 255ch:日本映画専門チャンネル */
    {  11, CHTYPE_SATELLITE, 2, 0x4772, "258"},  /* 258ch:D-Life */
*******************************************************************************

$./autogen.sh
$./configure --enable-b25
$ make
$ sudo make install
録画テスト(BSプレミア 10秒)
$recdvb --b25 --strip 103 10 testBSPre.ts

mirakurunインストール
下記参照
https://github.com/Chinachu/Mirakurun/blob/master/doc/Platforms.md#linux

 

node.jsインストール

下記公式参照

https://github.com/nodesource/distributions/blob/master/README.md

$sudo apt install curl
$curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
$sudo apt-get install -y nodejs
$sudo npm install pm2 -g
$sudo npm install mirakurun -g --unsafe-perm --production

チューナ設定
/usr/local/etc/mirakurun/tuners.yml
****************************************
- name: PT2-S1
  types:
    - BS
    - CS
  command: recdvb --b25 --strip --dev 0 --lnb 15 <channel> - -
  isDisabled: false

- name: PT2-S2
  types:
    - BS
    - CS
  command: recdvb --b25 --strip --dev 2 --lnb 15 <channel> - -
  isDisabled: false

- name: PT2-T1
  types:
    - GR
  command: recdvb --b25 --strip --dev 1 <channel> - -
  isDisabled: false

- name: PT2-T2
  types:
    - GR
  command: recdvb --b25 --strip --dev 3 <channel> - -
  isDisabled: false
********************************************

チャンネル設定
/usr/local/etc/mirakurun/channels.yml
***********************************************
- name: NHK G
  type: GR
  channel: '24'

- name: NHK E
  type: GR
  channel: '13'

- name: MBS
  type: GR
  channel: '16'

- name: ABC
  type: GR
  channel: '15'

- name: KTV
  type: GR
  channel: '17'

- name: YTV
  type: GR
  channel: '14'

- name: TVO
  type: GR
  channel: '18'

- name: SUN
  type: GR
  channel: '26'

- name: KBS
  type: GR
  channel: '23'


- name: NHK BS1
  type: BS
  channel: BS15_1
  serviceId: 101

- name: NHK BSプレミアム
  type: BS
  channel: BS03_1
  serviceId: 103

- name: BS日テレ
  type: BS
  channel: BS13_0
  serviceId: 141

- name: BS朝日
  type: BS
  channel: BS01_0
  serviceId: 151

- name: BS-TBS
  type: BS
  channel: BS01_1
  serviceId: 161

- name: BSジャパン
  type: BS
  channel: BS01_2
  serviceId: 171

- name: BSフジ
  type: BS
  channel: BS13_1
  serviceId: 181

- name: WOWOWプライム
  type: BS
  channel: BS03_0
  serviceId: 191

- name: WOWOWライブ
  type: BS
  channel: BS05_0
  serviceId: 192

- name: WOWOWシネマ
  type: BS
  channel: BS05_1
  serviceId: 193

- name: スター・チャンネル1
  type: BS
  channel: BS09_1
  serviceId: 200

- name: スター・チャンネル2
  type: BS
  channel: BS15_2
  serviceId: 201

- name: スター・チャンネル3
  type: BS
  channel: BS15_2
  serviceId: 202

- name: BS11
  type: BS
  channel: BS09_0
  serviceId: 211

- name: TwellV
  type: BS
  channel: BS09_2
  serviceId: 222

- name: 放送大学
  type: BS
  channel: BS11_2
  serviceId: 231

- name: 放送大学
  type: BS
  channel: BS11_2
  serviceId: 232

- name: 放送大学
  type: BS
  channel: BS11_2
  serviceId: 233

- name: グリーンチャンネル
  type: BS
  channel: BS19_0
  serviceId: 234

- name: BSアニマックス
  type: BS
  channel: BS13_2
  serviceId: 236

- name: FOXスポーツ&エンターテイメント
  type: BS
  channel: BS11_0
  serviceId: 238

- name: BSスカパー!
  type: BS
  channel: BS11_1
  serviceId: 241

- name: J SPORTS 1
  type: BS
  channel: BS19_1
  serviceId: 242

- name: J SPORTS 2
  type: BS
  channel: BS19_2
  serviceId: 243

- name: J SPORTS 3
  type: BS
  channel: BS21_1
  serviceId: 244

- name: J SPORTS 4
  type: BS
  channel: BS21_2
  serviceId: 245

- name: BS釣りビジョン
  type: BS
  channel: BS23_0
  serviceId: 251

- name: シネフィルWOWOW
  type: BS
  channel: BS21_0
  serviceId: 252

- name: 日本映画専門チャンネル
  type: BS
  channel: BS23_1
  serviceId: 255

- name: ディズニー・チャンネル
  type: BS
  channel: BS03_2
  serviceId: 256

- name: D-Life
  type: BS
  channel: BS23_2
  serviceId: 258

- name: ショップチャンネル
  type: CS
  channel: CS8
  serviceId: 55

- name: QVC
  type: CS
  channel: CS22
  serviceId: 161

- name: 東映チャンネル
  type: CS
  channel: CS8
  serviceId: 218

- name: 衛星劇場
  type: CS
  channel: CS10
  serviceId: 219

- name: チャンネルNECO
  type: CS
  channel: CS24
  serviceId: 223

- name: ザ・シネマ
  type: CS
  channel: CS14
  serviceId: 227

- name: ムービープラスHD
  type: CS
  channel: CS18
  serviceId: 240

- name: スカイA
  type: CS
  channel: CS4
  serviceId: 250

- name: GAORA
  type: CS
  channel: CS12
  serviceId: 254

- name: 日テレG+
  type: CS
  channel: CS24
  serviceId: 257

- name: ゴルフネット
  type: CS
  channel: CS18
  serviceId: 262

- name: SKY STAGE
  type: CS
  channel: CS16
  serviceId: 290

- name: 時代劇専門ch
  type: CS
  channel: CS4
  serviceId: 292

- name: ファミリー劇場
  type: CS
  channel: CS14
  serviceId: 293

- name: ホームドラマCH
  type: CS
  channel: CS6
  serviceId: 294

- name: MONDO TV
  type: CS
  channel: CS24
  serviceId: 295

- name: TBSチャンネル1
  type: CS
  channel: CS2
  serviceId: 296

- name: TBSチャンネル2
  type: CS
  channel: CS22
  serviceId: 297

- name: テレ朝チャンネル1
  type: CS
  channel: CS2
  serviceId: 298

- name: テレ朝チャンネル2
  type: CS
  channel: CS2
  serviceId: 299

- name: 日テレプラス
  type: CS
  channel: CS24
  serviceId: 300

- name: チャンネル銀河
  type: CS
  channel: CS18
  serviceId: 305

- name: フジテレビONE
  type: CS
  channel: CS20
  serviceId: 307

- name: フジテレビTWO
  type: CS
  channel: CS20
  serviceId: 308

- name: フジテレビNEXT
  type: CS
  channel: CS20
  serviceId: 309

- name: スーパー!ドラマTV
  type: CS
  channel: CS14
  serviceId: 310

- name: AXN 海外ドラマ
  type: CS
  channel: CS16
  serviceId: 311

- name: FOX
  type: CS
  channel: CS22
  serviceId: 312

- name: 女性ch/LaLa
  type: CS
  channel: CS18
  serviceId: 314

- name: AXNミステリー
  type: CS
  channel: CS16
  serviceId: 316

- name: スペシャプラス
  type: CS
  channel: CS16
  serviceId: 321

- name: スペースシャワーTV
  type: CS
  channel: CS20
  serviceId: 322

- name: MTV
  type: CS
  channel: CS4
  serviceId: 323

- name: エムオン!
  type: CS
  channel: CS12
  serviceId: 325

- name: ミュージック・エア
  type: CS
  channel: CS6
  serviceId: 324

- name: 歌謡ポップス
  type: CS
  channel: CS6
  serviceId: 329

- name: キッズステーション
  type: CS
  channel: CS12
  serviceId: 330

- name: カートゥーン
  type: CS
  channel: CS6
  serviceId: 331

- name: AT-X
  type: CS
  channel: CS16
  serviceId: 333

- name: ディズニージュニア
  type: CS
  channel: CS2
  serviceId: 339

- name: ディスカバリー
  type: CS
  channel: CS6
  serviceId: 340

- name: アニマルプラネット
  type: CS
  channel: CS6
  serviceId: 341

- name: ヒストリーチャンネル
  type: CS
  channel: CS14
  serviceId: 342

- name: ナショジオチャンネル
  type: CS
  channel: CS12
  serviceId: 343

- name: 日テレNEWS24
  type: CS
  channel: CS8
  serviceId: 349

- name: TBSニュースバード
  type: CS
  channel: CS22
  serviceId: 351

- name: BBCワールド
  type: CS
  channel: CS16
  serviceId: 353

- name: CNNj
  type: CS
  channel: CS6
  serviceId: 354

- name: 囲碁・将棋チャンネル
  type: CS
  channel: CS6
  serviceId: 363

- name: スカサカ!
  type: CS
  channel: CS10
  serviceId: 800

- name: スカチャン1
  type: CS
  channel: CS10
  serviceId: 801
*********************************************

リスタート
$sudo mirakurun restart

ログの圧縮
$ sudo pm2 install pm2-logrotate
/etc/logrotate.d/mirakurunを作成し、
下記記入(毎日圧縮、1週間保管)
********************************
/usr/local/var/log/mirakurun.stdout.log {
        daily
        rotate 7
        compress
        missingok
        notifempty
}

/usr/local/var/log/mirakurun.stderr.log {
        daily
        rotate 7
        compress
        missingok
        notifempty
}
************************************

mariaDBインストール
$sudo apt install mariadb-server
$sudo mysql_secure_installation 
 Enter current password for root (enter for none): ※エンター
 Set root password? [Y/n] ※Y
 New password: ※新しいパスワードを入力
 Re-enter new password: ※新しいパスワードを入力
 ※以降エンター
$sudo mysql -u root -p
 Enter password: ※さきほど設定したパスワードを入力
 MariaDB [(none)]> create database epgstation;
 MariaDB [(none)]> grant all on epgstation.* to epgstation@localhost identified by 'さきほど設定したパスワード';
 MariaDB [(none)]> exit

文字は、設定ファイル
/etc/mysql/mariadb.conf.d/50-server.cnf
でutf8mb4になっているのでそのまま。

EPGstationインストール
 公式参照
 https://github.com/l3tnun/EPGStation/blob/master/doc/linux-setup.md
$ git clone https://github.com/l3tnun/EPGStation.git
$ cd EPGStation
$ npm install
$ npm run build
 (メモリが少ないとエラー発生した)

設定ファイルコピー
$ cp config/config.sample.json config/config.json
$ cp config/operatorLogConfig.sample.json config/operatorLogConfig.json
$ cp config/serviceLogConfig.sample.json config/serviceLogConfig.json

設定ファイル(config.json)の修正
    "dbType": "mysql",
    "mysql":{
        "host": "localhost",
        "port": 3306,
        "user": "epgstation",
        "password": "mariaDBで設定したパスワード",
        "database": "epgstation",
        "connectTimeout": 20000,
        "connectionLimit": 10
    },
  "recorded": "録画ファイル保存フォルダのフルパス",

手動で起動する場合
$ npm start

http://サーバーのIPアドレス:8888で表示されればOK

自動起動
$ sudo npm install pm2 -g
$ sudo pm2 startup
$ pm2 start dist/server/index.js --name "epgstation"
 パーミッションエラーになったので表示された下記コマンドを実行してからもう一回
 $ sudo chown ユーザー名:ユーザー名 /home/ユーザー名/.pm2/rpc.sock /home/ユーザー名/.pm2/pub.sock
$ pm2 save
 dump.pm2,dump.pm2.bakのパーミッションエラーになるができているよう。
 ホームの.pm2フォルダ以下がrootなので、chownでユーザーに変更すればいい?

公式に、バイナリログが増えるので
expire_logs_days = 1
を推奨しているが、
/etc/mysql/mariadb.conf.d/50-server.cnf
を見るとバイナリログの出力がコメントアウト(エラーログのみ)しているので
変更しない。