{"id":105,"date":"2018-10-17T03:55:56","date_gmt":"2018-10-17T03:55:56","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/10\/17\/rocket-chat-how-to-install-the-messaging-system-on-debian-9\/"},"modified":"2018-10-17T03:55:56","modified_gmt":"2018-10-17T03:55:56","slug":"rocket-chat-how-to-install-the-messaging-system-on-debian-9","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/10\/17\/rocket-chat-how-to-install-the-messaging-system-on-debian-9\/","title":{"rendered":"Rocket.Chat: How To Install The Messaging System on Debian 9"},"content":{"rendered":"<p>&#xD;<br \/>\n&#xD;<br \/>\n <a href=\"https:\/\/s24255.pcdn.co\/wp-content\/uploads\/2017\/03\/logo.png\"><img loading=\"lazy\" decoding=\"async\" alt=\"Rocket.Chat on Debian 9\" height=\"256\" src=\"https:\/\/s24255.pcdn.co\/wp-content\/uploads\/2017\/03\/logo.png\" width=\"256\" \/><\/a>&#xD;<\/p>\n<h3>What\u2019s Rocket.Chat<\/h3>\n<p>Rocket.Chat is a professional, Slack-like messaging system, developed for companies wanting to privately host their own chat service. It is developed in JavaScript using the Meteor full stack framework.<\/p>\n<p>It has many features, like:<\/p>\n<ul>\n<li>\n<ul>\n<li>Help desk chat<\/li>\n<li>Video conferences<\/li>\n<li>File sharing<\/li>\n<li>Link previews<\/li>\n<li>Voice messages<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>We will install Rocket.Chat on a Debian 9 server.<\/p>\n<h3>Getting Started<\/h3>\n<p>The first thing to do is to satisfy Rocket.Chat dependencies. Execute the following apt command:<\/p>\n<p># apt install build-essential graphicsmagick<\/p>\n<h3>Install MongoDB<\/h3>\n<p>Rocket.Chat works with MongoDB as database system. There aren\u2019t already Debian 9 packages for MongoDB, so we will install it from the tarball.<\/p>\n<h5>Download the tarball<\/h5>\n<p>First, download with curl the MongoDB tarball<\/p>\n<p>$ curl -O https:\/\/fastdl.mongodb.org\/linux\/mongodb-linux-x86_64-debian81-3.4.9.tgz<\/p>\n<h5>Extract the archive<\/h5>\n<p>Extract the previously downloaded archive by executing the following command:<\/p>\n<p>$ tar -zxvf mongodb-linux*.tgz<\/p>\n<p>Rename and move the directory, for example, in \/opt:<\/p>\n<p># mv mongodb-linux-x86_64-debian81-3.4.9\/ \/opt\/mongodb<\/p>\n<p>Update the PATH variable by adding the \/opt\/mongodb\/bin directory. In ~\/.bashrc add the following line:<\/p>\n<p>$ export PATH=$:\/opt\/mongodb\/bin<\/p>\n<h5>Create a unit file<\/h5>\n<p>Create a systemctl unit file for MongoDB, executing the following command:<\/p>\n<p># $EDITOR \/lib\/systemd\/system\/mongodb.service<\/p>\n<p>In this file, paste the following content:<\/p>\n<p>[Unit]&#xD;<br \/>\nDescription=A document-oriented database&#xD;<br \/>\n&#xD;<br \/>\n[Service]&#xD;<br \/>\nUser=mongodb&#xD;<br \/>\nGroup=mongodb&#xD;<br \/>\nRuntimeDirectory=mongodb&#xD;<br \/>\nRuntimeDirectoryMode=0755&#xD;<br \/>\nEnvironmentFile=-\/etc\/default\/mongodb&#xD;<br \/>\nEnvironment=CONF=\/etc\/mongodb.conf&#xD;<br \/>\nEnvironment=SOCKETPATH=\/run\/mongodb&#xD;<br \/>\nExecStart=\/opt\/mongodb\/bin\/mongod &#8211;unixSocketPrefix=$ &#8211;config $ $DAEMON_OPTS&#xD;<br \/>\n&#xD;<br \/>\n[Install]&#xD;<br \/>\nWantedBy=multi-user.target<\/p>\n<p>Save and exit.<\/p>\n<p>Reload systemd daemon service:<\/p>\n<p># systemctl daemon-reload<\/p>\n<h5>Start MongoDB<\/h5>\n<p>At this point, we can start MongoDB and enable it for starting at boot time:<\/p>\n<p># systemctl start mongodb&#xD;<br \/>\n# systemctl enable mongodb<\/p>\n<h3>Install Node.js and npm<\/h3>\n<p>Rocket.Chat requires Node.js (in particular, any version newer than 4.5) and npm. First of all, add the NodeSource repository:<\/p>\n<p># curl -sL https:\/\/deb.nodesource.com\/setup_8.x | bash &#8211;<\/p>\n<p>Next, execute the following command for installing both Node.js and npm:<\/p>\n<p># apt-get install nodejs<\/p>\n<p>Check the Node.js version:<\/p>\n<p># node &#8211;version&#xD;<br \/>\nv8.7.0<\/p>\n<p>Next, install n through npm:<\/p>\n<p># npm install -g n<\/p>\n<p>With n, it\u2019s possible to change Node.js version.<\/p>\n<h3>Install Rocket.Chat<\/h3>\n<p>If not exists, create the \/var\/www directory, which will store Rocket.Chat:<\/p>\n<p># mkdir -p \/var\/www&#xD;<br \/>\n# cd \/var\/www<\/p>\n<p>In that directory, execute the following command for downloading Rocket.Chat:<\/p>\n<p># wget https:\/\/s3.amazonaws.com\/download.rocket.chat\/build\/rocket.chat-0.58.4.tgz -O rocket.chat.tgz<\/p>\n<p>Extract the archive and rename the extracted folder:<\/p>\n<p># tar xzf rocket.chat.tgz&#xD;<br \/>\n# mv bundle Rocket.Chat<\/p>\n<p>Next, set environment variables and run the Rocket.Chat server:<\/p>\n<p># cd Rocket.Chat\/programs\/server&#xD;<br \/>\n# npm install&#xD;<br \/>\n# cd ..\/..&#xD;<br \/>\n&#xD;<br \/>\n# export ROOT_URL=http:\/\/example.com:3000\/&#xD;<br \/>\n# export MONGO_URL=mongodb:\/\/localhost:27017\/rocketchat&#xD;<br \/>\n# export PORT=3000<\/p>\n<p>Those who are using the replica set should set the MONGO_URL variable with this content: mongodb:\/\/localhost:27017\/rocketchat?replicaSet=001-rs<\/p>\n<p>Rocket.Chat is installed and configured, but it requires configuration behind a web server. In this tutorial we\u2019ll be using NGINX.<\/p>\n<h3>Install NGINX<\/h3>\n<p>NGINX can be install with apt:<\/p>\n<p># apt install nginx<\/p>\n<p>Create a new directory that will contain the SSL certificates:<\/p>\n<p># mkdir -p \/etc\/nginx\/ssl\/<\/p>\n<p>In this directory, generate a new key:<\/p>\n<p># openssl req -new -x509 -days 365 -nodes -out \/etc\/nginx\/ssl\/rocketchat.crt -keyout \/etc\/nginx\/ssl\/rocketchat.key<\/p>\n<p>Change permissions to the key file:<\/p>\n<p># chmod 400 rocketchat.key<\/p>\n<p>Create a Virtual Host file:<\/p>\n<p># $EDITOR \/etc\/nginx\/sites-available\/rocketchat<\/p>\n<p>In this file, paste the following content:<\/p>\n<p># Upstreams&#xD;<br \/>\nupstream backend {&#xD;<br \/>\n server 127.0.0.1:3000;&#xD;<br \/>\n}&#xD;<br \/>\n &#xD;<br \/>\n# Redirect Options&#xD;<br \/>\nserver {&#xD;<br \/>\n listen 80;&#xD;<br \/>\n server_name chat.mydomain.com;&#xD;<br \/>\n # enforce https&#xD;<br \/>\n return 301 https:\/\/$server_name$request_uri;&#xD;<br \/>\n}&#xD;<br \/>\n &#xD;<br \/>\n# HTTPS Server&#xD;<br \/>\nserver {&#xD;<br \/>\n listen 443;&#xD;<br \/>\n server_name chat.mydomain.com;&#xD;<br \/>\n &#xD;<br \/>\n error_log \/var\/log\/nginx\/rocketchat.access.log;&#xD;<br \/>\n &#xD;<br \/>\n ssl on;&#xD;<br \/>\n ssl_certificate \/etc\/nginx\/ssl\/rocketchat.crt;&#xD;<br \/>\n ssl_certificate_key \/etc\/nginx\/ssl\/rocketchat.key;&#xD;<br \/>\n ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # dont use SSLv3 ref: POODLE&#xD;<br \/>\n &#xD;<br \/>\n location \/ {&#xD;<br \/>\n proxy_pass http:\/\/192.168.1.110:3000\/;&#xD;<br \/>\n proxy_http_version 1.1;&#xD;<br \/>\n proxy_set_header Upgrade $http_upgrade;&#xD;<br \/>\n proxy_set_header Connection &#8220;upgrade&#8221;;&#xD;<br \/>\n proxy_set_header Host $http_host;&#xD;<br \/>\n &#xD;<br \/>\n proxy_set_header X-Real-IP $remote_addr;&#xD;<br \/>\n proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;&#xD;<br \/>\n proxy_set_header X-Forward-Proto http;&#xD;<br \/>\n proxy_set_header X-Nginx-Proxy true;&#xD;<br \/>\n &#xD;<br \/>\n proxy_redirect off;&#xD;<br \/>\n }&#xD;<br \/>\n}&#xD;<\/p>\n<p>Save and close the file. Activate the configuration with:<\/p>\n<p># ln -s \/etc\/nginx\/sites-available\/rocketchat \/etc\/nginx\/sites-enabled\/rocketchat<\/p>\n<p>Test NGINX:<\/p>\n<p># nginx -t<\/p>\n<p>If no errors occur, restart the web server:<\/p>\n<p># systemctl restart nginx<\/p>\n<p>Next, update the environment variables:<\/p>\n<p># cd \/var\/www\/Rocket.Chat\/ &#xD;<br \/>\n# export ROOT_URL=https:\/\/chat.example.com &#xD;<br \/>\n# export MONGO_URL=mongodb:\/\/localhost:27017\/rocketchat?replicaSet=001-rs &#xD;<br \/>\n# export PORT=3000<\/p>\n<p>Run Rocket.Chat:<\/p>\n<p># node main.js<\/p>\n<p>The final step is to insert the following URL into a web browser: https:\/\/chat.example.com to register a new admin account and finish the graphical configuration.<\/p>\n<h3>Conclusion<\/h3>\n<p>There you have it! We\u2019ve just explained how to install and configure your Rocket.Chat Server on a Debian 9 server using NGINX. This useful online communication program can help your team work more efficiently and with more collaboration!<\/p>\n<p> <a href=\"https:\/\/www.unixmen.com\/rocket-chat-install-messaging-system-debian-9\/\" target=\"_blank\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#xD; &#xD; &#xD; What\u2019s Rocket.Chat Rocket.Chat is a professional, Slack-like messaging system, developed for companies wanting to privately host their own chat service. It is developed in JavaScript using the Meteor full stack framework. It has many features, like: Help desk chat Video conferences File sharing Link previews Voice messages We will install Rocket.Chat on &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/10\/17\/rocket-chat-how-to-install-the-messaging-system-on-debian-9\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Rocket.Chat: How To Install The Messaging System on Debian 9&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-105","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/105","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=105"}],"version-history":[{"count":0,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/105\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}