{"id":167457,"date":"2026-05-09T11:19:44","date_gmt":"2026-05-09T08:19:44","guid":{"rendered":"https:\/\/computingforgeeks.com\/?p=167457"},"modified":"2026-05-09T11:20:36","modified_gmt":"2026-05-09T08:20:36","slug":"install-vscode-ubuntu-2604","status":"publish","type":"post","link":"https:\/\/computingforgeeks.com\/install-vscode-ubuntu-2604\/","title":{"rendered":"Install Visual Studio Code on Ubuntu 26.04 LTS"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Visual Studio Code on Ubuntu 26.04 LTS is one of those installs that looks trivial until you have to pick between three competing flavours: Microsoft&#8217;s official deb, Canonical&#8217;s snap, and the third-party packaging that ships with some derivatives. Each has trade-offs and the wrong pick will bite you on update day. This guide walks the recommended path (Microsoft apt repo with key verification), then covers the Wayland tweak that 26.04 needs, the snap fallback, and the Remote-SSH workflow that turns the editor on your laptop into a window into a 26.04 server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Tested on a fresh Ubuntu 26.04 server with VS Code 1.119.0 and the matching Microsoft signing key dated 2025. Everything below is verified copy-paste output, not the placeholder shell that most Ubuntu install pages still ship.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Tested May 2026 on Ubuntu 26.04 (Resolute Raccoon), VS Code 1.119.0 (commit 8b640eef), Microsoft apt repo, GNOME 50 Wayland session<\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Pick the right packaging path<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Three install routes work on 26.04. The differences matter:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Route<\/th><th>Pros<\/th><th>Cons<\/th><\/tr><\/thead><tbody><tr><td><strong>Microsoft apt repo<\/strong><\/td><td>Auto-updates with apt, signed by Microsoft, integrates with the rest of the system, fastest start<\/td><td>Adds a third-party repo to \/etc\/apt\/sources.list.d<\/td><\/tr><tr><td>Snap from the Canonical store<\/td><td>Sandboxed, no extra repo needed, GUI store integration<\/td><td>Slower cold start, occasional Wayland clipboard quirks, snap auto-refresh on Canonical&#8217;s schedule<\/td><\/tr><tr><td>Direct .deb download<\/td><td>Pinning a specific build, no extra repo<\/td><td>Manual updates forever, no key verification unless you do it yourself<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The Microsoft apt repo is the right answer for 95% of installs. The rest of the guide takes that route and adds the snap path as an alternative for sandbox-only environments.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Set reusable shell variables<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Three values repeat through the install. Pull them into shell variables once so the rest of the guide pastes as-is:<\/p>\n\n\n\n<pre class=\"wp-block-code code\"><code>export MS_KEYRING=\"\/etc\/apt\/keyrings\/microsoft.gpg\"\nexport MS_SOURCE=\"\/etc\/apt\/sources.list.d\/vscode.list\"\nexport VSCODE_USER=\"${USER}\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Confirm the values stuck before going further:<\/p>\n\n\n\n<pre class=\"wp-block-code code\"><code>echo \"keyring: ${MS_KEYRING}\"\necho \"source:  ${MS_SOURCE}\"<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Install the Microsoft signing key<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Two prerequisites pull in the tools you need to fetch and verify the key:<\/p>\n\n\n\n<pre class=\"wp-block-code code\"><code>sudo apt update\nsudo apt install -y wget gpg apt-transport-https<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Download the key, dearmor it (apt&#8217;s binary keyring format), and pin world-readable permissions so apt can read it during package operations:<\/p>\n\n\n\n<pre class=\"wp-block-code code\"><code>sudo install -d -m 0755 \/etc\/apt\/keyrings\nwget -qO- https:\/\/packages.microsoft.com\/keys\/microsoft.asc \\\n  | sudo gpg --dearmor -o \"${MS_KEYRING}\"\nsudo chmod 644 \"${MS_KEYRING}\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Verify the key landed and matches the published fingerprint:<\/p>\n\n\n\n<pre class=\"wp-block-code code\"><code>sudo gpg --no-default-keyring --keyring \"${MS_KEYRING}\" --list-keys<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The fingerprint should start with <code>BC52 8686 B50D 79E3 39D3<\/code>. Anything else means the download was corrupted or man-in-the-middled; abort and re-fetch from a known-good network.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Add the apt source and install<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Drop the source line. The <code>arch=<\/code> list covers amd64, arm64, and armhf so the same line works on every 26.04 box you ship:<\/p>\n\n\n\n<pre class=\"wp-block-code code\"><code>echo \"deb [arch=amd64,arm64,armhf signed-by=${MS_KEYRING}] \\\nhttps:\/\/packages.microsoft.com\/repos\/code stable main\" \\\n  | sudo tee \"${MS_SOURCE}\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Refresh apt and install the <code>code<\/code> package:<\/p>\n\n\n\n<pre class=\"wp-block-code code\"><code>sudo apt update\nsudo apt install -y code\nwhich code &amp;&amp; code --version<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The captured terminal below shows the key add, the apt source line, and the version stamp on a fresh 26.04 install:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"920\" height=\"720\" src=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2026\/05\/wm-install-vscode-ubuntu-2604-cli.png\" alt=\"Install Visual Studio Code on Ubuntu 26.04 LTS via Microsoft apt repo\" class=\"wp-image-167451\" title=\"\" srcset=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2026\/05\/wm-install-vscode-ubuntu-2604-cli.png 920w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2026\/05\/wm-install-vscode-ubuntu-2604-cli-300x235.png 300w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2026\/05\/wm-install-vscode-ubuntu-2604-cli-768x601.png 768w\" sizes=\"auto, (max-width: 920px) 100vw, 920px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>code --version<\/code> output prints the release number, the build commit hash, and the architecture. Future <code>apt upgrade<\/code> runs pick up new VS Code releases automatically because the source line is now in your apt config.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Wayland on GNOME 50 (the 26.04 tweak)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Ubuntu 26.04 ships GNOME 50 as Wayland-only by default. Electron apps including VS Code default to running through XWayland, which works but produces fuzzy text on HiDPI displays and a slightly laggy window drag. Tell VS Code to use the native Wayland backend instead:<\/p>\n\n\n\n<pre class=\"wp-block-code code\"><code>mkdir -p ~\/.config\ncat &gt; ~\/.config\/code-flags.conf &lt;&lt;'EOF'\n--ozone-platform-hint=auto\n--enable-features=UseOzonePlatform,WaylandWindowDecorations\nEOF<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Restart VS Code and check the running platform from the command palette: open it with <code>Ctrl+Shift+P<\/code>, run &#8220;Developer: Open Process Explorer&#8221;, and the main process should now report <code>--ozone-platform-hint=auto<\/code>. The text will be sharp and the window drag is one frame faster.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The same flag file works for the Insiders build (<code>code-insiders-flags.conf<\/code>) and for the OSS builds packaged as <code>code-oss<\/code>. If you stay on X11 (the legacy <code>Xorg<\/code> session) the flag is harmless; Electron falls back to X11 when Wayland is not available.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5: First-run extensions you actually want<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">VS Code is useful out of the box. It is dramatically more useful with three extensions installed at first launch. Install from the command line so you can stamp the same set across a fleet:<\/p>\n\n\n\n<pre class=\"wp-block-code code\"><code>code --install-extension ms-python.python\ncode --install-extension ms-vscode-remote.remote-ssh\ncode --install-extension eamodio.gitlens\ncode --list-extensions<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The Python extension brings interpreter discovery, debugging, and notebook support. Remote-SSH is what turns this VS Code into a thin client for any Linux server you have key-based SSH access to. GitLens layers blame and history on every file in the editor.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For Go, Rust, Java, or .NET work, add the matching marketplace IDs (<code>golang.go<\/code>, <code>rust-lang.rust-analyzer<\/code>, <code>vscjava.vscode-java-pack<\/code>, <code>ms-dotnettools.csdevkit<\/code>) to the same install loop.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Alternative: install via snap<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If your environment forbids third-party apt repos, the snap is the fallback. It is officially published by Microsoft, classic-confined (so it can read your $HOME), and updates on Canonical&#8217;s track schedule:<\/p>\n\n\n\n<pre class=\"wp-block-code code\"><code>sudo snap install --classic code\nwhich code &amp;&amp; code --version\nsnap info code | head -10<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Two side-effects to know: the snap reads the same flag file at <code>~\/.config\/code-flags.conf<\/code> for the Wayland tweak, and the binary lives at <code>\/snap\/bin\/code<\/code> instead of <code>\/usr\/bin\/code<\/code>. Mixing the apt and snap installs on the same box does not break anything but is confusing; pick one and stick with it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Remote-SSH: edit a 26.04 server from your laptop<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The Remote-SSH extension is the killer feature on a server-heavy stack. The setup is two minutes once you have key-based SSH working to the target machine:<\/p>\n\n\n\n<pre class=\"wp-block-code code\"><code>cat &gt;&gt; ~\/.ssh\/config &lt;&lt;'EOF'\nHost devbox\n    HostName 10.0.1.50\n    User ubuntu\n    IdentityFile ~\/.ssh\/id_ed25519\n    ServerAliveInterval 30\nEOF\nchmod 600 ~\/.ssh\/config<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">From VS Code, open the command palette (<code>Ctrl+Shift+P<\/code>), pick &#8220;Remote-SSH: Connect to Host&#8221;, and select <code>devbox<\/code>. The first connection installs a tiny VS Code Server on the remote, which is what runs language extensions and the integrated terminal against the target&#8217;s filesystem. From then on, every file you open is on the server, every terminal you spawn runs on the server, and only the editor UI lives on your laptop.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The Remote-SSH server lives at <code>~\/.vscode-server\/<\/code> on the target. Clean it up if it ever gets stale:<\/p>\n\n\n\n<pre class=\"wp-block-code code\"><code>rm -rf ~\/.vscode-server\n# Reconnect from the laptop; VS Code reinstalls automatically<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Common errors and what they mean<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Error: <code>The repository is not signed<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The signing key path in the source line does not match where you actually wrote the keyring. Double-check that <code>${MS_KEYRING}<\/code> in the source line and on disk are the same path, and that the file is mode 0644 (not 0600).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Error: <code>Failed to load module ... canberra-gtk-module<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">VS Code is looking for an audio module that is not installed on a server image. Cosmetic only, no functional impact, but if it bothers you: <code>sudo apt install -y libcanberra-gtk-module libcanberra-gtk3-module<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Error: <code>code: error while loading shared libraries: libxkbfile.so.1<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Server-image install where X11 client libraries are missing. Pull them in: <code>sudo apt install -y libxkbfile1 libsecret-1-0 libgtk-3-0 libnotify4 libnss3 libxss1 libasound2t64<\/code>. The <code>code<\/code> deb does not declare these as hard dependencies because most desktop installs already have them.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Error: <code>You are trying to start Visual Studio Code as a super user<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">VS Code refuses to launch under sudo by design. If you really need root, use <code>sudo --preserve-env code --user-data-dir=\/root\/.vscode --no-sandbox<\/code>. The right answer 99% of the time is to open the file as your normal user and use <code>sudo<\/code> from the integrated terminal when needed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Uninstall and rollback<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Apt route:<\/p>\n\n\n\n<pre class=\"wp-block-code code\"><code>sudo apt remove --purge -y code\nsudo rm -f \"${MS_SOURCE}\" \"${MS_KEYRING}\"\nrm -rf ~\/.vscode ~\/.config\/Code<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Snap route:<\/p>\n\n\n\n<pre class=\"wp-block-code code\"><code>sudo snap remove code\nrm -rf ~\/snap\/code<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Both leave the workspaces and project directories untouched; only the editor state under <code>~\/.config\/Code<\/code> and <code>~\/.vscode<\/code> goes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For the rest of the dev workstation setup, the <a href=\"https:\/\/computingforgeeks.com\/install-nodejs-ubuntu-2604\/\">Node.js install<\/a> covers npm\/pnpm\/Yarn, the <a href=\"https:\/\/computingforgeeks.com\/install-python-ubuntu-2604\/\">Python 3.14 reference<\/a> handles venvs and pyenv, the <a href=\"https:\/\/computingforgeeks.com\/install-go-ubuntu-2604\/\">Go toolchain install<\/a> wires the workspace layout, and the <a href=\"https:\/\/computingforgeeks.com\/install-docker-ce-ubuntu-2604\/\">Docker CE install<\/a> gives you the dev-container backend the Remote-Containers extension expects.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That is the full path: Microsoft signing key verified, apt repo wired, VS Code installed and version-checked, Wayland flag in place for crisp text on GNOME 50, three first-run extensions stamped, snap fallback documented, and Remote-SSH explained for the multi-server workflow that makes VS Code worth keeping in the toolbox.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Install Visual Studio Code on Ubuntu 26.04 LTS via the Microsoft apt repo, with snap fallback, GNOME 50 Wayland tweak, and Remote-SSH workflow.<\/p>\n","protected":false},"author":21,"featured_media":167454,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[50,81],"tags":[282,2254],"cfg_series":[39800],"class_list":["post-167457","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux-tutorials","category-ubuntu","tag-linux","tag-ubuntu","cfg_series-ubuntu-2604-devops-tools"],"_links":{"self":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/167457","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/comments?post=167457"}],"version-history":[{"count":2,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/167457\/revisions"}],"predecessor-version":[{"id":167464,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/167457\/revisions\/167464"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media\/167454"}],"wp:attachment":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media?parent=167457"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/categories?post=167457"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/tags?post=167457"},{"taxonomy":"cfg_series","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/cfg_series?post=167457"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}