We show two methods for installing Visual Studio Code (VS Code) on Debian 12 Bookworm using the command terminal. You can choose any of them which seems feasible and working.
For developers, VS code which is free to use is quite useful software for editing source code. It is developed by Microsoft and offers a wide range of features along with flexibility to extend the ability of the software using third-party extensions.
Here are some useful features of VSCode:
- Cross-Platform: This means you can use it on Windows Windows, macOS, and Linux.
- Free and Open Source
- A lightweight code editor that starts quickly and doesn’t consume excessive system resources.
- You can extend its functionality with a wide variety of extensions available through the Visual Studio Code Marketplace.
- VS Code includes built-in Git support
- Intelligent Code Editing using features like IntelliSense to autocomplete the code.
- VS Code has a built-in terminal that allows you to run commands and scripts.
- It offers debugging capabilities with support for various programming languages.
- Task Automation
- Customizable Layout
- Although it is primarily used as a Code editor, can be extended to use as an Integrated Development Environment (IDE)
- Supports a wide range of programming languages out of the box.
- Large and active community.
You should have the following required things with you for performing this tutorial…
- A Debian-based Linux system. It can be version 10, 11, or 12.
- For running commands to install packages you must have a user account with Administrative (sudo) privileges.
There are two ways to install it. Here we show you the first one using the repository…
Step 1: Update Debian Package Repository
Open the Command terminal and start with the update command on your system. This will download and install the latest available updates.
sudo apt update
Step 2: Install Required Dependencies
Now, install some common packages that might be already on your system but need to add the third-party repositories.
sudo apt install wget gpg software-properties-common apt-transport-https
Step 3: Import Microsoft GPG Key
To ensure the authenticity of the Visual Code Studio Linux package, we need to import Microsoft’s GPG key into our Debian system before adding its repository. Use the following command to do so:
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
Step 4: Add VS Code Repository
Once we have the GPG key our next task is to add the VS code repository and assign the GPG key we have downloaded in the previous step. Run the following commands:
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
rm -f packages.microsoft.gpg
Run the system update command to rebuild the APT package list cache.
sudo apt update
Step 5: Install Visual Studio Code
So, far we have added all the necessary things required to install the latest version of VS Code on Debian 12 using the official repository of this code editor provided by Microsoft. It’s time to use the APT package manager and install VScode like any other Linux software.
sudo apt install code
In this method, we will show you how to download and install VSCode directly using its Debian binary from the official website of this code editor.
Download Deb VScode binary
Go to the official website of Vs Code editor and download the executable file present there to run on Debian systems. You can use this link to directly visit the website’s download page.
Switch to Downloads
First, open the Command Terminal. If you have used the browser to download the Visual Studio code Debian file, then switch to “Downloads“. It is because the file we get from the browser goes automatically into that.
Install Visual Code Studio on Debian 12
Now, we can either use the APT package manager or DPKG tool to install the downloaded .deb file of VS Code. To do that, simply run the below-given command.
sudo apt install ./file-name.deb
Replace file-name. deb with the actual name of the file you have downloaded.
Here is the command example to follow:
sudo apt install ./code_*_amd64.deb
Launch Visual Studio Code
Once the installation is completed, you can launch VS Code from the application menu or by running the following command in the terminal:
Install Extensions (Optional)
We can expand the features of VS Code using the various extensions which is also one of the greater features of this code editor, thanks to its vast extension library. You can add extensions for various programming languages and tools to enhance your development environment.
Just open VS Code, and click on the Extension icon given in the Activity Bar on the side of the window, or use the shortcut Ctrl+Shift+X to go to the Extensions view.
Search for and install extensions that match your needs.
Uninstall or Remove (optional)
Well, there are chances that you didn’t like Visual Code Studio or just don’t need it anymore. In such a situation, if you want to uninstall it from Debian 12 then here are the commands to follow:
sudo apt remove code
Repository users, if want to delete the added Microsoft repo and GPG for Vscode, they can use:
sudo rm /etc/apt/sources.list.d/vscode.*
sudo rm /etc/apt/trusted.gpg.d/ms_vscode_key.gpg