How to Install VS Code on Linux: Ubuntu, Debian, Fedora, and Arch

Install VS Code on Linux using the official package for your distribution. Covers Debian, Ubuntu, Fedora, RHEL, Arch, and Snap with verification steps for each.

6 min read

VS Code is available on Linux through official repositories, a Snap package, and community-maintained packages for Arch. This guide walks through the install steps for each major distribution. Choose the method that matches yours, verify the install, and you will have the editor ready in a few minutes.

Pick your install method

DistributionRecommended method
Ubuntu, Debian, Linux Mint, Pop!_OSOfficial .deb repository
Fedora, RHEL, CentOS, Rocky LinuxOfficial .rpm repository
Arch Linux, Manjaro, EndeavourOSAUR package
Any Linux distributionSnap package

All methods make the shell command available and receive updates through your package manager.

Debian and Ubuntu-based distributions

Add the Microsoft repository, then install with apt. First, download and install the Microsoft signing key:

bashbash
sudo apt install wget gpg
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /usr/share/keyrings/microsoft.gpg

This command fetches the public key that verifies package authenticity and saves it directly in the system keyring directory.

With the signing key installed, create the repository file so apt knows where to find the package:

bashbash
echo -e "Types: deb\nURIs: https://packages.microsoft.com/repos/code\nSuites: stable\nComponents: main\nArchitectures: amd64,arm64,armhf\nSigned-By: /usr/share/keyrings/microsoft.gpg" | sudo tee /etc/apt/sources.list.d/vscode.sources > /dev/null

This creates the current deb822-format source file that apt reads for the VS Code repository.

Now install the package with apt:

bashbash
sudo apt update
sudo apt install code

The shell command is available immediately. Test it with code --version.

Fedora, RHEL, and CentOS-based distributions

Import the Microsoft signing key and add the repository configuration:

bashbash
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
echo -e '[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc' | sudo tee /etc/yum.repos.d/vscode.repo > /dev/null

This imports the GPG key and writes the repository to a file recognized by dnf. Once the repository is configured, install with:

bashbash
sudo dnf check-update
sudo dnf install code

For older RHEL or CentOS systems, use yum instead of dnf.

Replace dnf with yum in both commands above. This completes the repository-based install for RPM distributions.

Arch Linux

VS Code is available in the Arch User Repository. Install with an AUR helper:

bashbash
yay -S visual-studio-code-bin

This installs the official binary build from Microsoft. The package name pulls the prebuilt binary rather than building from source. Update it with yay -Syu like any other AUR package.

Snap package (any distribution)

If your distribution supports Snap, install from the Snap Store:

bashbash
sudo snap install code --classic

The --classic flag is required. The editor needs classic confinement to access installed tools, shells, and the filesystem outside the Snap sandbox.

Snap updates the editor automatically in the background. No manual update step is needed.

Verify the installation

After installing through any method, confirm that the editor is ready.

  • Open a terminal.
  • Type code --version and press Enter.
  • You should see the version number, commit ID, and platform string.

To open a project from the terminal, create a test folder and open it:

bashbash
mkdir ~/vscode-test && cd ~/vscode-test && code .

The editor opens with the test folder loaded. Create a file, edit it, and save it to confirm everything works. Delete the test folder when done.

Troubleshooting

Command not found after install

If the shell command is not recognized after installing the .deb or .rpm package, close and reopen the terminal. The shell caches the old PATH and needs to reload.

For Snap installs, make sure /snap/bin is in your PATH. Add this line to your shell configuration file:

bashbash
export PATH="$PATH:/snap/bin"

ENOSPC error on large projects

If you see "Visual Studio Code is unable to watch for file changes in this large workspace", Linux has a low default limit on file watchers. Increase it:

bashbash
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

Conflicts with old repositories

If you previously used a third-party repository and see conflicting package errors, remove the old source file from the apt sources directory before adding the official Microsoft repository.

Next steps

The editor is running on Linux. Open a folder, install language extensions, and set up essential settings. Start with the beginner setup guide to configure Auto Save, pick a theme, enable Copilot, and create your first project.

If you also use macOS or Windows, see the macOS install guide.

Rune AI

Rune AI

Key Insights

  • Use the official Microsoft repository for .deb or .rpm packages; auto-update comes with it.
  • Arch users install from the AUR; Snap is available for any distribution.
  • The code command is included automatically with .deb and .rpm installs.
  • Test the install with code --version and open a folder with code .
RunePowered by Rune AI

Frequently Asked Questions

Which Linux package should I use?

Use the native package for your distribution. Debian and Ubuntu use the .deb repository. Fedora and RHEL use the .rpm repository. Arch users can install from the AUR. If your distribution is not listed, use the Snap package from the Snap Store.

Does VS Code auto-update on Linux?

Yes, if you installed through the official repository. Your system package manager handles updates the same way it handles other packages. Snap packages update automatically in the background.

How do I get the code command after installing?

The code command is available automatically after installing from the official .deb or .rpm repository. For Snap, make sure /snap/bin is in your PATH. Test with code --version.

Conclusion

VS Code is installed and running on Linux. The code command is ready. Open a project folder, install extensions, and sign in to GitHub Copilot. For the next step, set up essential settings and create your first project with the beginner setup guide.