Easy Guide to Install Visual Studio Code on Ubuntu

How to install Visual Studio Code on Ubuntu

Visual Studio Code is a free and open-source code editor developed by the company that created Windows, and it’s very lightweight, highly customizable, and supports an immense number of programming languages. Installing VS Code on Ubuntu for users is very easy, and it could take just a few easy steps. So get ready to learn how to install Visual Studio Code on Ubuntu so you’re ready to start coding in moments.

Prerequisites

Before you begin to install, you need to ensure you have the following.

A Ubuntu running OS on 18.04 or above.

Sudo privilege for the system.

A stable internet connection is available

Step 1: Update the System

Other software installations on Ubuntu start off with the update of an operating system. Open the terminal with Ctrl + Alt + T and run the command below 

bash
sudo apt update && sudo apt upgrade

This command updates package lists and upgrades installed packages to their latest version.

Why Update the System?

Updating guarantees you have the latest versions of essential libraries, which ensure no installation errors, or compatibility issues.

Step 2: Install Required Dependencies

Visual Studio Code requires a few dependencies to run beautifully. Install those by running the following command from your terminal:

bash
sudo apt install software-properties-common apt-transport-https wget

These tools manage your software repositories and download packages securely.

Step 3: Install Microsoft GPG Key

Add the Microsoft GPG key. The key is what your system needs in order to be able to trust the VS Code repository. Use this command below to import the key:

bash
wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -

What is a GPG Key?

A GPG key ensures legitimate authenticity and software integrity. This is a good security practice.

Step 4: Add the VS Code Repository

After installation of the key, you need to add the Visual Studio Code repository to your system’s source list. Run the following command:

bash
sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"

This command tells Ubuntu where to find the Visual Studio Code package.

Step 5: Install Visual Studio Code on Ubuntu

Now that you have added the repository, it’s time to install VS Code on Ubuntu. You do this by refreshing the package lists once more with the new repository added:

bash
sudo apt update
sudo apt install code

How long will it take to install?

A few minutes, depending on your typing and system speeds.

Step 6: Launch Visual Studio Code

After the installation, there are two ways to start Visual Studio Code:

Either from the terminal by

bash
code

Or by searching for “Visual Studio Code” in the applications menu.

First Time Setup

When you launch VS Code for the first time, it might ask you to install some recommended extensions depending on the languages and frameworks you had installed. You may also personalize your editor to themes and plugins of your choice.

Step 7: Keep VS Code Updated

You should regularly receive updates on new features and bug fixes with Visual Studio Code. To ensure that you are running at all times a version that is updated, the following command can be run from time to time:

bash
sudo apt update && sudo apt upgrade code

How to Uninstall Visual Studio Code on Ubuntu?

In case you have changed your mind on using VS Code for any reason, you can similarly uninstall it by running the following command:

bash
sudo apt remove code

Remove Unused Dependencies

These commands will remove unnecessary dependencies in your system using the following command:

bash
sudo apt autoremove

You May Like: How to Install Ubuntu on Windows 10 / Windows 11: A Beginners Guide

Conclusion

Install it on Ubuntu, making the process of installing the world’s most popular code editor in a few strides. Update the system, install dependencies, and add the official Microsoft repository to install the most popular or simply one of the best code editors.

This code is perfectly described as a combination of flexibility as well as a rich feature set for both beginners and experienced developers. 

Frequently Asked Questions (FAQs)

1. Can I install Visual Studio Code on versions of Ubuntu lower than 18.04?

Yes, you can install VS Code on older versions of Ubuntu (like 16.04), but it’s recommended to upgrade to a more recent version for the best compatibility and support. Ubuntu 18.04 or higher ensures better performance and access to newer features in Visual Studio Code.

2. Must I reinstall Visual Studio Code to install updates?

No, you don’t have to reinstall the whole software to get updates. The command sudo apt update && sudo apt upgrade code will update your existing installation to the latest version.

3. How to install Visual Studio Code extensions on Ubuntu?

Once installed and running, installing extensions in Visual Studio Code are a breeze. There’s an icon on the sidebar for Extensions – or you can hit Ctrl + Shift + X to open it quickly. Type in the name of the extension you’re looking for, click Install, and you’ll be away with language support, themes, and many other enrichments to coding itself.

Leave a Comment

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

Scroll to Top