<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Priyabrato Saha</title>
    <description>The latest articles on DEV Community by Priyabrato Saha (@iampriyabrato2004).</description>
    <link>https://dev.to/iampriyabrato2004</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1442225%2F55b355bc-87d5-4da3-ad3e-7c96c111bd67.jpeg</url>
      <title>DEV Community: Priyabrato Saha</title>
      <link>https://dev.to/iampriyabrato2004</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/iampriyabrato2004"/>
    <language>en</language>
    <item>
      <title>Deploying a LiveKit Server on Google Cloud VM – Step-by-Step Guide</title>
      <dc:creator>Priyabrato Saha</dc:creator>
      <pubDate>Fri, 25 Jul 2025 16:25:43 +0000</pubDate>
      <link>https://dev.to/iampriyabrato2004/deploying-a-livekit-server-on-google-cloud-vm-step-by-step-guide-1klm</link>
      <guid>https://dev.to/iampriyabrato2004/deploying-a-livekit-server-on-google-cloud-vm-step-by-step-guide-1klm</guid>
      <description>&lt;h1&gt;
  
  
  🚀 Setting up LiveKit Server on a Google Cloud VM (GCP)
&lt;/h1&gt;

&lt;p&gt;This guide explains how to set up and run a &lt;strong&gt;LiveKit server&lt;/strong&gt; on a &lt;strong&gt;Google Cloud VM instance&lt;/strong&gt; using &lt;code&gt;systemd&lt;/code&gt; for persistent, auto-starting service.&lt;/p&gt;




&lt;h2&gt;
  
  
  📌 Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Google Cloud Project with billing enabled&lt;/li&gt;
&lt;li&gt;VM Instance created (preferably Ubuntu 22.04 LTS)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;gcloud&lt;/code&gt; CLI configured (optional for local management)&lt;/li&gt;
&lt;li&gt;Domain name (optional but useful)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  1. ✅ Create and Configure a VM Instance
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;a href="https://console.cloud.google.com/" rel="noopener noreferrer"&gt;GCP Console&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Navigate to &lt;strong&gt;Compute Engine &amp;gt; VM Instances&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create Instance&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Settings:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Machine type: e2-medium or higher&lt;/li&gt;
&lt;li&gt;Boot disk: Ubuntu 22.04 LTS&lt;/li&gt;
&lt;li&gt;Firewall: Allow both HTTP and HTTPS&lt;/li&gt;
&lt;li&gt;External IP: &lt;strong&gt;Static (Reserved)&lt;/strong&gt;

&lt;ol&gt;
&lt;li&gt;SSH into the instance:
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gcloud compute ssh &amp;lt;instance-name&amp;gt;
&lt;span class="c"&gt;# or use browser SSH terminal&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  2. 🧱 Install Dependencies
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;sudo &lt;/span&gt;apt upgrade &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; tmux curl unzip nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  3. 🛠 Install and Set Up LiveKit Server
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Download the Binary
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~
&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; apps/livekit &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;apps/livekit
curl &lt;span class="nt"&gt;-LO&lt;/span&gt; https://github.com/livekit/livekit/releases/latest/download/livekit-linux-amd64
&lt;span class="nb"&gt;chmod&lt;/span&gt; +x livekit-linux-amd64
&lt;span class="nb"&gt;sudo mv &lt;/span&gt;livekit-linux-amd64 /usr/local/bin/livekit-server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Create Config File (&lt;code&gt;livekit.yaml&lt;/code&gt;)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nano livekit.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Paste minimal config:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;7880&lt;/span&gt;
&lt;span class="na"&gt;rtc&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;udp_port&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;7881&lt;/span&gt;
  &lt;span class="na"&gt;tcp_port&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;7882&lt;/span&gt;
&lt;span class="na"&gt;keys&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;devkey&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;secret&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Replace keys with your preferred API key pair or manage with env vars.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  4. ⚙️ Set Up &lt;code&gt;systemd&lt;/code&gt; Service
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;nano /etc/systemd/system/livekit.service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Paste the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="nn"&gt;[Unit]&lt;/span&gt;
&lt;span class="py"&gt;Description&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;LiveKit Server&lt;/span&gt;
&lt;span class="py"&gt;After&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;network.target&lt;/span&gt;

&lt;span class="nn"&gt;[Service]&lt;/span&gt;
&lt;span class="py"&gt;ExecStart&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;/usr/local/bin/livekit-server --config /home/YOUR_USER/apps/livekit/livekit.yaml&lt;/span&gt;
&lt;span class="py"&gt;Restart&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;always&lt;/span&gt;
&lt;span class="py"&gt;User&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;YOUR_USER&lt;/span&gt;
&lt;span class="py"&gt;WorkingDirectory&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;/home/YOUR_USER/apps/livekit&lt;/span&gt;

&lt;span class="nn"&gt;[Install]&lt;/span&gt;
&lt;span class="py"&gt;WantedBy&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;multi-user.target&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Replace &lt;code&gt;YOUR_USER&lt;/code&gt; with your GCP username (e.g., &lt;code&gt;priya_scse2022&lt;/code&gt;)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Reload and Enable
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl daemon-reexec
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl daemon-reload
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl &lt;span class="nb"&gt;enable &lt;/span&gt;livekit.service
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl start livekit.service
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl status livekit.service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  5. 🌐 Configure NGINX (Optional: Reverse Proxy)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;nano /etc/nginx/sites-available/livekit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Paste:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="k"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;listen&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;server_name&lt;/span&gt; &lt;span class="s"&gt;livekit.yourdomain.com&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="kn"&gt;location&lt;/span&gt; &lt;span class="n"&gt;/&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kn"&gt;proxy_pass&lt;/span&gt; &lt;span class="s"&gt;http://localhost:7880&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kn"&gt;proxy_http_version&lt;/span&gt; &lt;span class="mf"&gt;1.1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kn"&gt;proxy_set_header&lt;/span&gt; &lt;span class="s"&gt;Upgrade&lt;/span&gt; &lt;span class="nv"&gt;$http_upgrade&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kn"&gt;proxy_set_header&lt;/span&gt; &lt;span class="s"&gt;Connection&lt;/span&gt; &lt;span class="s"&gt;"upgrade"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kn"&gt;proxy_set_header&lt;/span&gt; &lt;span class="s"&gt;Host&lt;/span&gt; &lt;span class="nv"&gt;$host&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enable it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo ln&lt;/span&gt; &lt;span class="nt"&gt;-s&lt;/span&gt; /etc/nginx/sites-available/livekit /etc/nginx/sites-enabled/
&lt;span class="nb"&gt;sudo &lt;/span&gt;nginx &lt;span class="nt"&gt;-t&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl reload nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Optional: Add SSL with &lt;a href="https://certbot.eff.org/" rel="noopener noreferrer"&gt;Let's Encrypt&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  6. ✅ Verify Everything
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Visit &lt;code&gt;http://&amp;lt;your-external-ip&amp;gt;:7880&lt;/code&gt; or &lt;code&gt;http://livekit.yourdomain.com&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Check logs: &lt;code&gt;journalctl -u livekit.service -f&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;On VM reboot, LiveKit will auto-start via &lt;code&gt;systemd&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  ✅ Done!
&lt;/h2&gt;

&lt;p&gt;You now have a &lt;strong&gt;persistent, production-ready LiveKit server&lt;/strong&gt; running on GCP with automatic restarts using &lt;code&gt;systemd&lt;/code&gt; and optional reverse proxy using NGINX.&lt;/p&gt;




&lt;h2&gt;
  
  
  🛡 Pro Tips
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Add a firewall rule to open ports &lt;code&gt;7880-7882&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;ufw&lt;/code&gt; or GCP firewall for tighter security&lt;/li&gt;
&lt;li&gt;For production, consider load balancing and TLS termination&lt;/li&gt;
&lt;li&gt;To update LiveKit:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl stop livekit.service
curl &lt;span class="nt"&gt;-LO&lt;/span&gt; https://github.com/livekit/livekit/releases/latest/download/livekit-linux-amd64
&lt;span class="nb"&gt;chmod&lt;/span&gt; +x livekit-linux-amd64
&lt;span class="nb"&gt;sudo mv &lt;/span&gt;livekit-linux-amd64 /usr/local/bin/livekit-server
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl start livekit.service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Happy hacking with LiveKit! 🎙️&lt;/p&gt;

</description>
      <category>livekit</category>
      <category>gcp</category>
      <category>webdev</category>
      <category>nextjs</category>
    </item>
  </channel>
</rss>
