Etherpad-LiteをUbuntu 22.04 Linuxにインストールする方法

概要

Ubuntu22.04にphpMyAdminをインストールする方法を解説します。

必要なパッケージインストール

sudo apt update
sudo apt upgrade

apt-get install gnupg2 git unzip libssl-dev pkg-config gcc g++ make build-essential -y

MySQLのインストール / データベース作成

sudo apt install mysql-server

mysql

passwordは任意のパスワードに設定してください。

create database etherpad;
grant all privileges on etherpad.* to etherpad@localhost identified by 'password';

flush privileges;
exit;

Node.jsをインストール

curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
apt-get install nodejs -y

バージョン確認

node -v
v16.19.0

Etherpadをインストール

ユーザーを追加します。

adduser --home /opt/etherpad --shell /bin/bash etherpad

パスワードの入力を求められますので任意のパスワードを入力してくさい。

後の設定が以下の通りで大丈夫です。

Adding user `etherpad' ...
Adding new group `etherpad' (1000) ...
Adding new user `etherpad' (1000) with group `etherpad' ...
Creating home directory `/opt/etherpad' ...
Copying files from `/etc/skel' ...
New password: 
Retype new password: 
passwd: password updated successfully
Changing the user information for etherpad
Enter the new value, or press ENTER for the default
	Full Name []: etherpad     
	Room Number []: 1
	Work Phone []: 
	Home Phone []: 
	Other []: 
Is the information correct? [Y/n] Y

install -d -m 755 -o etherpad -g etherpad /opt/etherpad

su - etherpad
git clone --branch master https://github.com/ether/etherpad-lite.git

試しに起動します。

cd etherpad-lite
bin/run.sh

https://IPかドメイン:9001 と入力しアクセスし下記の画像のように出ていたら成功です。

Etherpadの自動起動設定

vi /etc/systemd/system/etherpad.service

[Unit]
Description=Etherpad-lite, the collaborative editor.
After=syslog.target network.target

[Service]
Type=simple
User=etherpad
Group=etherpad
WorkingDirectory=/opt/etherpad/etherpad-lite
Environment=NODE_ENV=production

ExecStart=/usr/bin/node /opt/etherpad/etherpad-lite/src/node/server.js

Restart=always

[Install]
WantedBy=multi-user.target

systemctl daemon-reload
systemctl start etherpad
systemctl enable etherpad

ステータスを確認して「active」なっていたら成功です。

systemctl status etherpad

? etherpad.service - Etherpad-lite, the collaborative editor.
     Loaded: loaded (/etc/systemd/system/etherpad.service; disabled; vendor preset: enabled)
     Active: active (running) since Wed 2020-11-11 06:50:49 UTC; 4s ago
   Main PID: 12269 (node)
      Tasks: 13 (limit: 4691)
     Memory: 119.1M
     CGroup: /system.slice/etherpad.service
             ??12269 /usr/bin/node /opt/etherpad/etherpad-lite/src/node/server.js