録画管理ソフトとして「EPGStation」をインストールします。
ffmpegのインストール
「自分に負けないラボラトリー」さんの「LinuxでFFmpegをほぼ全自動でビルドする(CentOS、Ubuntu等に対応)」に従ってFFmpegをビルドします。
mariadbのインストール
$ sudo apt install mariadb-server
$ sudo mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none): ※何も入力せずEnter
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] Y
New password: ※rootのパスワードを入力
Re-enter new password: ※rootのパスワードを入力
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n]Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
EPGStationで使用するDataBaseの作成
$ sudo mysql -u root -p
Enter password: ※rootのパスワードを入力
MariaDB [(none)]> CREATE DATABASE epgstation CHARACTER SET utf8;
MariaDB [(none)]> GRANT ALL ON epgstation.* TO epgstation@localhost IDENTIFIED BY 'mirakurun';
MariaDB [(none)]> exit
EPGStationのインストール
「EPGStation公式セットアップマニュアル」の通り導入しました。
Node.js、ミラクルン、FFmpeg / FFprobe、Python2.7、GCCがインストール済みであることを確認する。
$ node --version
$ curl -o - http://localhost:40772/api/version
$ ffmpeg -version
$ python --version
$ gcc --version
EPGStationのインストール
$ cd ^/git
$ 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
設定ファイルの編集
$ nano config/config.json
※ sqliteの設定を削除する
"dbType": "sqlite3",
※ 以下の設定を追加する
"dbType": "mysql",
"mysql": {
"host": "localhost",
"port": 3306,
"user": "epgstation",
"password": "mirakurun",
"database": "epgstation",
"connectTimeout": 20000,
"connectionLimit": 10
},
※ ffmpegのインストール先をffmpegのインストールでインストールしたディレクトリに変更する
"ffmpeg": "/usr/local/ffmpeg_build/bin/ffmpeg",
"ffprobe": "/usr/local/ffmpeg_build/bin/ffprobe",
※ 録画ファイルの保存先と、録画ファイル名の指定
"recorded": "/home/share/",
"recordedFormat": "%TITLE%-[%CHNAME%]-%YEAR%%MONTH%%DAY% %HOUR%%MIN%",
録画ファイル名は「タイトル-[チャンネル名]-YYYYMMDD HHNN」としています。
EPGStationの起動 / 終了
手動で起動をして、正常に起動することを確認します。
$ npm start
手動で起動出来ることを確認したら、pm2 を利用して自動起動設定を行います。
$ sudo pm2 startup
$ sudo pm2 start dist/server/index.js --name "epgstation"
$ sudo pm2 save
再起動します。
$ sudo reboot
再起動後、epgstationが自動起動していることを確認
$ pm2 status
┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐
│ id │ name │ mode │ ↺ │ status │ cpu │ memory │
├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤
│ 2 │ epgstation │ fork │ 19 │ online │ 0.4% │ 109.7mb │
│ 1 │ mirakurun-server │ fork │ 1 │ online │ 0.6% │ 517.7mb │
└────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘
Module
┌────┬────────────────────┬──────────┬──────────┬──────────┐
│ id │ name │ status │ cpu │ mem │
├────┼────────────────────┼──────────┼──────────┼──────────┤
│ 0 │ pm2-logrotate │ online │ 0.3% │ 74.1mb │
└────┴────────────────────┴──────────┴──────────┴──────────┘