How to Install VS Code on Ubuntu?

how to install vs code on ubuntu

If you’re looking to start coding or streamline your development workflow on Ubuntu, Visual Studio Code (VS Code) is an excellent choice. It’s a powerful, open-source code editor that supports a wide range of programming languages and tools. Whether you’re a beginner or a seasoned developer, this guide will walk you through the process of install VS Code on Ubuntu, ensuring you’re up and running quickly.

In this article, we will cover everything you need to know, including:

  • What is Visual Studio Code?
  • Why choose Visual Studio Code for Ubuntu?
  • Different methods for installing VS Code on Ubuntu
  • Troubleshooting common installation issues

By the end of this guide, you’ll have Visual Studio Code installed and be ready to dive into your development projects on Ubuntu. Let’s get started!

What is Visual Studio Code?

Visual Studio Code (VS Code) is an open-source code editor developed by Microsoft. It is highly customizable, lightweight, and packed with powerful features, making it suitable for both beginner and advanced programmers. Some of its key features include:

  • IntelliSense: Smart code completion and suggestions based on variable types, function definitions, and imported libraries.
  • Debugging: VS Code has built-in support for debugging, enabling you to run your code, inspect variables, and troubleshoot issues.
  • Extensions: The editor supports a vast library of extensions for various programming languages, frameworks, and tools, enhancing its functionality.
  • Integrated Terminal: Access a terminal right within the editor, so you don’t need to switch between windows.

VS Code is available for all major operating systems, including Linux, Windows, and macOS. In this guide, we will focus on how to install it on Ubuntu.

Why Choose Visual Studio Code on Ubuntu?

Ubuntu is a popular choice for developers, and VS Code fits seamlessly into the Ubuntu ecosystem. Here’s why:

  • Cross-Platform Compatibility: You can sync your development environment across different platforms, making VS Code a great tool for developers working in diverse environments.
  • Lightweight: VS Code is known for its speed and efficiency. It doesn’t consume too many resources, making it ideal for Ubuntu users who want a fast and responsive editor.
  • Open-Source: Since it’s free and open-source, you can modify VS Code as needed or contribute to its development.
  • Active Community: The VS Code community is vibrant and constantly improving the editor with new features, extensions, and bug fixes.

Ubuntu users will benefit from these features, and setting up VS Code is straightforward with various installation methods to choose from.

how to install vs code on ubuntu

Prerequisites for Install Visual Studio Code on Ubuntu

Before you proceed with the installation, ensure that your system meets the following prerequisites:

  • Ubuntu Version: This guide applies to Ubuntu 20.04 and later. Ensure your system is up to date.
  • Sudo Access: You will need to have administrative (sudo) access to install software on your system.
  • Internet Connection: You will need an active internet connection to download and install VS Code.

If your system is ready, let’s move on to the installation methods!


Method 1: Install Visual Studio Code Using Ubuntu’s APT Package Manager

One of the most common and straightforward ways to install software on Ubuntu is by using the APT package manager. Fortunately, Visual Studio Code is available through Microsoft’s official repository.

Step-by-Step Guide:

  1. Update Your System: Before installing any new software, it’s always a good idea to update your package list. Open your terminal and run the following command: sudo apt update
  2. Install Required Dependencies: Ensure your system has the required dependencies by installing the following packages: sudo apt install software-properties-common apt-transport-https curl
  3. Add Microsoft’s GPG Key: To verify the integrity of the packages, you need to add Microsoft’s GPG key to your system. Run this command: curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
  4. Add the VS Code Repository: Now, add the Visual Studio Code repository to your system’s sources list: sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
  5. Install Visual Studio Code: After adding the repository, update your package list and install Visual Studio Code: sudo apt update sudo apt install code
  6. Launch Visual Studio Code: Once installed, you can launch VS Code by typing: code

This method integrates well with your system’s package management tools, ensuring easy updates through the same interface.


Method 2: Install Visual Studio Code Using Snap

Snap is a universal Linux package format that allows you to install software in a confined environment. Visual Studio Code is available as a Snap package, making it easy to install with a single command.

Step-by-Step Guide:

  1. Install Snap (if not already installed): If Snap is not installed on your system, you can install it using the following command: sudo apt install snapd
  2. Install Visual Studio Code: Once Snap is installed, you can easily install VS Code by running: sudo snap install --classic code
  3. Launch Visual Studio Code: After installation, open VS Code by typing: code

Snap packages are easy to install and update, but keep in mind that Snap might not integrate perfectly with all Ubuntu themes or environments.


Method 3: Install Visual Studio Code Using the .deb Package

Another straightforward method for installing VS Code on Ubuntu is by downloading the .deb package from the official website.

Step-by-Step Guide:

  1. Download the .deb Package: Visit the official Visual Studio Code website: https://code.visualstudio.com. Download the .deb package for Ubuntu.
  2. Install the .deb Package: Once the download is complete, navigate to the folder where the .deb file is located. Install it using the following command: sudo dpkg -i code_*.deb
  3. Resolve Dependencies (if any): If you encounter dependency issues, you can fix them with this command: sudo apt --fix-broken install
  4. Launch Visual Studio Code: Once installed, launch VS Code from the terminal: code

This method is ideal for users who prefer downloading software manually and managing installations outside the command line.

How to Launch Visual Studio Code on Ubuntu?

After installation, you can easily launch Visual Studio Code in several ways:

  • Using the Terminal: Open a terminal and type code.
  • Using the Application Menu: Search for “Visual Studio Code” in the application launcher and click the icon to open it.
  • Creating a Desktop Shortcut: If you’d like quicker access, create a desktop shortcut or pin it to your taskbar for easy launch.

Customizing Visual Studio Code for a Better Development Experience

Once you have Visual Studio Code installed, there are many ways to customize it to suit your needs:

  1. Install Extensions: Visit the Extensions Marketplace and install plugins for the languages and tools you use most frequently.
  2. Adjust the Theme: Choose from a wide variety of color themes to make your coding environment comfortable.
  3. Configure Keybindings: Set up custom keyboard shortcuts for a smoother workflow.
  4. Enable Auto-Save: Turn on auto-save to prevent losing your work.

Troubleshooting Common Installation Issues

If you run into any issues during the installation process, here are a few common solutions:

  • Error: Package Not Found: Make sure you’ve added the repository correctly and updated your package list (sudo apt update).
  • Dependency Issues: If there are issues with dependencies, run sudo apt --fix-broken install to resolve them.
  • Snap Installation Issues: If Snap doesn’t work properly, ensure Snap is installed and up to date by running sudo snap refresh.

Conclusion:

Congratulations! You have successfully installed Visual Studio Code on Ubuntu system. Whether you used APT, Snap, or the .deb package, you now have a powerful and flexible code editor at your fingertips.

Next Steps:

  • Explore Extensions: Enhance your VS Code experience by installing extensions for the languages and tools you use.
  • Start Coding: Open a project, write some code, and begin experimenting with the editor’s features.
  • Join the Community: Participate in the vibrant Visual Studio Code community to share tips and learn from others.

If you have any questions or run into issues, feel free to leave a comment below. Happy coding!

If you found this guide helpful, please share it with others who might benefit from it. Don’t forget to leave a comment or explore related articles on our site for more tips and tutorials.

Read Also : How to Install Ubuntu on Virtual Machine?

Leave a Comment

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

Scroll to Top