How to install Rocket.Chat server on a Raspberry Pi

Rocket.Chat is the leading free and open source team communication platform

"Users can set up Rocket.Chat on cloud or by hosting their own servers on-premises. Rocket.Chat can be forked on Github and become a new platform altogether, thanks to its code being open source and thus openly available to the community.

Key features include free audio and video conferencing, guest access, screen and file sharing, LiveChat, LDAP Group Sync, two-factor authentication (2FA), E2E encryption, SSO, dozens of OAuth providers and unlimited users, guests, channels, messages, searches and files." - from the Rocket.Chat website

Test setup

  • Raspberry Pi 3B+
  • Ubuntu 20.04 LTS Arm64
  • Rocket.Chat 3.9.0
  • Mongodb 4.2.7
  • NodeJS 12.18.4

Notes

  • Based on the instructions for Ubuntu and Debian provided by Rocket.Chat
  • For complete documentation visit the Rocket.Chat website

Instructions

  • Download Ubuntu 20.04 Server 64Bit ARM version from here https://ubuntu.com/download/raspberry-pi
  • Burn the IMG to SD Card
  • Copy a blank 'ssh' file to /boot partition on SD card to activate ssh
  • Boot Pi with SD card and LAN cable - Connect via SSH
ssh ubuntu@<YourPiIP>
  • password : ubuntu
  • Change password on first boot
  • Change hostname to "com1" or whatever by editing the /etc/hostname file
sudo vi /etc/hostname
  • Reboot
  • Re-connect via SSH
  • Update your system
sudo apt update && sudo apt dist-upgrade -y
  • Install Vim Nox to fix vi issues in Ubuntu and Avahi Daemon for ZeroConf discovery
sudo apt install vim-nox avahi-daemon
  • Install MonogDB and Node.js
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
echo "deb [ arch=arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 4B7C549A058F8B6B 
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 656408E390CFB1F5
sudo apt-get -y update && sudo apt-get install -y curl && curl -sL https://deb.nodesource.com/setup_12.x | sudo bash -
sudo apt-get install -y build-essential mongodb-org nodejs graphicsmagick
sudo npm install -g inherits n && sudo n 12.18.4
  • Install Rocket.Chat server
curl -L https://releases.rocket.chat/latest/download -o /tmp/rocket.chat.tgz
tar -xzf /tmp/rocket.chat.tgz -C /tmp
rm -r /tmp/bundle/programs/server/npm/node_modules/sharp/vendor 
cd /tmp/bundle/programs/server && npm install
sudo mv /tmp/bundle /opt/Rocket.Chat
  • Configure Rocket.Chat server permissions
sudo useradd -M rocketchat && sudo usermod -L rocketchat
sudo chown -R rocketchat:rocketchat /opt/Rocket.Chat
  • Create a startup service file for Rocket.Chat.
cat << EOF |sudo tee -a /lib/systemd/system/rocketchat.service
[Unit]
Description=The Rocket.Chat server
After=network.target remote-fs.target nss-lookup.target nginx.target mongod.target
[Service]
ExecStart=/usr/local/bin/node /opt/Rocket.Chat/main.js
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=rocketchat
User=rocketchat
Environment=MONGO_URL=mongodb://localhost:27017/rocketchat?replicaSet=rs01 MONGO_OPLOG_URL=mongodb://localhost:27017/local?replicaSet=rs01 ROOT_URL=http://localhost:3000/ PORT=3000
[Install]
WantedBy=multi-user.target
EOF
  • Open the Rocket.Chat service file just created (/lib/systemd/system/rocketchat.service) using sudo and your favourite text editor, and change the ROOT_URL environmental variable to reflect the URL you want to use for accessing the server (left on localhost works)
  • Edit MongoDB conf settings and start services
sudo sed -i "s/^#replication:/replication:\n  replSetName: rs01/" /etc/mongod.conf
sudo sed -i "s/bindIp/#bindIp/"  /etc/mongod.conf
sudo systemctl enable mongod && sudo systemctl start mongod
mongo --eval "printjson(rs.initiate())" 
sudo systemctl enable rocketchat && sudo systemctl start rocketchat
  • Takes a couple of minutes to be fully operational.
  • If you make any changes to the config or service files for Mongo or Rocket run the following to updated changes and then restart the service/s
sudo systemctl daemon-reload 
  • To configure your Rocket.Chat server use a browser and connect to:
http://<YourPiIP>:3000
  • or using zeroconf use hostname.local
http://com1.local:3000
  • Connect Rocket.Chat on Phones
http://<YourPiIP>:3000

Tags: