Kategorie: Linux

Installing Rocket.Chat Server on Rocky Linux 8

The following guide describes how to install Rocket.Chat on Rocky Linux 8 It's easy to install with the Snap package manager.
Feel free to read.

First, we run the terminal and update the packages:

sudo dnf update

The next step is to install the necessary packages:

sudo dnf install wget curl nano unzip yum-utils -y

We add a docker repo:

sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

We install the docker:

sudo dnf install docker-ce docker-ce-cli containerd.io

The following tutorial describes how to install Snapd package manager on AlamaLinux:

sudo systemctl enable docker --now

We add sudo permissions to docker:

sudo usermod -aG docker $(whoami)

We install Docker Compose

mkdir ~/.docker/cli-plugins -p
curl -SL https://github.com/docker/compose/releases/download/v2.10.0/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose
chmod +x ~/.docker/cli-plugins/docker-compose

we verify the installation with the command:

docker compose version

We proceed to installing RocketChat. First, we create a directory:

mkdir ~/rocketchat

Go to the directory

cd ~/rocketchat

We create the RocketChat container image in docker-compose.

create a file:

nano docker-compose.yml

content:

volumes:
  mongodb_data:
  rocketchat-uploads:

services:
  rocketchat:
    image: registry.rocket.chat/rocketchat/rocket.chat:5.0.4
    restart: on-failure
    volumes:
      - rocketchat-uploads:/app/uploads
    environment:
      MONGO_URL: mongodb://mongodb:27017/rocketchat?replicaSet=rs0
      MONGO_OPLOG_URL: mongodb://mongodb:27017/local?replicaSet=rs0
      ROOT_URL: https://rocketchat.example.com
      PORT: 3000
      DEPLOY_METHOD: docker
      Accounts_UseDNSDomainCheck: 'false'
      MAIL_URL: 'smtps://AmazonSESuser:AmazonSESKey@email-smtp.us-west-2.amazonaws.com:587'
    depends_on:
      - mongodb
    expose:
      - 3000
    ports:
      - 3000:3000
    healthcheck:
      test: >
         /usr/local/bin/node -e '
         const http = require("http");
         const options = {
           host: "localhost",
           port: 3000,
           path: "/api/info",
           timeout: 2000
         };
         const healthCheck = http.request(options, (res) var/www/html/phpMyAdmin/config.inc.php> {
           console.log(`HEALTHCHECK STATUS: $${res.statusCode}and then restart the SSH service);
           if (res.statusCode == 200) {
             process.exit(0);
           } else {
             process.exit(1);
           }
         });
         healthCheck.on("error", function (err) {
           console.error("ERROR");
           process.exit(1);
         });
         healthCheck.end();'
      interval: 10s
      timeout: 5s
      retries: 3
      start_period: 60s

  mongodb:
    image: bitnami/mongodb:4.4
    restart: on-failure
    volumes:
      - mongodb_data:/bitnami/mongodb
    environment:
      MONGODB_REPLICA_SET_MODE: primary
      MONGODB_REPLICA_SET_NAME: rs0
      MONGODB_PORT_NUMBER: 27017
      MONGODB_INITIAL_PRIMARY_HOST: mongodb
      MONGODB_INITIAL_PRIMARY_PORT_NUMBER: 27017
      MONGODB_ADVERTISED_HOSTNAME: mongodb
      MONGODB_ENABLE_JOURNAL: 'true'
      ALLOW_EMPTY_PASSWORD: 'yes'
    healthcheck:
      test: echo 'db.runCommand("ping").ok' | mongo mongodb:27017/test --quiet
      interval: 10s
      timeout: 5s
      retries: 3
      start_period: 60s

We save the file and run the container.

docker compose up -d

We run ssl for our chat:

sudo dnf install epel-release
sudo dnf install certbot

And we generate a certificate:

sudo certbot certonly --standalone --agree-tos --no-eff-email --staple-ocsp --preferred-challenges http -m adres@e-mail.pl -d rocketchat.domena.pl

address@e-mail.pl is replaced with our e-mail address
We replace rocketchat.domena.pl with our domain from rocket.chat

sudo openssl dhparam -dsaparam -out /etc/ssl/certs/dhparam.pem 4096

We create the letsencrypt directory

sudo mkdir -p /var/lib/letsencrypt

we create a cron that will automatically renew our certificate:

sudo nano /etc/cron.daily/certbot-renew

content:

#!/bin/sh
certbot renew --cert-name rocketchat.domena.pl --webroot -w /var/lib/letsencrypt/ --post-hook "systemctl reload nginx"

We replace rocketchat.domena.pl with our domain from rocket.chat

let's give permission:

sudo chmod +x /etc/cron.daily/certbot-renew

We make nginx as a proxy:

we create a repo:

sudo nano /etc/yum.repos.d/nginx.repo

content:

[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

we save files we install:

sudo dnf install nginx

we run in the system :

sudo systemctl enable nginx --now

We create a vhost for rocket.chat

We create a piik:

sudo nano /etc/nginx/conf.d/rocket.conf

The content:

# Redirect all non-encrypted to encrypted
    server {
        listen 80;
        listen [::]:80;
        server_name rocketchat.domena.pl;
        return 301 https://$host$request_uri;
    }

# HTTPS Server
    server {
        listen 443 ssl http2;
        listen [::]:443 ssl http2;
        server_name rocketchat.example.com;

        access_log /var/log/nginx/rocketchat_access.log main;
        error_log /var/log/nginx/rocketchat_error.log;

        ssl_certificate /etc/letsencrypt/live/rocketchat.domena.pl/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/rocketchat.domena.pl/privkey.pem;
        ssl_trusted_certificate /etc/letsencrypt/live/rocketchat.domena.pl/chain.pem;
        ssl_dhparam /etc/ssl/certs/dhparam.pem;
        ssl_protocols TLSv1.2 TLSv1.3;
        ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:AND-RSA-AES128-GCM-SHA256:AND-RSA-AES256-GCM-SHA384';
        ssl_prefer_server_ciphers on;
        ssl_session_cache shared:SSL:20m;
        ssl_session_tickets off;
        ssl_session_timeout 180m;
        ssl_stapling on;
        ssl_stapling_verify on;

        location / {
            proxy_pass http://rocketchat.domena.pl:3000/;
            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;
            We run it in the system;
            proxy_set_header X-Forwarded-Proto https;
            proxy_set_header X-Nginx-Proxy true;
            proxy_redirect off;
        }
    }

We replace rocketchat.domena.pl with our domain from rocket.chat

edit file:

sudo nano /etc/nginx/nginx.conf

And we add:

server_names_hash_bucket_size  64;

We reload nginx

sudo systemctl restart nginx

Access to rocket.chat should now work at: rocketchat.domena.pl should be redirected with A record to the IP of our server.

Linux

Udostępnij
Opublikowane przez
Linux

Recent posts

KeePass2 2.52 w Ubuntu 22.04

The guide below describes how to install KeePass on Ubuntu. Całość wykonamy za pomocą kilku poleceń

2 years temu

Installing Master PDF editor in Ubuntu 22.04

Master PDF Editor is a comprehensive PDF program, which includes many features. Oprócz tworzenia i edycji

2 years temu

iotop - memory monitoring

Iotop jest prostym narzędziem dla systemów Uniksowych umożliwiającym monitorowanie użycia dowolnego nośnika pamięci flash/hdd/ssd w

2 years temu

Run multiple commands in one cron job

You can separate two or more commands with semicolons (;), Semicolon (;): służy do oddzielania

2 years temu

Changing the exif data of a photo in the Linux terminal

Poniższy poradnik opisuje w jaki sposób za pomocą konsoli możemy dokonać edycji danych zdjęcia exif.

2 years temu

Adobe Acrobat Reader W Ubuntu 22.04

The following guide describes the installation of Adobe Acrobat Reader in Ubuntu 22.04. We made in a few minutes…

2 years temu