{"id":9161,"date":"2026-07-10T12:22:31","date_gmt":"2026-07-10T06:52:31","guid":{"rendered":"https:\/\/www.veeble.com\/kb\/?p=9161"},"modified":"2026-07-10T12:22:31","modified_gmt":"2026-07-10T06:52:31","slug":"how-to-install-wireguard-on-ubuntu-server-in-10-minutes","status":"publish","type":"post","link":"https:\/\/www.veeble.com\/kb\/how-to-install-wireguard-on-ubuntu-server-in-10-minutes\/","title":{"rendered":"How to Install WireGuard on Ubuntu Server in 10 Minutes"},"content":{"rendered":"\n<p>This guide covers how to install WireGuard on Ubuntu server in the fastest way possible, using an automated script instead of manual configuration. WireGuard is a modern VPN protocol built into the Linux kernel. It is lightweight, fast, and much easier to configure than traditional VPN solutions like OpenVPN.<\/p>\n\n\n\n<p>This guide walks through the fastest way to get WireGuard running on an Ubuntu VPS using an automated script instead of building the config by hand.<\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"before-you-start\">Before You Start<\/h2>\n\n\n<p>You&#8217;ll need:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ubuntu 20.04 or later, with root access<\/li>\n\n\n\n<li>SSH access to the server<\/li>\n\n\n\n<li>A public IPv4 address on the VPS (<a href=\"https:\/\/www.veeble.com\/vps-hosting\/\" target=\"_blank\" rel=\"noreferrer noopener\">Veeble VPS plans<\/a> include this by default)<\/li>\n<\/ul>\n\n\n<h2 class=\"wp-block-heading\" id=\"step-1-update-the-server\">Step 1: Update the Server<\/h2>\n\n\n<p>Log in over SSH and update everything before installing anything new.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-ast-global-color-0-background-color has-text-color has-background has-link-color wp-elements-5cb59343c10ce4f7566728e56d5c6f7c\"><code>sudo apt update &amp;&amp; sudo apt upgrade -y<\/code><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"step-2-install-wireguard-with-an-automated-script\">Step 2: Install WireGuard With an Automated Script<\/h2>\n\n\n<p>You can install WireGuard manually, but getting the <code>iptables<\/code> NAT rules right so traffic actually reaches the internet is where most manual setups go wrong. It&#8217;s faster and more easy to use a well-maintained, open-source install script that handles the network forwarding for you.<\/p>\n\n\n\n<p>The one most people use is maintained by developer angristan on GitHub. Grab it and run it:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-ast-global-color-0-background-color has-text-color has-background has-link-color wp-elements-302e4fccaec9177237256efff3e94cef\"><code>curl -O https:\/\/raw.githubusercontent.com\/angristan\/wireguard-install\/master\/wireguard-install.sh\nchmod +x wireguard-install.sh\nsudo .\/wireguard-install.sh<\/code><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"step-3-answer-the-setup-prompts\">Step 3: Answer the Setup Prompts<\/h2>\n\n\n<p>The script will ask you some questions. The defaults work fine for almost everyone:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Public IPv4 address<\/strong>: auto-detected<\/li>\n\n\n\n<li><strong>Public network interface<\/strong>: auto-detected, usually <code>eth0<\/code> or <code>ens3<\/code><\/li>\n\n\n\n<li><strong>WireGuard port<\/strong>: <code>51820<\/code> is the standard, no reason to change it<\/li>\n\n\n\n<li><strong>DNS resolver<\/strong>: pick one for your clients, <code>1.1.1.1<\/code> (Cloudflare) or <code>8.8.8.8<\/code> (Google) both work well<\/li>\n<\/ul>\n\n\n\n<p>Just hit Enter through each one unless you have a specific reason not to.<\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"step-4-set-up-a-mobile-client\">Step 4: Set Up a Mobile Client<\/h2>\n\n\n<p>As soon as the server setup finishes, it asks you to create your first client.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Give it a name, something like <code>phone<\/code><\/li>\n\n\n\n<li>It generates a QR code right there in the terminal<\/li>\n\n\n\n<li>Install the official WireGuard app from the Play Store or App Store<\/li>\n\n\n\n<li>Open the app, tap <strong>+<\/strong>, pick <strong>Scan from QR code<\/strong>, and point your camera at the screen<\/li>\n<\/ol>\n\n\n\n<p>That&#8217;s it, the device is connected and routing through the server.<\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"step-5-set-up-a-desktop-client\">Step 5: Set Up a Desktop Client<\/h2>\n\n\n<p>Desktop needs a config file instead of a QR scan.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Run the script again to bring up the menu:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code has-white-color has-ast-global-color-0-background-color has-text-color has-background has-link-color wp-elements-efb2e61f6eb9619e3c1da13e721097f9\"><code>sudo .\/wireguard-install.sh<\/code><\/pre>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li>Pick the option to add a new client<\/li>\n\n\n\n<li>Name it something you&#8217;ll recognize later, like <code>desktop<\/code><\/li>\n\n\n\n<li>It drops a file like <code>desktop.conf<\/code> in your current directory<\/li>\n\n\n\n<li>Print it out:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code has-white-color has-ast-global-color-0-background-color has-text-color has-background has-link-color wp-elements-6ec37c3cfd2823434b47fd733a4819f5\"><code>cat desktop.conf<\/code><\/pre>\n\n\n\n<ol start=\"6\" class=\"wp-block-list\">\n<li>Copy that output into a text file on your computer and save it as <code>desktop.conf<\/code><\/li>\n\n\n\n<li>Grab the official WireGuard desktop client for your OS<\/li>\n\n\n\n<li>Open it, choose <strong>Import tunnel(s) from file<\/strong>, select <code>desktop.conf<\/code>, and activate<\/li>\n<\/ol>\n\n\n<h2 class=\"wp-block-heading\" id=\"confirming-it-actually-works\">Confirming It Actually Works<\/h2>\n\n\n<p>Back on the server, check the interface is up:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-ast-global-color-0-background-color has-text-color has-background has-link-color wp-elements-4280f511ea8c4366f47b040abfc8fec7\"><code>sudo wg show<\/code><\/pre>\n\n\n\n<p>If a client has connected, you&#8217;ll see a recent handshake timestamp next to it. No handshake usually means your firewall is blocking UDP on port <code>51820<\/code>, so check that first.<\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"a-few-things-worth-doing-after-setup\">A Few Things Worth Doing After Setup<\/h2>\n\n\n<ul class=\"wp-block-list\">\n<li>Only allow the WireGuard port through your firewall for what actually needs it, <code>ufw<\/code> handles this fine<\/li>\n\n\n\n<li>Clean up client profiles you&#8217;re not using anymore through the script&#8217;s menu<\/li>\n\n\n\n<li>Keep the server patched. WireGuard lives in the kernel, so kernel updates matter here more than usual<\/li>\n\n\n\n<li>Give every device its own client profile instead of sharing one config around<\/li>\n<\/ul>\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h2>\n\n\n<p>WireGuard provides a simple and reliable way to create a secure VPN connection to your Ubuntu server. Using the automated installation script makes the setup much quicker while avoiding common networking mistakes. If you&#8217;re using a <a href=\"https:\/\/www.veeble.com\/vps-hosting\/\">Veeble VPS<\/a>, you already have the root access and networking required to deploy WireGuard. You can explore our VPS hosting plans if you need a server for secure remote access, private networking, or site administration.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This guide covers how to install WireGuard on Ubuntu server in the fastest way possible, using an automated script instead of manual configuration. WireGuard [&hellip;]<\/p>\n","protected":false},"author":15,"featured_media":9163,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[5],"tags":[67,97,100,98,96,99,95],"class_list":["post-9161","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-linux","tag-networking","tag-server-setup","tag-ubuntu","tag-vpn","tag-vps-security","tag-wireguard"],"uagb_featured_image_src":{"full":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2026\/07\/wireguard-ubuntu-featured-image-scaled.jpg",2560,1343,false],"thumbnail":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2026\/07\/wireguard-ubuntu-featured-image-150x150.jpg",150,150,true],"medium":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2026\/07\/wireguard-ubuntu-featured-image-300x157.jpg",300,157,true],"medium_large":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2026\/07\/wireguard-ubuntu-featured-image-768x403.jpg",768,403,true],"large":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2026\/07\/wireguard-ubuntu-featured-image-1024x537.jpg",1024,537,true],"1536x1536":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2026\/07\/wireguard-ubuntu-featured-image-1536x806.jpg",1536,806,true],"2048x2048":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2026\/07\/wireguard-ubuntu-featured-image-2048x1075.jpg",2048,1075,true]},"uagb_author_info":{"display_name":"Nasarul Naseer","author_link":"https:\/\/www.veeble.com\/kb\/author\/nasarulnaseer\/"},"uagb_comment_info":0,"uagb_excerpt":"This guide covers how to install WireGuard on Ubuntu server in the fastest way possible, using an automated script instead of manual configuration. WireGuard [&hellip;]","_links":{"self":[{"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/posts\/9161","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/comments?post=9161"}],"version-history":[{"count":2,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/posts\/9161\/revisions"}],"predecessor-version":[{"id":9164,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/posts\/9161\/revisions\/9164"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/media\/9163"}],"wp:attachment":[{"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/media?parent=9161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/categories?post=9161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/tags?post=9161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}