How to Manually Install Soketi WebSocket Server on Ubuntu 24.04
This guide explains how to manually install and configure Soketi WebSocket Server on Ubuntu 24.04. The instructions are based on the supplied Soketi Ansible playbook.
Follow the steps in order. Copy and paste each command into the Ubuntu terminal and wait for it to finish before moving to the next step.
This guide follows the configuration values in the supplied Ansible playbook. If you are installing Soketi on a production server, replace example credentials such as
app-secret with secure values.1. What Is Soketi?
Soketi is a WebSocket server that allows applications to maintain real-time connections with users.
It can be used when an application needs to send information to a browser immediately without requiring the browser to constantly refresh.
The supplied Ansible playbook installs:
- Node.js 18
- npm
- Soketi version 1.6.1
- A dedicated
soketisystem user - A dedicated
soketisystem group - A Soketi configuration file
- A systemd service
- Soketi WebSocket service on port 6001
2. Configuration Used by the Playbook
| Setting | Value |
|---|---|
| Operating System | Ubuntu 24.04 |
| Node.js Version | 18 |
| Soketi Version | 1.6.1 |
| Linux User | soketi |
| Linux Group | soketi |
| Installation Directory | /opt/soketi |
| Soketi Host | 0.0.0.0 |
| Soketi Port | 6001 |
| Application ID | app-id |
| Application Key | app-key |
| Application Secret | app-secret |
3. Check the Ubuntu Version
First, make sure the server is running Ubuntu 24.04.
Run:
lsb_release -a
You can also check with:
cat /etc/os-release
The operating system should show Ubuntu 24.04.
4. Update Ubuntu
The first task in the Ansible playbook updates the Ubuntu package list.
Run:
sudo apt update
Wait for the command to finish.
5. Install Required Packages
The playbook installs four prerequisite packages:
curlca-certificatesgnupgbuild-essential
These packages provide tools required to download software, verify repositories and build native Node.js dependencies when necessary.
Install them with:
sudo apt install -y curl ca-certificates gnupg build-essential
6. Remove Old NodeSource Repository Files
The Ansible playbook removes older NodeSource repository configuration files before configuring Node.js 18.
Run:
sudo rm -f /etc/apt/sources.list.d/nodesource.sources
sudo rm -f /etc/apt/sources.list.d/nodesource.list
If these files do not exist, that is okay. The rm -f command will simply continue.
7. Download the Node.js 18 NodeSource Setup Script
The playbook uses the NodeSource repository to install Node.js 18.
Download the setup script:
curl -fsSL https://deb.nodesource.com/setup_18.x -o /tmp/nodesource_setup.sh
Make the script executable:
sudo chmod 0755 /tmp/nodesource_setup.sh
8. Configure the NodeSource Repository
Run the downloaded NodeSource setup script:
sudo /tmp/nodesource_setup.sh
This configures the NodeSource repository required to install Node.js 18.
A repository is an online location where Ubuntu can download software packages and updates.
9. Update APT Again
After adding the NodeSource repository, update the package list again:
sudo apt update
10. Install Node.js 18
Install Node.js:
sudo apt install -y nodejs
Node.js includes npm, which will be used to install Soketi.
11. Check the Node.js Version
Verify Node.js:
node --version
The playbook expects Node.js 18.
A version beginning with v18 indicates that Node.js 18 is installed.
12. Check the npm Version
Check npm:
npm --version
If npm displays a version number, npm is installed correctly.
13. Create the Soketi System Group
The playbook creates a dedicated Linux system group called soketi.
Create it manually:
sudo groupadd --system soketi
You may see an error saying that the group already exists. This is not a problem if you are following the guide on a system where Soketi was previously configured.
14. Create the Soketi System User
The playbook creates a dedicated system user named soketi.
The user does not have a normal login shell. This is safer because the account is intended only to run the Soketi service.
Run:
sudo useradd \
--system \
--gid soketi \
--shell /usr/sbin/nologin \
--home-dir /opt/soketi \
--no-create-home \
soketi
15. Create the Soketi Directory
The playbook stores Soketi-related configuration in:
/opt/soketi
Create the directory:
sudo mkdir -p /opt/soketi
Change the owner to the Soketi user and group:
sudo chown soketi:soketi /opt/soketi
Set the directory permissions:
sudo chmod 0755 /opt/soketi
16. Install Soketi Version 1.6.1
The playbook installs Soketi globally using npm.
Install the exact version specified by the playbook:
sudo npm install -g @soketi/soketi@1.6.1
Wait for npm to finish installing the package.
17. Find the Soketi Executable
The Ansible playbook uses which soketi to find where the Soketi executable was installed.
Run:
which soketi
You should receive a path similar to:
/usr/bin/soketi
Your actual path may be different. Use the path returned by your system when creating the systemd service later.
18. Verify the Soketi Version
Check the installed version:
soketi --version
The installed version should correspond to:
1.6.1
19. Create the Soketi Environment File
The Ansible playbook creates an environment file at:
/opt/soketi/.env
This file contains the Soketi application credentials.
Create the file:
sudo nano /opt/soketi/.env
Paste the following:
SOKETI_DEFAULT_APP_ID=app-id
SOKETI_DEFAULT_APP_KEY=app-key
SOKETI_DEFAULT_APP_SECRET=app-secret
SOKETI_DEFAULT_APP_ENABLE_CLIENT_MESSAGES=true
Save the file:
- Press Ctrl + O
- Press Enter
- Press Ctrl + X
20. Protect the Environment File
The Ansible playbook gives the .env file permissions of 0600. This means only the owner can read and modify it.
Set the owner:
sudo chown soketi:soketi /opt/soketi/.env
Set the permissions:
sudo chmod 0600 /opt/soketi/.env
The
.env file contains application credentials. Do not publish this file or give unnecessary users access to it.21. Create the Soketi systemd Service
A systemd service allows Ubuntu to start, stop and automatically restart Soketi.
The playbook creates:
/etc/systemd/system/soketi.service
Create the service file:
sudo nano /etc/systemd/system/soketi.service
Paste the following into the file.
The
ExecStart line below assumes that which soketi returned /usr/bin/soketi. If your system returned another path, replace /usr/bin/soketi with the path returned by your system.[Unit]
Description=Soketi WebSocket Server
Documentation=https://docs.soketi.app/
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=soketi
Group=soketi
WorkingDirectory=/opt/soketi
EnvironmentFile=/opt/soketi/.env
ExecStart=/usr/bin/soketi start --host 0.0.0.0 --port 6001
Restart=always
RestartSec=5
NoNewPrivileges=true
PrivateTmp=true
Environment=NODE_ENV=production
[Install]
WantedBy=multi-user.target
Save the file:
- Press Ctrl + O
- Press Enter
- Press Ctrl + X
22. Reload systemd
Ubuntu needs to reload its systemd configuration so that it can see the new Soketi service.
Run:
sudo systemctl daemon-reload
23. Enable Soketi
Enable the service so that Soketi starts automatically when the server boots.
sudo systemctl enable soketi
24. Start Soketi
Start the Soketi service:
sudo systemctl start soketi
25. Check the Soketi Service
Check whether Soketi is running:
sudo systemctl status soketi
Look for:
Active: active (running)
Press q to exit the status screen.
26. Check Soketi Service Status Directly
The Ansible playbook runs systemctl is-active soketi.
Run the same command:
systemctl is-active soketi
The expected result is:
active
27. Check Port 6001
The playbook configures Soketi to listen on port 6001.
Check whether something is listening on the port:
sudo ss -ltnp | grep 6001
You should see a listening socket containing port 6001.
28. Check All Listening Ports
The Ansible playbook also runs:
ss -ltnp
You can run:
sudo ss -ltnp
Look for port 6001.
29. Check the Soketi Logs
If Soketi does not start, the first thing to check is the systemd log.
Run:
sudo journalctl -u soketi --no-pager -n 50
This displays the latest 50 log entries for Soketi.
To watch the logs live, use:
sudo journalctl -u soketi -f
Press Ctrl + C to stop watching the logs.
30. Find the Server IP Address
To connect to Soketi from another computer or application, find the Ubuntu server's IP address.
Run:
hostname -I
Example:
192.168.1.100
Your IP address will be different.
31. Soketi WebSocket Address
The Ansible playbook configures:
- Host:
0.0.0.0 - Port:
6001
Therefore, clients can connect using:
ws://YOUR_SERVER_IP:6001
For example:
ws://192.168.1.100:6001
The playbook configures a normal WebSocket address using
ws://. It does not configure HTTPS/WSS or TLS certificates.32. Allow Port 6001 Through the Firewall
If UFW is enabled and clients need to connect to Soketi from another machine, port 6001 may need to be allowed.
First check whether UFW is enabled:
sudo ufw status
If UFW is active and you intentionally need external access to Soketi, allow port 6001:
sudo ufw allow 6001/tcp
Then check the firewall:
sudo ufw status
Only expose port 6001 to networks or IP addresses that actually need access. The supplied playbook binds Soketi to
0.0.0.0, meaning it listens on all IPv4 interfaces.33. Verify the Environment Configuration
Check the configuration file:
sudo cat /opt/soketi/.env
It should contain:
SOKETI_DEFAULT_APP_ID=app-id
SOKETI_DEFAULT_APP_KEY=app-key
SOKETI_DEFAULT_APP_SECRET=app-secret
SOKETI_DEFAULT_APP_ENABLE_CLIENT_MESSAGES=true
Do not share the output of this command publicly because it contains the Soketi application secret.
34. Verify the Soketi Service Configuration
Display the systemd service:
sudo cat /etc/systemd/system/soketi.service
Confirm that it contains:
User=soketi
Group=soketi
WorkingDirectory=/opt/soketi
EnvironmentFile=/opt/soketi/.env
ExecStart=/usr/bin/soketi start --host 0.0.0.0 --port 6001
Restart=always
RestartSec=5
35. Restart Soketi After Configuration Changes
If you change the environment file or systemd service, reload systemd:
sudo systemctl daemon-reload
Then restart Soketi:
sudo systemctl restart soketi
Check the status:
sudo systemctl status soketi
36. Troubleshooting
Problem: Node.js is not installed
Check:
node --version
If the command is not found, repeat the NodeSource installation steps.
Problem: Soketi command is not found
Check where Soketi is installed:
which soketi
If nothing is returned, reinstall Soketi:
sudo npm install -g @soketi/soketi@1.6.1
Then check again:
which soketi
Problem: Soketi service will not start
Check the service:
sudo systemctl status soketi
Then check the logs:
sudo journalctl -u soketi --no-pager -n 50
Problem: Port 6001 is already being used
Check what is using port 6001:
sudo ss -ltnp | grep 6001
If another application is already using port 6001, Soketi cannot use that same port.
Problem: Permission denied
Check the Soketi directory:
ls -ld /opt/soketi
Check the environment file:
ls -l /opt/soketi/.env
Correct the ownership:
sudo chown soketi:soketi /opt/soketi
sudo chown soketi:soketi /opt/soketi/.env
Correct the permissions:
sudo chmod 0755 /opt/soketi
sudo chmod 0600 /opt/soketi/.env
Problem: Soketi keeps restarting
The systemd service is configured with:
Restart=always
RestartSec=5
This means systemd will automatically attempt to restart Soketi if it stops.
Check the logs to find out why it is stopping:
sudo journalctl -u soketi --no-pager -n 100
37. Complete Manual Installation Commands
If you understand the individual steps and want the main commands in one place, use the following.
sudo apt update
sudo apt install -y curl ca-certificates gnupg build-essential
sudo rm -f /etc/apt/sources.list.d/nodesource.sources
sudo rm -f /etc/apt/sources.list.d/nodesource.list
curl -fsSL https://deb.nodesource.com/setup_18.x -o /tmp/nodesource_setup.sh
sudo chmod 0755 /tmp/nodesource_setup.sh
sudo /tmp/nodesource_setup.sh
sudo apt update
sudo apt install -y nodejs
node --version
npm --version
sudo groupadd --system soketi
sudo useradd \
--system \
--gid soketi \
--shell /usr/sbin/nologin \
--home-dir /opt/soketi \
--no-create-home \
soketi
sudo mkdir -p /opt/soketi
sudo chown soketi:soketi /opt/soketi
sudo chmod 0755 /opt/soketi
sudo npm install -g @soketi/soketi@1.6.1
which soketi
soketi --version
Then create the configuration and service files described in the previous steps.
38. Final Verification
Run these commands to verify the installation.
Check Node.js:
node --version
Check npm:
npm --version
Check Soketi:
soketi --version
Check the Soketi service:
systemctl is-active soketi
Expected:
active
Check that Soketi starts automatically:
systemctl is-enabled soketi
Expected:
enabled
Check port 6001:
sudo ss -ltnp | grep 6001
Check Soketi logs:
sudo journalctl -u soketi --no-pager -n 50
39. Installation Complete
Soketi has been successfully installed when:
- Node.js 18 is installed.
- npm is installed.
- Soketi 1.6.1 is installed.
- The
soketiLinux user exists. - The
soketiLinux group exists. - The
/opt/soketidirectory exists. - The
/opt/soketi/.envfile exists. - The Soketi systemd service exists.
- The Soketi service is active (running).
- The Soketi service is enabled.
- Port 6001 is listening.
40. Soketi Access Information
| Item | Value |
|---|---|
| WebSocket Host | 0.0.0.0 |
| WebSocket Port | 6001 |
| WebSocket URL | ws://YOUR_SERVER_IP:6001 |
| Soketi Version | 1.6.1 |
| Node.js | 18.x |
| Configuration Directory | /opt/soketi |
| Environment File | /opt/soketi/.env |
| Systemd Service | /etc/systemd/system/soketi.service |
Important Note About Soketi
Soketi is a WebSocket server, not a normal web application with a traditional web page or graphical interface.
The supplied playbook exposes Soketi on:
ws://YOUR_SERVER_IP:6001
The application that uses Soketi normally connects to this WebSocket endpoint using the configured application ID, key and secret.
Source note:
This knowledgebase article is based on the supplied Soketi Ansible Playbook. The commands reproduce the playbook's Node.js 18 installation, NodeSource repository configuration, Soketi 1.6.1 installation, dedicated Linux user and group, configuration file, systemd service, port 6001, service startup and verification tasks. Values such as the Soketi application ID, key and secret are taken from the supplied playbook.

