Step-by-Step Guide: How to Set Up a Coturn TURN Server on Ubuntu

A complete technical walkthrough of installing and securing your own relay server for production use

If you are building a production-ready WebRTC application, relying on public STUN servers is not enough. You need your own TURN server. Coturn is the most robust, open-source implementation available. Here is how to set it up:

1. Installation First, update your package list and install Coturn:
sudo apt-get update && sudo apt-get install coturn

2. Configuration Edit the configuration file located at /etc/turnserver.conf. Key parameters include:

3. Opening Firewalls Many developers fail here. You must open UDP and TCP port 3478 on your cloud provider's security group (AWS, Google Cloud, or Azure).

4. Testing the Setup Once the service is running (systemctl start coturn), you should verify it immediately. Use an [Online ICE Tester] to input your turn:your-ip:3478 and credentials. If you see "Relay" candidates being gathered, your server is working correctly.

More Optimizing WebRTC Latency: Why Your TURN Server Location Matters

Want to verify your own configuration?

Use our professional-grade ICE Tester to check your STUN/TURN server connectivity and latency in real-time.

🚀 Test Your Server Now