Linux

How to Install VS Code on Ubuntu 24.04 LTS

How to Install VS Code on Ubuntu 24.04 LTS

Visual Studio Code has become the go-to code editor for developers worldwide, and if you’re running Ubuntu 24.04 LTS, you’re in the right place. After installing VS Code on dozens of Ubuntu systems over the years, I’ve found that while the process is straightforward, knowing your options helps you choose the best method for your workflow.

Why VS Code on Ubuntu?

Visual Studio Code combines the simplicity of a code editor with powerful developer tooling. It offers intelligent code completion, debugging, Git integration, and thousands of extensions. On Ubuntu 24.04 LTS, VS Code runs smoothly and integrates seamlessly with the Linux environment, making it ideal for web development, Python programming, and virtually any coding task.

Prerequisites

Before we begin, ensure you have:

  • Ubuntu 24.04 LTS installed and updated
  • An active internet connection
  • Terminal access with sudo privileges
  • Approximately 200MB of free disk space

Method 1: Installing via Snap (Easiest Method)

Snap is the simplest way to install VS Code on Ubuntu 24.04, as Snap comes pre-installed and handles all dependencies automatically.

Open your terminal using Ctrl+Alt+T and run:

sudo snap install code --classic

The --classic flag is necessary because VS Code requires access to system resources outside the Snap sandbox. The installation typically completes in 2-3 minutes, depending on your internet speed.

Advantages of Snap installation:

  • Automatic updates in the background
  • Sandboxed environment for added security
  • No repository configuration needed
  • Works immediately after installation

Potential limitations:

  • Slightly slower startup time compared to native packages
  • Some extensions may have integration issues with the Snap sandbox

Method 2: Installing via APT (Recommended for Developers)

For developers who prefer traditional package management and want the fastest performance, installing via APT provides a native Debian package.

First, update your package index and install dependencies:

sudo apt update
sudo apt install software-properties-common apt-transport-https wget -y

Import the Microsoft GPG key:

wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg

Add the VS Code repository:

echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" | sudo tee /etc/apt/sources.list.d/vscode.list > /dev/null

Update the package cache and install VS Code:

sudo apt update
sudo apt install code -y

Advantages of APT installation:

  • Faster startup and better performance
  • Traditional Linux package management
  • Better integration with system libraries
  • Preferred by most professional developers

Method 3: Installing via Flatpak

If you prefer Flatpak or use it for other applications, VS Code is available through Flathub.

First, ensure Flatpak is installed:

sudo apt install flatpak -y

Add the Flathub repository if not already added:

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

Install VS Code:

flatpak install flathub com.visualstudio.code -y

To launch VS Code installed via Flatpak:

flatpak run com.visualstudio.code

Method 4: Downloading the .deb Package Directly

For offline installation or single-system setup, you can download the .deb package directly from Microsoft’s website.

Download the latest .deb package:

wget -O code_latest_amd64.deb 'https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64'

Install the package using dpkg:

sudo dpkg -i code_latest_amd64.deb

If you encounter dependency errors, fix them with:

sudo apt install -f -y

Launching VS Code

Once installed, you can launch VS Code in several ways:

From the application menu: Search for “Visual Studio Code” in your applications menu.

From the terminal: Simply type:

code

Open a specific file:

code filename.js

GPU rendering issues: If you experience graphical glitches, disable GPU acceleration:

code --disable-gpu

Conclusion

Installing Visual Studio Code on Ubuntu 24.04 LTS is straightforward regardless of which method you choose. The Snap method offers simplicity and automatic updates, while the APT method provides better performance and traditional package management. Flatpak serves as a middle ground, and the direct .deb download works well for offline scenarios.

Choose the method that best fits your workflow, and you’ll have one of the most powerful code editors running on your Ubuntu system in minutes.

Leave a Response

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
Best Wordpress Adblock Detecting Plugin | CHP Adblock