cuddly-vr-85751
11/25/2025, 5:44 PMtall-airline-16756
11/25/2025, 5:44 PMtall-airline-16756
11/25/2025, 5:44 PMcuddly-vr-85751
11/25/2025, 5:44 PMdocker pull livekit/generate
docker run --rm -it -v$PWD:/output livekit/generate
It creates a folder with the name of domain you provided, containing the following files:
• caddy.yam`l`
• docker-c`ompose.yaml`
• livekit`.yaml`
• redis.conf
• init_`script.sh`
• OR
• clo`ud_init.xxxx.yaml`
Deploy to a VM
Depending on your cloud provider, there are a couple of options:
This is the easiest method for deploying LiveKit Server. AWS, Azure, Digital Ocean, and others support
cloud-init
.
We have tested our scripts on Ubuntu and Amazon Linux, but it's possible the same scripts may work on other platforms. (Please let us know in Slack or open a PR!)
When starting a VM, paste the contents of the file
c`loud-init.xxxx.yaml`
into the User data field.
That's it! When the machine starts up, it'll execute the cloud-init protocol and install LiveKit.
We can also generate a startup script which may be copied onto any Linux VM.
This has been tested with Linode and Google Cloud.
1. Start a VM as usual
2. Copy the file init_script.sh to the VM
3. ssh into the instance
4. Run sudo ./init_script.sh to perform installation
When the install script is finished, your instance should be set up. It will have installed:
• docker
• docker-compose
• generated configuration to /opt/livekit
• systemd service livekit-docker
To start/stop the service via systemctl:
systemctl stop livekit-docker
systemctl start livekit-docker
Firewall
Ensure that the following ports are open on your firewall and accessible on the instance:
• 443 - primary HTTPS and TURN/TLS
• 80 - TLS issuance
• 7881 - WebRTC over TCP
• 3478/UDP - TURN/UDP
• 50000-60000/UDP - WebRTC over UDP
And if Ingress is desired
• 1935 - RTMP Ingress
• 7885/UDP - WebRTC for WHIP Ingress
DNS
Both primary and TURN domains must point to the IP address of your instance.
This is required for Caddy to start provisioning your TLS certificates.
Upgrading
To upgrade your install to new LiveKit releases, edit the docker compose file: /opt/livekit/docker-compose.yaml
Change the image field under livekit to livekit/livekit-server:v<version>
Alternatively, to always run the latest version, set the image field to livekit/livekit-server:latest and run:
docker pull livekit/livekit-server
Troubleshooting
If something is not working as expected, SSH in to your server and use the following commands to investigate:
systemctl status livekit-docker
cd /opt/livekit
sudo docker-compose logs
Checking TLS certificates
If certificate acquisition process has been successful, you should see the following log entry:
livekit-caddy-1 | {"level":"info","ts":1642786068.3883107,"logger":"tls.obtain","msg":"certificate obtained successfully","identifier":"<yourhost>"}
If you don't see these messages, it means your server could not be reached from the internet.
Ensure DNS is pointed at your domain
Running host <yourdomain> should show the IP address of your server. Ensure that it matches the IP address of your server.
Instance started before networking
When using cloud-init, it's possible that the instance started up before networking was available to the machine. This is commonly the case on EC2 instances. When this happens, your cloud-init scripts will be stuck in a bad state. To fix this, you can SSH into the machine and trigger a re-run:
sudo cloud-init clean --logs
sudo reboot now
Instance firewall
Certain Linux distributions ship with an instance-specific firewall enabled. To check if this is the case, run:
sudo firewall-cmd --list-all
If firewall is enabled, you could add the following rules to it and restart the firewall:
sudo firewall-cmd --zone public --permanent --add-port 80/tcp
sudo firewall-cmd --zone public --permanent --add-port 443/tcp
sudo firewall-cmd --zone public --permanent --add-port 7881/tcp
sudo firewall-cmd --zone public --permanent --add-port 443/udp
sudo firewall-cmd --zone public --permanent --add-port 50000-60000/udp
sudo firewall-cmd --reload
When the ports are successfully opened, running
curl http://<yourdomain> should return a 404 response. (instead of hanging)
On this page
Pre-requisites
Generate configuration
Deploy to a VM
Firewall
DNS
Upgrading
Troubleshooting
Checking TLS certificates
Ensure DNS is pointed at your domain
Instance started before networking
Instance firewall
Is this page helpful?
Previous
Deployment overview
Up Next
Kubernetes
The open source framework and cloud platform for voice, video, and physical AI agents.
Keep in touch
Developers
Documentation
Security
Docs MCP Server
Resources
Brand assetsVideo codecsCodec bitratesWebRTC browser testConnection testCompany
BlogCareersAboutOpen source© 2025 LiveKit. Engineered and designed worldwide. All rights reserved.
Terms of Service|Cookie Policy|Privacy Policy
all systems operational
Deploy to a VM | LiveKit docs how to setu thsi give full sten on new untun vemtall-airline-16756
11/25/2025, 5:44 PMcuddly-vr-85751
11/25/2025, 5:45 PMtall-airline-16756
11/25/2025, 5:45 PMinit_script.sh method (SSH into VM and run the script)?
• Do you have a domain and DNS ready that will point to the VM IP (yes/no)? If yes, will you create both the primary and TURN subdomain records?
• Will this VM be publicly reachable on the internet or behind a private network/VPC with NAT?
Answer those and I’ll provide a concise installation checklist tailored to your answers.cuddly-vr-85751
11/25/2025, 5:45 PMtall-airline-16756
11/25/2025, 5:46 PMlivekit.example.com and turn.example.com).
• You’ll paste cloud-init user-data when creating the VM.
1) Generate configuration locally
1. On your local machine run:
docker pull livekit/generate
docker run --rm -it -v $PWD:/output livekit/generate
1. When prompted, enter:
◦ Domain (e.g., livekit.yourdomain.com)
◦ Ingress: No (unless you need RTMP/WHIP input)
◦ Egress: Yes (if you want recording)
◦ Other defaults as appropriate
1. This creates a folder named for your domain containing:
◦ cloud_init.xxxx.yaml (user-data)
◦ init_script.sh
◦ docker-compose.yaml, caddy.yaml, livekit.yaml, etc.
2) Create the VM with cloud-init
1. Start a new Ubuntu 24.04 VM in your cloud provider.
2. In the VM creation UI, paste the entire contents of cloud_init.xxxx.yaml into the User Data / cloud-init field.
3. Boot the VM. Cloud-init will:
◦ Install Docker & Docker Compose
◦ Place configs in /opt/livekit
◦ Create a systemd service livekit-docker and start it
3) Configure DNS
• Create A records pointing to your VM’s public IP:
◦ livekit.yourdomain.com → VM IP
◦ turn.yourdomain.com → VM IP
• Both are required for Caddy to provision certificates and TURN to work.
4) Open required firewall/ports Allow these on the VM and in any cloud security group:
• TCP 443 (HTTPS, TURN/TLS)
• TCP 80 (Let's Encrypt)
• TCP 7881 (WebRTC over TCP)
• UDP 3478 (TURN/UDP)
• UDP 50000–60000 (WebRTC media)
Example UFW commands:
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 7881/tcp
sudo ufw allow 3478/udp
sudo ufw allow 50000:60000/udp
sudo ufw enable
5) Verify Caddy/TLS and LiveKit services SSH into the VM or use cloud console, then:
systemctl status livekit-docker
cd /opt/livekit
sudo docker-compose logs livekit-caddy-1
Look for a log line like:
"certificate obtained successfully", identifier: "livekit.yourdomain.com"
If you don’t see it, confirm DNS A records point to the VM and that ports 80/443 are reachable from the Internet.
6) Basic health checks
• From any machine: curl http://livekit.yourdomain.com — should return a quick 404 (shows Caddy reachable).
• Check LiveKit logs:
sudo docker-compose -f /opt/livekit/docker-compose.yaml logs
• Check systemd:
systemctl status livekit-docker
7) Generate tokens and test a client
• API key/secret appear in livekit.yaml (or set custom keys). Use the CLI or SDK to generate a token:
lk token room --api-key <key> --api-secret <secret> --room testroom --identity tester
• Use the LiveKit connection test or a sample app to join:
◦ WSS URL: wss://livekit.yourdomain.com
8) Upgrading LiveKit To change version, edit /opt/livekit/docker-compose.yaml and set image: livekit/livekit-server:v<version> or :latest then:
cd /opt/livekit
sudo docker-compose pull
sudo docker-compose down
sudo docker-compose up -d
Troubleshooting quick tips
• If cloud-init ran before networking finished:
sudo cloud-init clean --logs
sudo reboot now
• If Caddy can’t get certs: recheck DNS and that ports 80/443 are open and not proxied by Cloudflare (disable proxying).
• If TURN fails, ensure turn.<domain> DNS points to VM and UDP ports are open.
If you’d prefer the manual init_script.sh install instead of cloud-init, or want me to generate a ready-to-paste cloud-init file with your exact domain/subdomains, tell me:
• Exact primary domain/subdomain (e.g., livekit.example.com)
• Desired TURN hostname (e.g., turn.example.com) — or I can use turn.<primary>
• Whether you want Ingress (RTMP) or Egress (recordings) enabled now
Would you like me to produce the cloud-init user-data filled with your domain values now?cuddly-vr-85751
11/25/2025, 5:46 PMtall-airline-16756
11/25/2025, 5:46 PMinit_script.sh customized for your domain, please confirm:
• Primary LiveKit hostname you want (example: livekit.example.com)
• TURN hostname you want (example: turn.example.com) — I can default to turn.<primary> if you prefer
• Do you want recording (egress) enabled now? (yes/no)
Once you confirm those three items I’ll provide: 1) A ready-to-paste init_script.sh you run on the VM 2) Exact SSH/Copy/run commands 3) DNS and firewall steps to complete after the script runs 4) Quick validation/test steps and how to generate a token
Which hostnames and egress choice should I use?cuddly-vr-85751
11/25/2025, 5:47 PMtall-airline-16756
11/25/2025, 5:47 PMinit_script.sh. Quick confirmations so I fill it correctly:
• Primary LiveKit hostname (e.g., livekit.example.com):
• TURN hostname (e.g., turn.example.com) — reply "same" to use `turn.<primary>`:
• Enable recording/egress now? (yes/no)
Once you confirm those three, I’ll give: 1) a ready-to-paste init_script.sh 2) exact SSH/copy/run commands 3) DNS and firewall steps 4) validation and token generation stepscuddly-vr-85751
11/25/2025, 5:48 PMtall-airline-16756
11/25/2025, 5:48 PMsudo apt update && sudo apt -y upgrade
sudo apt install -y ca-certificates curl gnupg lsb-release
3) Install Docker Engine
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo systemctl enable --now docker
4) Create LiveKit install directory
sudo mkdir -p /opt/livekit
cd /opt/livekit
5) Create a minimal Docker Compose and config files
• Create /opt/livekit/docker-compose.yaml with these contents (replace hostnames):
version: "3.8"
services:
livekit:
image: livekit/livekit-server:latest
restart: unless-stopped
volumes:
- ./livekit.yaml:/etc/livekit/livekit.yaml:ro
ports:
- "7881:7881"
- "443:443"
- "80:80"
- "3478:3478/udp"
- "50000-60000:50000-60000/udp"
livekit-caddy:
image: caddy:2
restart: unless-stopped
volumes:
- ./caddy.yaml:/etc/caddy/Caddyfile:ro
ports:
- "80:80"
- "443:443"
• Create /opt/livekit/livekit.yaml (basic example — replace keys and hostnames):
rpc_port: 7880
rtc:
port_range: "50000-60000"
stun_servers:
- turn.livekit.example.com:3478
ui:
enabled: true
keys:
- key: "examplekey"
secret: "examplesecret"
• Create /opt/livekit/caddy.yaml (Caddyfile) pointing to your domain:
livekit.example.com {
reverse_proxy localhost:7881
}
turn.livekit.example.com {
tls internal
respond "TURN placeholder"
}
(You can replace contents with the generated caddy config later; this is a minimal starter.)
6) Start services
sudo docker compose up -d
7) DNS & firewall (must do now)
• Create A records pointing your domain subdomains to VM IP:
◦ livekit.example.com -> <VM IP>
◦ turn.livekit.example.com -> <VM IP>
• Open ports on VM/cloud firewall:
◦ TCP: 80, 443, 7881
◦ UDP: 3478, 50000–60000
Example UFW:
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 7881/tcp
sudo ufw allow 3478/udp
sudo ufw allow 50000:60000/udp
sudo ufw enable
8) Verify services and TLS
sudo docker compose logs livekit | tail -n 100
sudo docker compose logs livekit-caddy | tail -n 100
curl http://livekit.example.com
• If Caddy issued TLS, you’ll see certificate logs. If not, confirm DNS and that ports 80/443 are reachable.
9) Generate tokens and test
• Use the key/secret in livekit.yaml to generate tokens via SDK or lk CLI and connect to wss://livekit.example.com.
Notes and next steps
• This guide gives a minimal, working base. For production, use the LiveKit generate tool to create complete configs (Caddy TLS, TURN, egress/ingress) or tell me your exact domain and whether you want ingress/egress and I’ll produce a ready-to-run init_script.sh and full docker-compose.yaml tuned to your domain.cuddly-vr-85751
11/25/2025, 5:49 PMtall-airline-16756
11/25/2025, 5:50 PMlivekit/generate tool, or the docker-compose/Caddy/livekit config templates?
• Do you want a ready-to-run init_script.sh (I’ll fill in your domain) or a minimal manual step-by-step you can copy/paste?
• If you want a script, give your primary hostname (e.g., livekit.example.com) — I’ll default TURN to turn.<primary> unless you say otherwise.
Tell me which template and provide the hostname if you want the script, and I’ll produce the exact file/commands.cuddly-vr-85751
11/25/2025, 5:52 PMdocker pull livekit/generate
docker run --rm -it -v$PWD:/output livekit/generate
n
It creates a folder with the name of domain you provided, containing the following files:
• caddy.yaml
• docker-compose.yaml
• livekit.yaml
• redis.conf
• init_script.sh OR cloud_init.xxxx.yaml
Deploy to a VM
Depending on your cloud provider, there are a couple of options:
te
This is the easiest method for deploying LiveKit Server. AWS, Azure, Digital Ocean, and others support cloud-init
.
We have tested our scripts on Ubuntu and Amazon Linux, but it's possible the same scripts may work on other platforms. (Please let us know in Slack or open a PR!)
When starting a VM, paste the contents of the file cloud-init.xxxx.yaml into the User data field.
That's it! When the machine starts up, it'll execute the cloud-init protocol and install LiveKit.
We can also generate a startup script which may be copied onto any Linux VM.
This has been tested with Linode and Google Cloud.
1. Start a VM as usual
2. Copy the file init_script.sh to the VM
3. ssh into the instance
4. Run sudo ./init_script.sh to perform installation
When the install script is finished, your instance should be set up. It will have installed:
• docker
• docker-compose
• generated configuration to `/opt/livekit`
• systemd service `livekit-docker`
To start/stop the service via systemctl:
systemctl stop livekit-docker
systemctl start livekit-docker
n
Firewall
Ensure that the following ports are open on your firewall and accessible on the instance:
• 443 - primary HTTPS and TURN/TLS
• 80 - TLS issuance
• 7881 - WebRTC over TCP
• 3478/UDP - TURN/UDP
• 50000-60000/UDP - WebRTC over UDP
And if Ingress is desired
• 1935 - RTMP Ingress
• 7885/UDP - WebRTC for WHIP Ingress
DNS
Both primary and TURN domains must point to the IP address of your instance.
This is required for Caddy to start provisioning your TLS certificates.
Upgrading
To upgrade your install to new LiveKit releases, edit the docker compose file: /opt/livekit/docker-compose.yaml
Change the image field under `livekit` to livekit/livekit-server:v<version>
Alternatively, to always run the latest version, set the image field to `livekit/livekit-server:latest` and run:
docker pull livekit/livekit-server
t
Troubleshooting
If something is not working as expected, SSH in to your server and use the following commands to investigate:
systemctl status livekit-docker
cd /opt/livekit
sudo docker-compose logs
Checking TLS certificates
If certificate acquisition process has been successful, you should see the following log entry:
livekit-caddy-1 | {"level":"info","ts":1642786068.3883107,"logger":"tls.obtain","msg":"certificate obtained successfully","identifier":"<yourhost>"}
If you don't see these messages, it means your server could not be reached from the internet.
Ensure DNS is pointed at your domain
Running host <yourdomain> should show the IP address of your server. Ensure that it matches the IP address of your server.
Instance started before networking
When using cloud-init, it's possible that the instance started up before networking was available to the machine. This is commonly the case on EC2 instances. When this happens, your cloud-init scripts will be stuck in a bad state. To fix this, you can SSH into the machine and trigger a re-run:
sudo cloud-init clean --logs
sudo reboot now
D
Instance firewall
Certain Linux distributions ship with an instance-specific firewall enabled. To check if this is the case, run:
sudo firewall-cmd --list-all
o
If firewall is enabled, you could add the following rules to it and restart the firewall:
sudo firewall-cmd --zone public --permanent --add-port 80/tcp
sudo firewall-cmd --zone public --permanent --add-port 443/tcp
sudo firewall-cmd --zone public --permanent --add-port 7881/tcp
sudo firewall-cmd --zone public --permanent --add-port 443/udp
sudo firewall-cmd --zone public --permanent --add-port 50000-60000/udp
sudo firewall-cmd --reload
c
When the ports are successfully opened, running `curl http://<yourdomain>` should return a 404 response. (instead of hanging)
On this page
Pre-requisites
Generate configuration
Deploy to a VM
Firewall
DNS
Upgrading
Troubleshooting
Checking TLS certificates
Ensure DNS is pointed at your domain
Instance started before networking
Instance firewall
Is this page helpful?
s
Previous
Deployment overviewUp Next
Kubernetes
The open source framework and cloud platform for voice, video, and physical AI agents.
Keep in touch
Developers
DocumentationSecurityDocs MCP ServerResources
Brand assetsVideo codecsCodec bitratesWebRTC browser testConnection testCompany
BlogCareersAboutOpen source© 2025 LiveKit. Engineered and designed worldwide. All rights reserved.
Terms of Service|Cookie Policy|Privacy Policy
all systems operational
Deploy to a VM | LiveKit docs help me setup thistall-airline-16756
11/25/2025, 5:52 PMinit_script.sh?
4. Enable recording/egress now? (yes/no)
5. Is the VM publicly reachable and can you add DNS A records for those hostnames to the VM IP? (yes/no)
If you want a generic, no-domain install (no TLS/TURN) instead, reply "generic" and I’ll provide that immediately.tall-airline-16756
11/25/2025, 7:42 PMdocker-compose ... down step. To narrow the cause, please run and paste the outputs of these commands:
1. journalctl logs for the unit:
sudo journalctl -xeu livekit-docker.service --no-pager | sed -n '1,200p'
1. Docker Compose config and any parse errors:
cd /opt/livekit || cd /etc/livekit || cd /home/ubuntu || pwd
sudo docker-compose -f docker-compose.yaml config
(If your compose file is at /opt/livekit/docker-compose.yaml use that path.)
1. Docker service status and recent logs:
sudo systemctl status docker --no-pager
sudo journalctl -u docker --since "5 minutes ago" --no-pager
1. Check container state and images:
sudo docker ps -a --no-trunc
sudo docker images --format "{{.Repository}}:{{.Tag}}\t{{.ID}}"
1. Check file permissions and ownership where compose lives:
ls -la $(pwd) | sed -n '1,200p'
While I wait for those outputs, common causes and quick checks you can try now:
• Ensure Docker is running (if not: sudo systemctl start docker).
• If compose references files in /opt/livekit, confirm you ran the script as root or used sudo so files exist there.
• Run compose manually to see errors:
sudo docker-compose -f /opt/livekit/docker-compose.yaml down
sudo docker-compose -f /opt/livekit/docker-compose.yaml up --no-start
Note any error messages and paste them here.
Send the command outputs above and I’ll analyze them and give the exact fix.