Keeping your Rocket Chat instance up-to-date is essential to ensure you benefit from the latest features, security patches, and performance improvements. If you have installed Rocket Chat from source and want to upgrade to the latest stable version, this guide will show you how to update Rocket Chat installed from source.
Want to update Rocket Chat installed via Snap?
Backup
We will start by backing up the database and the installed system. I assume Rocket Chat is installed in the /opt/Rocket.Chat
directory.
mkdir /opt/backups && cd /opt/backups
mongodump --archive=backup.archive
tar -czvf rocket.chat-backup.tar.gz /opt/Rocket.Chat
Upgrade
This depends on the version currently installed and the latest stable version available for download. Check your current version on the Rocket Chat administration page. To view the available releases, visit the releases page.
Note: Keep track of the Node versions (releases page); this is very important. If you want to update to Node v20, see the instructions below.
Upgrades should follow incremental steps, such as 6.12 -> 6.13 -> 7.1 -> 7.2. Currently, the stable release is 7.2.0.
The steps apply to all incremental updates. For simplicity, we will demonstrate the upgrade from 7.1 to 7.2.
First, stop the Rocket Chat service and download the 7.2 release archive.
systemctl stop rocketchat
mkdir /opt/downloads && cd /opt/downloads
curl -L https://releases.rocket.chat/7.2.0/download -o rocket.chat.tgz
Extract the archive and build it.
tar -xzf rocket.chat.tgz
cd bundle/programs/server && npm install
cd /opt/downloads && mv bundle /opt/Rocket.Chat
Change the ownership of the files and start the Rocket Chat service.
chown -R rocketchat:rocketchat /opt/Rocket.Chat
systemctl start rocketchat
You can check the logs with:
journalctl -u rocketchat
Upgrade Nodejs
Up until version 6.13, Rocket Chat supports Node v14, but for version 7.0 and above, Node v20 is required.
Installing Node is easy; you just need to run a few commands.
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
apt install nodejs
node -v
npm -v
This will do the job.