Visual Studio Code Installation Guide

How to Install Visual Studio Code on Ubuntu: A Complete Step by Step Guide

Visual Studio Code (VS Code) is a popular and versatile code editor used by many developers. If you’re using Ubuntu and want to set up VS Code, follow this guide for a clear, step-by-step installation process.

Step 1: Update Your System

Keeping your system up-to-date ensures all your software packages are current and secure.

  1. Open a terminal by pressing Ctrl + Alt + T.

  2. Run the following command to update your package list:

    sudo apt update
    • What this does: Updates your package list with the latest information about available packages and their versions from the repositories.
  3. Next, upgrade your installed packages to their latest versions:

    sudo apt upgrade
    • What this does: Upgrades all installed packages to their latest versions based on the updated package list.

Step 2: Install Required Tools

Before adding the VS Code repository, you need to install a few essential tools.

  1. Run the following command:

    sudo apt install software-properties-common apt-transport-https wget
    • software-properties-common: Provides the add-apt-repository command to add new repositories.
    • apt-transport-https: Allows apt to use repositories accessed over HTTPS, ensuring a secure connection.
    • wget: A utility for downloading files from the web, used to get Microsoft’s GPG key.

Step 3: Add Microsoft’s Repository

To get VS Code, you need to add Microsoft’s official repository.

  1. Import the Microsoft GPG key with:

    wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
    • What this does: wget -qO- downloads the key from Microsoft’s servers and | sudo apt-key add - adds it to your system’s list of trusted keys.
  2. Add the VS Code repository with:

    sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
    • What this does: Adds the VS Code repository to your list of package sources, allowing you to install VS Code using apt.

Step 4: Install Visual Studio Code

With the repository added, you can now install VS Code.

  1. Update your package list to include packages from the new repository:

    sudo apt update
    • What this does: Updates your package list to include the packages available in the newly added VS Code repository.
  2. Install VS Code with:

    sudo apt install code
    • What this does: Installs Visual Studio Code from the repository.

Step 5: Open Visual Studio Code

To start VS Code:

  1. Type code in the terminal:

    code
    • What this does: Launches the Visual Studio Code application.
  2. Alternatively, you can find VS Code in your application menu.

Optional: Install Extensions

VS Code’s functionality can be extended with various extensions.

  1. Open VS Code, then:
  2. Click on the Extensions view icon on the Sidebar or press Ctrl + Shift + X.
  3. Search for and install extensions like:
    • Python: For Python development.
    • Prettier: For code formatting.
    • GitLens: For enhanced Git capabilities.

Troubleshooting Tips

If you encounter issues, here are some troubleshooting steps:

  • Missing Dependencies: Fix them with:

    sudo apt install -f
    • What this does: Attempts to fix any broken dependencies by installing missing packages.
  • Broken Packages: Resolve them with:

    sudo apt --fix-broken install
    • What this does: Fixes broken packages and dependencies that might be preventing the installation of new software.

Conclusion

You’ve successfully installed Visual Studio Code on Ubuntu! With VS Code, you have a powerful tool to enhance your coding experience. If you have any questions or run into problems, don’t hesitate to seek help.

Happy coding!

Comments

Popular posts from this blog

πŸš€ How Docker Saved Me from Dependency Hell πŸ”₯😡‍πŸ’«

Essential Commands for Docker, Laravel, and Git Development

Old Client Sites Gone? Don’t Let Broken Links Ruin Your Portfoli, a Way to fetch old websites from 503 Errors to Full Recovery: How Developers Can Save Old Work