This guide shows how to install Visual Studio Code on Ubuntu using the official Microsoft repository.
- Ubuntu system with sudo privileges
- Internet connection
-
Add Microsoft's GPG key:
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
-
Install the GPG key:
sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/
-
Add the VS Code repository:
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list' -
Update package list and install VS Code:
sudo apt update sudo apt install code
After installation, you can launch Visual Studio Code by:
- Running
codecommand in the terminal - Finding Visual Studio Code in your applications menu
VS Code installed this way will receive automatic updates through Ubuntu's package manager when you run sudo apt update && sudo apt upgrade.
- Snap package: sudo snap install code --classic
- Download .deb package from the official VS Code website
If you encounter permission issues, make sure your user has sudo privileges and try running the commands again.