Ubuntu

How to Install Visual Studio Code on Ubuntu: A Comprehensive Guide

Visual Studio Code (VS Code) is one of the most popular code editors in the developer community, thanks to its lightweight nature, powerful features, and wide range of extensions. Whether you’re a beginner or a seasoned developer, VS Code offers the perfect balance between simplicity and functionality.

If you’re an Ubuntu user looking to install Visual Studio Code Ubuntu, you’ve come to the right place. This guide walks you through the process of installing VS Code on Ubuntu, from downloading to setting up the editor with useful extensions.

Why Visual Studio Code?

Before diving into the installation, let’s briefly cover why Visual Studio Code is worth installing:

  • Free and Open-Source: VS Code is open-source and completely free to use.
  • Cross-platform: Available on Linux, macOS, and Windows, making it an excellent choice for developers working across different environments.
  • Integrated Git Support: VS Code comes with built-in Git support, which makes version control and source code management easy.
  • Rich Extension Marketplace: You can install extensions to support different programming languages, debuggers, linters, themes, and much more.
  • Customizability: Tailor VS Code to your preferences using settings, themes, and extensions.

Now, let’s get started on installing it!

Prerequisites

Before proceeding, ensure that your system is up to date. Open the terminal and run the following command to update your package lists:

Screenshot_1.jpg

Screenshot_2.jpg

Make sure you have curl installed (if you don’t already have it):

Now, let’s walk through the installation steps.

One of the easiest and most efficient ways to install VS Code on Ubuntu is through the official Microsoft repository, using the APT package manager. This ensures that you will always have the latest stable version of VS Code.

Step 1: Add the Microsoft GPG key

Visual Studio Code’s repository is signed with a GPG key to ensure the integrity of the packages. First, you need to download and install the Microsoft GPG key by running:

Screenshot_8.jpg

Step 2: Add the VS Code repository

Next, add the official Microsoft repository to your list of sources. This will allow Ubuntu to fetch VS Code directly from Microsoft’s servers.

Screenshot_4.jpg

Step 3: Update APT and install VS Code

Screenshot_5.jpg

Now that the repository is added, update your package lists to include the new repository:

Screenshot_6.jpg

Finally, install visual studio code on ubuntu using the following command:

This will download and install Visual Studio Code. Once the installation is complete, you can launch VS Code by typing code in the terminal or by searching for it in your application menu.

Method 2. Installing Visual Studio Code via Snap (Alternative Method)

If you prefer using Snap packages, you can install VS Code as a Snap application. Snap is a universal package manager that works across different Linux distributions, including Ubuntu.

Step 1: Install VS Code via Snap

To install VS Code via Snap, simply run the following command:

Screenshot_7.jpg

sudo snap install code –classic

The –classic flag ensures that VS Code has the necessary permissions to access files on your system.

Step 2: Launch VS Code

Once the installation completes, you can start Visual Studio Code by searching for it in the application menu or by running:

Method 3. Installing Visual Studio Code via DEB Package (Manual Method)

If you prefer not to use APT or Snap, you can manually download the DEB package from the official Visual Studio Code website and install it. This method gives you more control over the installation process but requires extra steps.

Step 1: Download the DEB Package

Visit the official Visual Studio Code download page and select the .deb package for Debian-based systems like Ubuntu. Alternatively, you can download the .deb package directly using wget:

Step 2: Install the DEB Package

Once the .deb package is downloaded, install it using the following command:

If there are any missing dependencies, run the following command to fix them:

After the installation is complete, you can launch VS Code by searching for it in the application menu or by running.

Method 4: Installing Visual Studio Code from a Tarball (Advanced Method)

For users who prefer a manual installation or want more control over the installation process, you can download a tarball (compressed archive) of Visual Studio Code for Ubuntu and extract it anywhere on your system.

Step 1: Download the Tarball

Visit the official VS Code download page and choose the appropriate tarball package for Linux. Alternatively, download it via wget :

Step 2: Extract the Tarball

Once the download is complete, extract the archive:

Move the extracted folder to a more permanent location, such as /opt :

Create a symbolic link to make launching VS Code easier from the terminal: Now, you can launch VS Code by typing code in the terminal.

Updating Visual Studio Code

If you installed Visual Studio Code via the APT method, the package manager will automatically update VS Code whenever a new version is released. If you’re using the Snap method, Snap will also automatically handle updates for you.

However, if you installed VS Code manually using the DEB package, you’ll need to download and install a new .deb file each time a new version is released.

To check for updates and ensure you’re running the latest version, simply run:

  1. Setting Up Visual Studio Code on Ubuntu

After installation, you can start configuring VS Code to suit your development environment. Here are some tips to help you get started:

  • Extensions: Head to the Extensions view (Ctrl+Shift+X) and install extensions for the languages you’re working with (e.g., Python, JavaScript, C++, etc.). Extensions can add linters, debuggers, and other features that make coding more efficient.
  • Themes: Customize the appearance of your editor by choosing a theme that suits your style. You can find themes under the Extensions view or go to File > Preferences > Color Theme.
  • Settings: Open the settings (Ctrl+,) and adjust preferences like font size, editor layout, and more. You can also sync your settings across multiple devices using a Microsoft account.

Read Also:-

Conclusion

Installing Visual Studio Code on Ubuntu is straightforward, and you have several methods to choose from, depending on your preference. Whether you opt for the official APT repository, Snap, or the manual DEB installation, all methods will get you up and running quickly with a powerful, customizable code editor.

With VS Code installed, you’re ready to start writing code in any language you like. Don’t forget to explore the wealth of extensions available in the marketplace to enhance your development workflow!

Contact Us

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button