アンドロイド

CentOS 7でrocket.chatを展開する方法

RocketChatCTL ile Ubuntu 18.04/19.04, CentOS 7, Debian 9’da Rocket.Chat Kurulumu #SlackAlternatifi

RocketChatCTL ile Ubuntu 18.04/19.04, CentOS 7, Debian 9’da Rocket.Chat Kurulumu #SlackAlternatifi

目次:

Anonim

Rocket.Chatは、完全なチームコミュニケーションプラットフォームであり、自己ホスト型のSlackの代替手段です。 Meteorで構築され、ヘルプデスクチャット、ビデオ会議、ファイル共有、ボイスメッセージ、APIなどを含むさまざまな機能を提供します。

このチュートリアルでは、NginxをSSLリバースプロキシとして使用するCentOS 7サーバーにRocket.Chatをインストールして展開する方法を示します。

前提条件

このチュートリアルを続行する前に、次の前提条件を満たしていることを確認してください。

  • 公式Rocket.Chatシステム要件によると、少なくとも1GのRAMが必要なCentOS 7サーバー。sudo特権を持つユーザーとしてログインします。サーバーIPアドレスを指すドメイン名があります。 、 example.com を使用し example.com 。Nginxがインストールされている場合は、このチュートリアルに従ってインストールできます。SSL証明書。 Let's Encryptから無料のものを生成するか、別のプロバイダーから購入できます。

依存関係のインストール

必要な npm モジュールを構築するために必要な次のパッケージをインストールします。

sudo yum install epel-release curl GraphicsMagick gcc-c++

次に、次のように入力して Node.js npm インストールします。

sudo yum install -y nodejs npm

この記事を書いている時点では、Rocket.Chatの推奨Node.jsバージョンはNode.js v8.11.3です。

次のコマンドを発行して、 n ユーティリティと推奨されるNode.jsバージョンをインストールします。

sudo npm install -g inherits n sudo n 8.11.3 sudo npm install -g inherits n sudo n 8.11.3

MongoDBはNoSQLドキュメント指向のデータベースであり、Rocket.Chatがデータストアとして使用します。 Rocket.Chatは、MongoDBバージョン3.6を推奨しています。

MongoDB公式リポジトリの yum を使用してMongoDBをインストールします。

選択したエディターを開き、次のリポジトリファイルを作成します。

sudo nano /etc/yum.repos.d/mongodb-org.repo

次のコンテンツをファイルに貼り付けます。

/etc/yum.repos.d/mongodb-org.repo

name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.6/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-3.6.asc

ファイルを保存し、テキストエディターを閉じます。

MongoDBをインストールするには、次のコマンドを実行します。

sudo yum install mongodb-org

インストールが完了したら、MongoDBサービスを有効にして開始します。

sudo systemctl start mongod sudo systemctl enable mongod

新しいシステムユーザーを作成する

Rocket.Chatインスタンスを実行する新しいユーザーとグループを作成します。 簡単にするために、ユーザーに rocket という名前を付けます。

sudo useradd -m -U -r -d /opt/rocket rocket

nginx ユーザーを新しいユーザーグループに追加し、 /opt/rocket ディレクトリのアクセス許可を変更して、Nginxがアクセスできるようにします。

sudo usermod -a -G rocket nginx sudo chmod 750 /opt/rocket

Rocket.Chatのインストール

次のように入力して、ユーザー rocket 切り替えます。

sudo su - rocket

curlを使用したRocket.Chatの最新の安定バージョンをダウンロードします。

curl -L https://releases.rocket.chat/latest/download -o rocket.chat.tgz

ダウンロードが完了したら、アーカイブを解凍し、ディレクトリの名前を Rocket.Chat 変更し Rocket.Chat

tar zxf rocket.chat.tgz mv bundle Rocket.Chat

Rocket.Chat/programs/server ディレクトリに Rocket.Chat/programs/server し、必要なすべての npm パッケージをインストールします。

cd Rocket.Chat/programs/server npm install

systemdユニットを作成し、Nginxでリバースプロキシを設定する前に、インストールが成功したかどうかをテストすることをお勧めします。

これを行うには、必要な環境変数を設定することから始めます。

export PORT=3000 export ROOT_URL=http://example.com:3000/ export MONGO_URL=mongodb://localhost:27017/rocketchat export ROOT_URL=http://example.com:3000/ export MONGO_URL=mongodb://localhost:27017/rocketchat

次に、 Rocket.Chat ディレクトリに戻り、次のコマンドを発行して Rocket.Chat サーバーを起動します。

cd../../ node main.js

エラーがない場合は、次の出力が表示されます。

➔ +---------------------------------------------+ ➔ | SERVER RUNNING | ➔ +---------------------------------------------+ ➔ | | ➔ | Rocket.Chat Version: 0.71.1 | ➔ | NodeJS Version: 8.11.3 - x64 | ➔ | Platform: linux | ➔ | Process Port: 3000 | ➔ | Site URL: http://0.0.0.0:3000/ | ➔ | ReplicaSet OpLog: Disabled | ➔ | Commit Hash: e73dc78ffd | ➔ | Commit Branch: HEAD | ➔ | | ➔ +---------------------------------------------+

この時点で、Rocket.ChatがCentOS 7マシンにインストールされます。 CTRL+C Rocket.Chatサーバーを停止し、次の手順に進みます。

Systemdユニットを作成する

Rocket.Chatをサービスとして実行するには、 /etc/systemd/system/ ディレクトリに rocketchat.service ユニットファイルを作成します。

sudo nano /etc/systemd/system/rocketchat.service 次の内容をファイルに貼り付けます:/etc/systemd/system/rocketchat.service

Description=Rocket.Chat server After=network.target nss-lookup.target mongod.target StandardOutput=syslog StandardError=syslog SyslogIdentifier=rocketchat User=rocket Environment=MONGO_URL=mongodb://localhost:27017/rocketchat ROOT_URL=http://example.com:3000/ PORT=3000 ExecStart=/usr/local/bin/node /opt/rocket/Rocket.Chat/main.js WantedBy=multi-user.target

ファイルを保存して閉じます。

systemdに新しいユニットファイルが作成されたことを通知し、次を実行してRocket.Chatサービスを開始します。

sudo systemctl daemon-reload sudo systemctl start rocketchat

次のコマンドでサービスの状態を確認します。

sudo systemctl status rocketchat

出力は次のようになります。

● rocketchat.service - Rocket.Chat server Loaded: loaded (/etc/systemd/system/rocketchat.service; enabled; vendor preset: disabled) Active: active (running) since Tue 2018-04-10 20:30:56 UTC; 8s ago Main PID: 32356 (node) CGroup: /system.slice/rocketchat.service └─32356 /usr/local/bin/node /opt/rocket/Rocket.Chat/main.js

エラーがなければ、起動時にRocket.Chatサービスを自動的に開始することができます。

sudo systemctl enable rocketchat

Nginxでリバースプロキシをセットアップする

次に、Rocket.Chatインストール用の新しいサーバーブロックを作成する必要があります。

sudo nano /etc/nginx/conf.d/example.com.conf

次のコンテンツをファイルに貼り付けます。

/etc/nginx/conf.d/example.com.conf

upstream rocketchat_backend { server 127.0.0.1:3000; } server { listen 80; server_name example.com www.example.com; include snippets/letsencrypt.conf; return 301 https://example.com$request_uri; } server { listen 443 ssl http2; server_name www.example.com; ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem; include snippets/ssl.conf; return 301 https://example.com$request_uri; } server { listen 443 ssl http2; server_name example.com; ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem; include snippets/ssl.conf; include snippets/letsencrypt.conf; access_log /var/log/nginx/example.com-access.log; error_log /var/log/nginx/example.com-error.log; location / { proxy_pass http://rocketchat_backend/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forward-For $proxy_add_x_forwarded_for; proxy_set_header X-Forward-Proto http; proxy_set_header X-Nginx-Proxy true; proxy_redirect off; } }

変更を有効にするには、Nginxサービスをリロードします。

sudo systemctl reload nginx

Rocket.Chatの構成

ブラウザを開いて、 http://chat.example.com : http://chat.example.com と入力し http://chat.example.com

インストールが成功すると、Rocket.Chatセットアップウィザードが表示され、最初の管理者ユーザーの設定、組織の構成、無料プッシュ通知などを受信するためのサーバーの登録が案内されます。

初期セットアップウィザードの最初のセクションでは、管理者ユーザーをセットアップするよう求められます。

[ Go to your workspace ]ボタンをクリックすると、管理ユーザーとしてログインしているRocket.Chatダッシュボードにリダイレクトされます。

結論

CentOS 7サーバーにRocket.Chatを正常にインストールしました。 Rocket.Chatを使用して、チームとの共同作業、ファイルの共有、リアルタイムでのチャットを開始できます。

rocketchat nodejs centos mongodb