Rocky Linux 8 に Etherpad Collaborative Web Editor をインストールする方法

Etherpad は、リアルタイムでファイルを共同作業できる、無料のオープンソースの Web ベースのファイル編集アプリケーションです。 これは Nodejs で書かれており、数千人の同時リアルタイム ユーザーをサポートします。 データ エクスポート機能があり、ユーザーの制御下でサーバー上で実行されます。 これにより、著者と編集者は、すべての参加者の編集内容をリアルタイムで確認できるようになります。

この記事では、Rocky Linux 8 に Etherpad をインストールする方法を説明します。

前提条件

  • Your self Cloud Platform 上で Rocky Linux 8 を実行するサーバー
  • サーバー上で設定された root パスワード

ステップ 1 – 独自のクラウドサーバーを作成する

まず、ログインしてくださいあなた自身のクラウドサーバー。 新しいサーバーを作成し、少なくとも 2GB RAM を搭載したオペレーティング システムとして Rocky Linux 8 を選択します。 SSH 経由でクラウド サーバーに接続し、ページの上部で強調表示されている認証情報を使用してログインします。

サーバーにログインしたら、次のコマンドを実行して、利用可能な最新のパッケージでベース システムを更新します。

                dnf update -y
              

ステップ 2 – データベースのインストールと構成

まず、次のコマンドを使用して MariaDB バージョン 10.04 リポジトリを有効にします。

                dnf module enable mariadb:10.5
              

次に、次のコマンドを使用して MariaDB 10.5 をインストールします。

                dnf install mariadb-server -y
              

インストール後、以下のコマンドを使用して MariaDB サービスを開始し、有効にします。

                systemctl start mariadb 
systemctl enable mariadb
              

次に、次のコマンドを使用して MariaDB シェルにログインします。

                mysql
              

接続したら、Etherpad のデータベースとユーザーを作成します。

                create database `etherpaddb`;
create user 'etherpaduser'@'localhost' identified by 'yourpassword';
              

次に、etherpad データベースにすべての権限を付与します。

                grant CREATE,ALTER,SELECT,INSERT,UPDATE,DELETE on `etherpaddb`.* to 'etherpaduser'@'localhost';
              

次に、次のコマンドを使用して権限をフラッシュし、MariaDB を終了します。

                flush privileges;
exit;
              

ステップ 3 – Node.js をインストールする

Etherpad は Node.js で記述されているため、サーバーにインストールする必要があります。

まず、次のコマンドを使用して Node.js リポジトリを有効にします。

                dnf module enable nodejs:14
              

次に、次のコマンドを使用して Node.js をインストールします。

                dnf install nodejs git -y
              

Node.js がインストールされたら、次のコマンドを使用して Node.js のバージョンを確認します。

                node --version
              

次の出力が得られます。

                v14.17.5
              

ステップ 4 – Rocky Linux 8 に Etherpad をインストールする

まず、Etherpad を実行する専用のユーザーを作成します。

                adduser --system --home /opt/etherpad --create-home --user-group etherpad
              

次に、ユーザーを etherpad に切り替え、次のコマンドを使用して Etherpad の最新バージョンをダウンロードします。

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

次に、ディレクトリをダウンロードしたディレクトリに変更し、次のコマンドで Etherpad を実行します。

                cd etherpad-lite
./src/bin/run.sh
              

すべてが正常であれば、次の出力が得られます。

                [2021-12-05 11:19:21.804] [INFO] server - Installed plugins: 
[2021-12-05 11:19:21.805] [INFO] console - Report bugs at https://github.com/ether/etherpad-lite/issues
[2021-12-05 11:19:21.806] [INFO] console - Your Etherpad version is 1.8.16 (142a47c)
[2021-12-05 11:19:23.514] [INFO] http - HTTP server listening for connections
[2021-12-05 11:19:23.514] [INFO] console - You can access your Etherpad instance at https://0.0.0.0:9001/
[2021-12-05 11:19:23.514] [WARN] console - Admin username and password not set in settings.json. To access admin please uncomment and edit "users" in settings.json
[2021-12-05 11:19:23.514] [WARN] console - Etherpad is running in Development mode. This mode is slower for users and less secure than production mode. You should set the NODE_ENV environment variable to production by using: export NODE_ENV=production
[2021-12-05 11:19:23.514] [INFO] server - Etherpad is running

              

プレスCTRL+CEtherpad を停止します。

次に、settings.json ファイルを編集し、データベース設定を定義します。

                nano settings.json
              

次の行をコメントアウトします。

                //  "dbType": "dirty",
//  "dbSettings": {
//    "filename": "var/dirty.db"
//  },

              

次の行を変更します。

                  "dbType" : "mysql",
  "dbSettings" : {
    "user":     "etherpaduser",
    "host":     "localhost",
    "port":     3306,
    "password": "yourpassword",
    "database": "etherpaddb",
    "charset":  "utf8mb4"
  },

  "trustProxy": true,

              

ファイルを保存して閉じ、Etherpad ユーザーを終了します。

                exit
              

ステップ 5 – Etherpad 用の Systemd サービス ファイルを作成する

次に、Etherpad サービスを管理するための systemd サービス ファイルを作成します。

                nano /etc/systemd/system/etherpad.service
              

次の行を追加します。

                [Unit]
Description=Etherpad, a collaborative web editor.
After=syslog.target network.target

[Service]
Type=simple
User=etherpad
Group=etherpad
WorkingDirectory=/opt/etherpad
Environment=NODE_ENV=production
ExecStart=/usr/bin/node --experimental-worker /opt/etherpad/etherpad-lite/node_modules/ep_etherpad-lite/node/server.js
Restart=always

[Install]
WantedBy=multi-user.target

              

ファイルを保存して閉じ、以下のコマンドを使用して systemd デーモンをリロードします。

                systemctl daemon-reload
              

次に、次のコマンドを使用して Etherpad サービスを開始し、有効にします。

                systemctl start etherpad
systemctl enable etherpad
              

次のコマンドを使用して、Etherpad のステータスを確認できます。

                systemctl status etherpad
              

次の出力が表示されるはずです。

                ● etherpad.service - Etherpad, a collaborative web editor.
   Loaded: loaded (/etc/systemd/system/etherpad.service; disabled; vendor preset: disabled)
   Active: active (running) since Sun 2021-12-05 11:22:04 UTC; 5s ago
 Main PID: 13518 (node)
    Tasks: 13 (limit: 11411)
   Memory: 104.9M
   CGroup: /system.slice/etherpad.service
           └─13518 /usr/bin/node --experimental-worker /opt/etherpad/etherpad-lite/node_modules/ep_etherpad-lite/node/server.js

Dec 05 11:22:04 rockylinux node[13518]:   DEFAULT_CHARACTER_SET_NAME: 'latin1',
Dec 05 11:22:04 rockylinux node[13518]:   DEFAULT_COLLATION_NAME: 'latin1_swedish_ci'
Dec 05 11:22:04 rockylinux node[13518]: } utf8mb4 latin1_swedish_ci
Dec 05 11:22:04 rockylinux node[13518]: [2021-12-05 11:22:04.915] [INFO] plugins - Running npm to get a list of installed plugins...
Dec 05 11:22:08 rockylinux node[13518]: [2021-12-05 11:22:08.268] [INFO] plugins - Loading plugin ep_etherpad-lite...
Dec 05 11:22:08 rockylinux node[13518]: [2021-12-05 11:22:08.270] [INFO] plugins - Loaded 1 plugins
Dec 05 11:22:08 rockylinux node[13518]: [2021-12-05 11:22:08.932] [INFO] APIHandler - Api key file read from: "/opt/etherpad/etherpad-lite/AP>
Dec 05 11:22:09 rockylinux node[13518]: [2021-12-05 11:22:09.000] [INFO] server - Installed plugins:
Dec 05 11:22:09 rockylinux node[13518]: [2021-12-05 11:22:09.001] [INFO] console - Report bugs at https://github.com/ether/etherpad-lite/issu>
Dec 05 11:22:09 rockylinux node[13518]: [2021-12-05 11:22:09.002] [INFO] console - Your Etherpad version is 1.8.16 (142a47c)

              

ステップ 6 – Nginx を Etherpad のリバース プロキシとして構成する

次に、Nginx を Etherpad のリバース プロキシとしてインストールして構成する必要があります。

まず、次のコマンドで Nginx をインストールします。

                dnf install nginx -y
              

Nginx がインストールされたら、以下のコマンドを使用して Nginx サービスを開始し、有効にします。

                systemctl start nginx
systemctl enable nginx
              

次に、Nginx 仮想ホスト構成ファイルを作成します。

                nano /etc/nginx/conf.d/etherpad.conf
              

次の構成を追加します。

                server {
    listen       80;
    server_name  etherpad.example.com;

    access_log  /var/log/nginx/etherpad.access.log;
    error_log   /var/log/nginx/etherpad.error.log;
    

    location / {
        rewrite  ^/$ / break;
        rewrite  ^/locales/(.*) /locales/$1 break;
        rewrite  ^/locales.json /locales.json break;
        rewrite  ^/admin(.*) /admin/$1 break;
        rewrite  ^/p/(.*) /p/$1 break;
        rewrite  ^/static/(.*) /static/$1 break;
        rewrite  ^/pluginfw/(.*) /pluginfw/$1 break;
        rewrite  ^/javascripts/(.*) /javascripts/$1 break;
        rewrite  ^/socket.io/(.*) /socket.io/$1 break;
        rewrite  ^/ep/(.*) /ep/$1 break;
        rewrite  ^/minified/(.*) /minified/$1 break;
        rewrite  ^/api/(.*) /api/$1 break;
        rewrite  ^/ro/(.*) /ro/$1 break;
        rewrite  ^/error/(.*) /error/$1 break;
        rewrite  ^/jserror(.*) /jserror$1 break;
        rewrite  ^/redirect(.*) /redirect$1 break;
        rewrite  /favicon.ico /favicon.ico break;
        rewrite  /robots.txt /robots.txt break;
        rewrite  /(.*) /p/$1;
        
        proxy_pass         https://127.0.0.1:9001;
        proxy_buffering    off;
        proxy_set_header   Host $host;
        proxy_pass_header  Server;

        # proxy headers
        proxy_set_header    X-Real-IP $remote_addr;
        proxy_set_header    X-Forwarded-For $remote_addr;
        proxy_set_header    X-Forwarded-Proto $scheme;
        proxy_http_version  1.1;


    }
}

              

ファイルを保存して閉じてから、nginx.confファイルを作成し、hash_bucket サイズを定義します。

                nano /etc/nginx/nginx.conf
              

この行の下に次の行を追加しますhttp {:

                server_names_hash_bucket_size  64;

              

ファイルを保存して閉じ、Nginx に構文エラーがないか確認します。

                nginx -t
              
                You should see the following output:
              
                nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

              

最後に、Nginx を再起動して構成の変更を適用します。

                systemctl restart nginx
              

ステップ 7 – Etherpad Web インターフェイスにアクセスする

次に、お気に入りの Web ブラウザを開き、次の URL を使用して Etherpad Web インターフェイスにアクセスします。https://etherpad.example.com。 次のページが表示されるはずです。

パッド名を入力し、OKボタン。 次のページが表示されるはずです。

結論

おめでとう! Rocky Linux 8 にリバース プロキシとして Nginx を使用して Etherpad を正常にインストールしました。これで、Etherpad を使用してコンテンツを中央の場所から簡単に管理できるようになります。 あなた自身から専用ホスティングでお試しください!