Ubuntu 20.04LTSにChatwootをインストールする方法

このチュートリアルでは、Ubuntu 20.04LTSにChatwootをインストールする方法を紹介します。 知らなかった方のために説明すると、Chatwootはオープンソースのリアルタイムメッセージングプラットフォームであり、Webサイトにシンプルでエレガントなライブチャットを提供し、他のエージェントやメッセージングアプリと連携します。 これは、ソーシャルメディアチャットを統合できることを意味します。 Facebook、 Twitter、 Eメール、 WhatsApp などを1つの中心的な場所に。 これにより、すべてのプラットフォームを効果的に監視し、顧客の要求にリアルタイムで対応できます。

この記事は、少なくともLinuxの基本的な知識があり、シェルの使用方法を知っていること、そして最も重要なこととして、自分のVPSでサイトをホストしていることを前提としています。 インストールは非常に簡単で、rootアカウントで実行していることを前提としています。そうでない場合は、 ‘を追加する必要があります。sudo‘root権限を取得するコマンドに。 Ubuntu 20.04(Focal Fossa)にChatwootを段階的にインストールする方法を紹介します。 Ubuntu 18.04、16.04、およびLinuxMintなどの他のDebianベースのディストリビューションでも同じ手順に従うことができます。

Ubuntu 20.04 LTS FocalFossaにChatwootをインストールします

手順1.まず、次のコマンドを実行して、すべてのシステムパッケージが最新であることを確認します。 apt ターミナルのコマンド。

sudo apt update
sudo apt upgrade

ステップ2.Ubuntu20.04にChatwootをインストールします。

次に、Chatwootのインストールに使用されるスクリプトをダウンロードします。

cd /tmp
wget https://raw.githubusercontent.com/chatwoot/chatwoot/develop/deployment/setup_20.04.sh -O setup.sh

次に、実行可能にしてから、以下のコマンドを使用してインストールします。

sudo chmod 755 setup.sh
sudo ./setup.sh master

インストールが正常に完了すると、次のようなメッセージが表示されます。

Chatwoot server installation is complete
The server will be accessible at https://<server-ip>:3000
To configure a domain and SSL certificate, follow the guide at https://www.chatwoot.com/docs/deployment/deploy-chatwoot-in-linux-vm

手順3.NginxWebサーバーをインストールして構成します。

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

sudo apt update
sudo apt install nginx

Nginxをインストールした後、以下のコマンドを実行して、デフォルトのNginx構成ファイルのリンクを解除します。

sudo unlink /etc/nginx/sites-enabled/default

次に、新しいNginx仮想ホスト構成を作成します。

cd /etc/nginx/sites-available
sudo nano chatwoot.conf

confファイルに次の構成を追加します。

# server {
server_name chatwoot.idroot.us www.chatwoot.idroot.us;

# Point upstream to Chatwoot App Server
set $upstream 127.0.0.1:3000;

# Nginx strips out underscore in headers by default
# Chatwoot relies on underscore in headers for API
# Make sure that the config is turned on.
underscores_in_headers on;
location /.well-known {
alias /var/www/ssl-proof/chatwoot/.well-known;
}

location / {
proxy_pass_header Authorization;
proxy_pass https://$upstream;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Ssl on; # Optional

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_http_version 1.1;
proxy_set_header Connection “”;
proxy_buffering off;

client_max_body_size 0;
proxy_read_timeout 36000s;
proxy_redirect off;
}
listen 80;
}

Save 構成ファイルとリンク /etc/nginx/sites-enabled

sudo ln -s /etc/nginx/sites-available/chatwoot.conf /etc/nginx/sites-enabled/chatwoot.conf

Nginx構成に問題がないことを確認してから、Nginxサービスを再起動します。

sudo nginx -t
sudo systemctl reload nginx

ステップ4.インストールと構成 Let’s Encrypt SSL。

Chatwootで安全なHTTPS接続を有効にする必要があります。 から無料のTLS証明書を取得できます Let’s Encrypt。 インストール Let’s Encrypt Ubuntu 20.04リポジトリのクライアント(certbot):

sudo add-apt-repository ppa:certbot/certbot

次に、certbotをインストールします。

sudo apt update
sudo apt install python-certbot-nginx

走る Let’s Encrypt 次のコマンドを使用します。

sudo mkdir -p /var/www/ssl-proof/chatwoot/.well-known
sudo certbot --webroot -w /var/www/ssl-proof/chatwoot/ -d idroot.us -i nginx

ステップ5.ChatwootWebインターフェイスへのアクセス。

Chatwootは、デフォルトでHTTPポート80で使用できます。 お気に入りのブラウザを開き、に移動します https://idroot.us/ インストールを完了するために必要な手順を完了します。 ファイアウォールを使用している場合は、ポート80を開いてコントロールパネルにアクセスできるようにしてください。

ステップ6.Chatwoot環境を構成します。

まず、Chatwootユーザーとしてログインし、環境変数フォルダーを作成します。

sudo -i -u chatwoot
cd chatwoot
nano .env

これで、変数ページを参照して追加できます ファイル内の変数定義

にとって example、を使用するには Facebook チャネルでは、ファイルに以下の行を追加できます。

FB_VERIFY_TOKEN=
FB_APP_SECRET=
FB_APP_ID=

Sendgridを使用するには、以下のブロックを使用してください。

SMTP_ADDRESS=smtp.sendgrid.net
SMTP_AUTHENTICATION=plain
SMTP_DOMAIN=<your verified domain>
SMTP_ENABLE_STARTTLS_AUTO=true
SMTP_PORT=587
SMTP_USERNAME=apikey
SMTP_PASSWORD=<your Sendgrid API key>

環境ファイルに変更を加えた後、以下のコマンドを実行してChatwootを再起動します。

sudo systemctl restart chatwoot.target

おめでとう! これで、Chatwootが正常にインストールされました。 Ubuntu 20.04 LTS FocalFossaシステムにChatwootをインストールするためにこのチュートリアルを使用していただきありがとうございます。 追加のヘルプまたは有用な情報については、確認することをお勧めします Chatwootの公式ウェブサイト