Friday, November 15, 2024
Google search engine
HomeGuest BlogsHow to Install vscode on Ubuntu

How to Install vscode on Ubuntu

Introduction

Microsoft’s Visual Studio Code (vscode) is a source-code editor developed for Windows, Linux, and macOS. The code editor supports debugging, syntax highlighting, automatic code completion, snippets, embedded Git control, etc.

vscode is open source. It supports an abundance of extensions acts as a version control system, thus facilitating project collaboration.

In this tutorial, you will learn to install, uninstall, and start vscode on Ubuntu.

How to install vscode on Ubuntu.How to install vscode on Ubuntu.

Prerequisites

  • A system running Ubuntu.
  • An account with administrator privileges.
  • A working network connection.

How to Install vscode on Ubuntu?

There are three ways to install vscode on Ubuntu:

  • Installing the snap package.
  • Using the apt package manager.
  • Via the Ubuntu Software GUI app.

Choose an installation method and follow the steps below to install vscode.

Method 1: Install Visual Studio Code with Snap

Snap packages are containerized applications. Open the terminal and run the following command to install the vscode self-contained snap package with the required dependencies:

sudo snap install --classic code
Installing vscode on ubuntu via the snap package.Installing vscode on ubuntu via the snap package.

Verify the installation by checking the program version:

code --version
Checking the vscode program version on Ubuntu.Checking the vscode program version on Ubuntu.

Method 2: Install Visual Studio Code with apt

Another way to install vscode is via the apt package manager. Follow the steps below to install vscode using apt:

Note: Read our Snap vs. apt article to see how the Snap packaging system compares to the apt package manager.

Step 1: Update the system repository

Run the following command to update the system’s repository and ensure you get the latest vscode version:

sudo apt update

Step 2: Install Package Dependencies

For proper operation, vscode requires you to install package dependencies. Run the following command to resolve package dependencies:

sudo apt install software-properties-common apt-transport-https wget -y
Installing package dependencies for vscode on Ubuntu.Installing package dependencies for vscode on Ubuntu.

The command automatically installs any vscode dependencies.

Step 3: Add GPG Key

Import the GPG key provided by Microsoft to verify the package integrity. Enter:

wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -
Adding a GPG key from Microsoft to verify the vscode package integrity.Adding a GPG key from Microsoft to verify the vscode package integrity.

Step 4: Add Repository

Run the following command to add the Visual Studio Code repository to your system:

sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
Adding the vscode repository to ubuntu before installation.Adding the vscode repository to ubuntu before installation.

Note: See how to troubleshoot the Add-apt-repository command not found error.

Step 5: Install vscode

After enabling the repository, install vscode by running:

sudo apt install code
Installing vscode using the apt package manager.Installing vscode using the apt package manager.

Step 6: Verify Installation

Verify vscode installation by running:

code --version

If the installation was successful, the output shows the program version.

Method 3: Install Using the GUI

Follow the steps below to install vscode using Ubuntu Software Center:

1. Open Ubuntu Software Center

Click the Show Applications button and open the Ubuntu Software Center app.

Opening the Ubuntu Software app.Opening the Ubuntu Software app.

Note: The Show Applications button opens the app drawer and shows installed app icons. See how to list installed apps using the terminal.

2. Find Visual Studio Code

Click the Search button, and type vscode in the search bar. Click code on the list to open the app page.

Searching for vscode in the Ubuntu Software application.Searching for vscode in the Ubuntu Software application.

3. Install vscode

Click the Install button and, when prompted, type in your administrator password to start the installation.

Installing vscode on Ubuntu using the GUI Ubuntu Software Center app.Installing vscode on Ubuntu using the GUI Ubuntu Software Center app.

How to Start vscode on Ubuntu?

Click the Show Applications button and locate Visual Studio Code in the app list.

Opening Visual Studio Code on Ubuntu.Opening Visual Studio Code on Ubuntu.

Click the app to open it and start customizing the appearance, adding extensions for the programming languages you need, etc.

Getting started with vscode on Ubuntu.Getting started with vscode on Ubuntu.

Uninstall vscode

Depending on the installation method, use on of three ways to uninstall vscode:

1. For vscode installations using snap (method 1):

Remove the vscode snap app by running the following command:

sudo snap remove code
Uninstalling the vscode snap package from Ubuntu.Uninstalling the vscode snap package from Ubuntu.

The command removes vscode and notifies you of the result.

2. For vscode installations using apt package manager (method 2):

if you installed vscode via apt, uninstall the program by running:

sudo apt remove code
Uninstalling the vscode app using the apt package manager.Uninstalling the vscode app using the apt package manager.

3. For vscode installations using the GUI (method 3):

If you installed vscode via the Ubuntu Software Center, follow the steps below uninstall the app:

1. Open the Ubuntu Software Center and click the Installed tab to see all installed apps.

2. Locate the code app on the list and click the Remove button.

Listing installed apps using the Ubuntu Software Center app.Listing installed apps using the Ubuntu Software Center app.

4. When prompted, click Remove one more time to uninstall vscode from the system. Provide the admin password to confirm you want to uninstall the app.

Uninstalling vscode from the Ubuntu Software Center.Uninstalling vscode from the Ubuntu Software Center.

The app has been successfully removed from your system.

Conclusion

This guide showed you how to install and uninstall vscode on Ubuntu using three methods. Choose your preferred installation method and start creating and editing code easily with vscode.

Next, read up on the best Python IDEs and code editors, or see our list of 22 best Linux text editors for programming and coding.

Was this article helpful?
YesNo

RELATED ARTICLES

Most Popular

Recent Comments