The guide below describes how to install Rocket.Chat on Ubuntu 20.04
Feel free to read.
To begin with, we update the package repositories and the system itself.
apt-get update -y
apt-get upgrade -y
We install the necessary packages:
apt-get install nginx gnupg2 git unzip build-essential curl software-properties-common graphicsmagick -y
The next step is to install Node.js
curl -sL https://deb.nodesource.com/setup_12.x | bash -
apt-get install nodejs -y
We can check the nodejs version by issuing the command:
node -v
We should get the result:
v12.19.0
The next step is to install MongoDB and configure it.
We download the key to the server by issuing the command:
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
We add a repository to the system:
add-apt-repository 'deb [arch=amd64] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse'
We install MongoDB
apt-get install mongodb-org -y
We run them in the system:
systemctl start mongod
systemctl enable mongod
Next, you need to edit the default MongoDB configuration file and define a replica set. You can do this with the following command:
nano /etc/mongod.conf
Add the following lines:
replication: replSetName: "replica01"
Save and close the file, and then restart the MongoDB service, to apply the configuration:
systemctl restart mongod
Then log into the MongoDB shell and enable the replica with the following command:
mongo
rs.initiate()
The log should look like this:
{ "info2" : "no configuration specified. Using a default configuration for the set", "me" : "127.0.0.1:27017", "ok" : 1, "operationTime" : Timestamp(1605081439, 1), "$clusterTime" : { "clusterTime" : Timestamp(1605081439, 1), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA ="), "keyId" : NumberLong(0) } } }
We can exit MongoDB shell with the following command:
exit
Installation Rocket.Chat
We add a user to the system and give him the appropriate group by issuing the following commands:
useradd -m -U -r -d /opt/rocket rocket --shell /bin/bash
usermod -a -G rocket www-data
We will acquire the rights to the rocket directory:
chmod 750 /opt/rocket
Log in to the rocket user and download rocket.chat files:
its - rocket
curl -L https://releases.rocket.chat/latest/download -o rocket.chat.tgz
We unpack the downloaded files and transfer them:
tar -xvzf rocket.chat.tgz
mv bundle Rocket.Chat
We go to the script directory and install it:
cd Rocket.Chat/programs/server
npm install
Once all dependencies are installed, you can exit the Rocket.Chat user with the following command:
exit
We create a service file to run on system startup
nano /etc/systemd/system/rocketchat.service
The content:
[Unit] Description=Rocket.Chat server After=network.target nss-lookup.target mongod.target [Service] StandardOutput=syslog StandardError=syslog SyslogIdentifier=rocketchat User=rocket Environment=MONGO_URL=mongodb://localhost:27017/rocketchat ROOT_URL=http://rocket.yourdomain.com PORT=3000 ExecStart=/usr/bin/node /opt/rocket/Rocket.Chat/main.js [Install] WantedBy=multi-user.target
Remember to change the ROOT_URL = http value://rocket.yourdomain.com on your domain name!
We're reloading the daemon and starting the service:
systemctl daemon-reload
systemctl start rocketchat
systemctl enable rocketchat
The service start status can be checked by executing the command:
systemctl status rocketchat
It should look like this:
? rocketchat.service - Rocket.Chat server Loaded: loaded (/etc/systemd/system/rocketchat.service; disabled; vendor preset: enabled) Active: active (running) since Wed 2020-11-11 07:58:01 UTC; 24s ago Main PID: 19951 (node) Tasks: 11 (limit: 4691) Memory: 508.7M CGroup: /system.slice/rocketchat.service ??19951 /usr/bin/node /opt/rocket/Rocket.Chat/main.js Nov 11 07:58:21 ubuntu2004 rocketchat[19951]: ? | MongoDB Version: 4.0.21 | Nov 11 07:58:21 ubuntu2004 rocketchat[19951]: ? | MongoDB Engine: wiredTiger | Nov 11 07:58:21 ubuntu2004 rocketchat[19951]: ? | Platform: linux | Nov 11 07:58:21 ubuntu2004 rocketchat[19951]: ? | Process Port: 3000 | Nov 11 07:58:21 ubuntu2004 rocketchat[19951]: ? | Site URL: http://rocket.yourdomain.com | Nov 11 07:58:21 ubuntu2004 rocketchat[19951]: ? | ReplicaSet OpLog: Enabled | Nov 11 07:58:21 ubuntu2004 rocketchat[19951]: ? | Commit Hash: e37d7ba8ed | Nov 11 07:58:21 ubuntu2004 rocketchat[19951]: ? | Commit Branch: HEAD | Nov 11 07:58:21 ubuntu2004 rocketchat[19951]: ? | | Nov 11 07:58:21 ubuntu2004 rocketchat[19951]: ? +----------------------------------------------------------+
We configure the Nginx vhost to work with rocket.chat
We create a new vhost file :
nano /etc/nginx/sites-available/rocketchat.conf
The content:
upstream myrocketchat { server 127.0.0.1:3000; } server { listen 80; server_name rocket.yourdomain.com; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; location / { proxy_pass http://myrocketchat/; 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; } }
Remember to change a few values:
server 127.0.0.1:3000; – 127.0.0.1 we replace the ip of our server.
server_name rocket.yourdomain.com; – rocket.yourdomain.com zastępujemy adresem naszej domeny.
We create a symbolic link to activate vhost:
ln -s /etc/nginx/sites-available/rocketchat.conf /etc/nginx/sites-enabled/
The next step is to check if the vhost was created correctly:
nginx -t
And the result:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
If everything is ok, restart Nginx
service nginx restart
Now the Rocket.chat installation process should start under our domain or server IP
Enter an administrator name, address e-mail, password and click Continue. You should see the following page:
We fill in at our discretion.
The next step is to select the language and server type
We accept license:
That's all our rocket.chat is already installed and available under our domain!
The guide below describes how to install KeePass on Ubuntu. Całość wykonamy za pomocą kilku poleceń…
Master PDF Editor is a comprehensive PDF program, which includes many features. Oprócz tworzenia i edycji…
Iotop jest prostym narzędziem dla systemów Uniksowych umożliwiającym monitorowanie użycia dowolnego nośnika pamięci flash/hdd/ssd w…
You can separate two or more commands with semicolons (;), Semicolon (;): służy do oddzielania…
Poniższy poradnik opisuje w jaki sposób za pomocą konsoli możemy dokonać edycji danych zdjęcia exif.…
The following guide describes how to install Rocket.Chat on Rocky Linux 8 Całość bardzo prosto zainstalujemy…