How to Install Centrifugo on Debian Latest
Centrifugo is an open-source real-time messaging server. It can be used to power real-time messaging, notifications, and live events broadcasting in web and mobile apps.
Prerequisites
Before installing Centrifugo, make sure you have the following prerequisites:
- Debian latest server
- Root or sudo privileges
Step 1: Install Dependencies
The first step is to install some dependencies that are required by Centrifugo.
Update the system packages:
sudo apt updateInstall the following dependencies:
sudo apt install -y curl gnupg2
Step 2: Install Centrifugo
Follow the steps below to install Centrifugo on Debian latest:
Add the GPG key of the Centrifugo repository:
curl -s https://packagecloud.io/gpg.key | sudo apt-key add -Add the Centrifugo repository:
echo "deb https://packagecloud.io/centrifugal/centrifugo/debian/ stretch main" | sudo tee /etc/apt/sources.list.d/centrifugo.listNote: Replace the "stretch" in the above command with the Debian version on which you are installing Centrifugo.
Update the package list:
sudo apt updateInstall Centrifugo:
sudo apt install -y centrifugo
Step 3: Configure Centrifugo
After installing Centrifugo, you need to configure it by creating a configuration file.
Create a configuration file:
sudo nano /etc/centrifugo/config.jsonAdd the following content to the file:
{ "secret": "your_secret_key", // other configuration options... }Note: Replace "your_secret_key" with a strong random secret key.
Save and close the file.
Step 4: Run Centrifugo
Follow the steps below to run Centrifugo:
Start the Centrifugo server in the background:
sudo -u centrifugo centrifugo -c /etc/centrifugo/config.json &Note: The "&" at the end of the command runs the server in the background.
Check the status of Centrifugo:
systemctl status centrifugoIf the server is running, you will see the following output:
● centrifugo.service - Centrifugo Loaded: loaded (/etc/systemd/system/centrifugo.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2022-06-24 15:03:42 PDT; 2min 30s ago Main PID: 746 (centrifugo) Tasks: 7 (limit: 1149) Memory: 26.0M CGroup: /system.slice/centrifugo.service └─746 /usr/bin/centrifugo -c /etc/centrifugo/config.json Jun 24 15:03:42 debian systemd[1]: Started Centrifugo.
Congratulations! You have successfully installed and configured Centrifugo on Debian latest.