Complete Guide to Installing and Using Visual Studio Code on Ubuntu (2025 Edition)

目次

1. Introduction: Why Use VS Code on Ubuntu?

Visual Studio Code (hereafter referred to as VS Code) is a lightweight yet highly powerful source code editor. Provided by Microsoft, it is widely supported by developers around the world thanks to its open-source foundation and excellent extensibility. In addition to Windows and macOS, it runs stably on Linux-based operating systems.

Among them, Ubuntu is one of the most widely used Linux distributions globally. It offers official Long Term Support (LTS) releases, providing strong stability and security. Ubuntu is free to use and benefits from a rich ecosystem of packages and strong community support, making it suitable for both individual development and professional use.

The advantages of using VS Code on Ubuntu include:

  • Lightweight and fast performance: Runs smoothly even on low-spec machines or cloud environments
  • Extensive extension ecosystem: Easily add language support, Git integration, remote development features, and more
  • Cross-platform consistency: The same user experience across different operating systems
  • Official support: Microsoft provides official Ubuntu packages with easy update management

This article explains practical steps in order, from installing VS Code on Ubuntu to Japanese localization, development environment setup, remote development, and container usage. Whether you are new to Ubuntu or considering migrating from another editor, this guide will help you build a complete VS Code environment in the shortest possible time.

2. Installation Method Comparison: Snap / APT (Microsoft Repository) / Official DEB

When installing VS Code on Ubuntu, there are three primary methods available. Compare their features, advantages, and disadvantages to choose the one that best fits your needs.

2-1. Snap (Software Center or CLI)

Features

  • Distributed in the Snap format, Ubuntu’s standard package management system.
  • Can be installed with a single click from the Ubuntu Software Center.
  • From the terminal, installation is done using sudo snap install --classic code.

Advantages

  • Easy GUI installation, ideal for beginners.
  • Automatic updates improve security and ensure access to the latest features.

Disadvantages

  • Due to sandboxing, compatibility issues with IME or themes have been reported.
  • Startup and responsiveness may feel slightly slower.

2-2. APT (via Microsoft Official Repository)

Features

  • Uses Microsoft’s official APT repository to manage VS Code with apt.
  • After registering the repository using a .deb file, management is done with sudo apt update && sudo apt install code.

Advantages

  • Integrated with standard APT management for consistent system updates.
  • High compatibility with Japanese input methods and other core features.
  • Simple and clear update control.

Disadvantages

  • Initial repository registration requires additional steps.
  • May feel less approachable for users accustomed to GUI-only installations.

Learn how to install Microsoft products on Linux using the p…

Technically Impossible

Ubuntuでのパッケージ・マネジャーと言えば”apt”だが、そのレポジトリでVSCodeは提供されていない。Ubunt…

2-3. Standalone Installation Using the Official DEB Package

Features

  • Download the .deb package directly from Microsoft’s official website.
  • Install using sudo apt install ./code_*.deb, which automatically resolves dependencies.

Advantages

  • Convenient for offline or restricted network environments.
  • No repository registration required for initial installation.

Disadvantages

  • Automatic updates require manual repository setup afterward.
  • Less convenient for long-term maintenance compared to Snap or APT methods.

2-4. Which Method Should You Choose?

  • Ease of use / GUI-focused → Snap (Ubuntu Software Center)
  • Stability / Japanese input and extensibility → APT (Official Repository)
  • One-time installation / Minimal setup → Official DEB (Standalone)

For daily development with long-term use, the APT (Microsoft official) method offers the best balance and simple update management. Snap is convenient for quick testing or trial use, while the official DEB package is ideal for restricted or verification environments.

Based on this comparison, the next section explains the recommended installation procedure using the “Official DEB → APT integration” method with concrete command examples.

3. Procedure A: Install via Official DEB with APT Integration (Recommended)

In this section, you will install VS Code using the official .deb package recommended by Microsoft, while simultaneously registering the APT repository to ensure continuous access to the latest versions. This method offers high stability for Japanese input and helps avoid IME compatibility issues sometimes reported with the Snap version.

3-1. Download the DEB Package from the Official Website

  1. Open your browser and visit the official Visual Studio Code download page.
  2. Click the .deb button (for Debian/Ubuntu) to download the package.

3-2. Install via Terminal

If the downloaded file is located in ~/Downloads, run the following commands:

cd ~/Downloads
sudo apt install ./code_*.deb
  • Passing the .deb file directly to apt install automatically resolves required dependencies.
  • This process also registers Microsoft’s APT repository.

3-3. Verify Installation

Check the installed version using the following command:

code --version

Alternatively, search for “Visual Studio Code” in the application menu and launch it.

3-4. Updating VS Code

Once the APT repository is registered, VS Code will be updated together with system updates:

sudo apt update
sudo apt upgrade

3-5. Uninstalling (Reference)

If you need to remove VS Code, run:

sudo apt remove code
sudo apt autoremove

With this setup, you can continue using the latest VS Code version with minimal maintenance.

4. Procedure B: Install Using Snap (GUI / CLI)

Snap is Ubuntu’s standard package distribution format and allows installation via the Software Center (GUI) or simple command-line operations. It is particularly convenient for beginners or those who want a quick setup without detailed configuration.

4-1. Install from Software Center (GUI)

  1. Open Ubuntu Software from the application menu.
  2. Enter “Visual Studio Code” or “code” in the search bar.
  3. Select “Visual Studio Code” and click the Install button.
  4. Enter your password and wait for installation to complete.

4-2. Install from Command Line (CLI)

Open a terminal and enter the following command:

sudo snap install --classic code
  • The --classic option is required to grant standard filesystem access.
  • The download and installation typically complete within a few minutes.

4-3. Verify Installation

code --version

Or launch “Visual Studio Code” from the application menu.

4-4. Updates and Removal

  • The Snap version updates automatically, so manual updates are usually unnecessary.
  • To remove it, run:
sudo snap remove code

4-5. Notes on the Snap Version

  • Japanese Input: Depending on the environment and IME settings, input issues have been reported. Switching to the DEB → APT method often resolves these problems.
  • Startup Speed: Due to Snap’s sandboxing structure, the first launch may be slightly slower.

5. Initial Setup: Localization, Fonts, and Display Adjustments

After installing VS Code on Ubuntu, the first steps should be localization and optimizing readability. Proper configuration at this stage makes future development much smoother.

5-1. Localization (Installing the Japanese Language Pack)

  1. Launch VS Code and click the Extensions icon (four-square icon) on the left.
  2. Enter Japanese Language Pack in the search bar.
  3. Install “Japanese Language Pack for Visual Studio Code”.
  4. After installation, click [Change Language] in the popup shown at the bottom right.
  5. Restart VS Code to apply the Japanese UI.

For manual switching, open the command palette with Ctrl+Shift+P (or F1), type Configure Display Language, and select ja.

5-2. Font Settings

For programming, monospaced fonts with clear distinction between full-width and half-width characters are recommended.

  1. Open [File] → [Preferences] → [Settings].
  2. Enter “font family” in the search bar.
  3. Set your preferred font (e.g., Cascadia Code, Fira Code, Noto Sans Mono CJK JP).

Using ligature-enabled fonts improves the visual clarity of symbols like => and ===.

5-3. Display Adjustments (Themes and Icons)

  • Theme selection: Press Ctrl+KCtrl+T to open the theme selector.
  • Icon themes: Use Ctrl+Shift+PFile Icon Theme to change icon sets.

5-4. Recommended Additional Initial Settings

  • Show line numbers: Set editor.lineNumbers to on.
  • Format on save: Enable editor.formatOnSave.
  • Auto save: Set files.autoSave to afterDelay.

The basic working environment is now ready. The next section introduces essential extensions and configuration examples to further improve productivity.

6. Commonly Used Extensions and Basic Configuration (Set Up in the First 10 Minutes)

One of VS Code’s greatest strengths is its ability to easily add functionality through extensions. This section introduces essential extensions to install immediately after setup on Ubuntu, along with fundamental configuration items that significantly improve development efficiency.

6-1. Essential Extensions

  1. Japanese Language Pack for Visual Studio Code
  • A required extension for Japanese UI display, explained earlier.
  1. Python
  • Essential for Python development, providing linting, code completion, and debugging.
  • When combined with the Jupyter extension, notebook-style development is also supported.
  1. C/C++
  • Provides code completion, debugging, and syntax highlighting for C and C++.
  • Recommended to use together with the build-essential package.
  1. GitLens
  • Visually displays Git history and diffs, making it extremely useful for team development and change tracking.
  1. Remote Development Pack
  • An integrated pack enabling development over SSH, inside Docker containers, or on WSL.
  • Explained in more detail in the Remote Development section.
  1. Prettier – Code Formatter
  • Automatically formats code. Supports JavaScript, TypeScript, HTML, and CSS.

6-2. Initial Configuration Items

  • Format on save
  "editor.formatOnSave": true

This ensures consistent formatting every time you save a file.

  • Tab width and indentation
  "editor.tabSize": 4,
  "editor.insertSpaces": true

Adjust these to match your team’s coding standards.

  • Insert final newline
  "files.insertFinalNewline": true
  • Show line numbers
  "editor.lineNumbers": "on"
  • Trim trailing whitespace
  "files.trimTrailingWhitespace": true

6-3. Enabling Settings Sync

Sign in with a VS Code account (Microsoft or GitHub) and enable Settings Sync to automatically synchronize settings and extensions across multiple PCs or after reinstallation.

At this point, the core development environment is essentially complete.

7. Minimal Language-Specific Environment Setup

This section explains how to quickly set up development environments for Python and C/C++, which are commonly used on Ubuntu. By adding these configurations to a fresh VS Code installation, you can begin practical development immediately.

7-1. Python Environment Setup

  1. Install Python and virtual environment tools
sudo apt update
sudo apt install python3 python3-venv python3-pip
  • python3-venv provides isolated environments per project.
  • pip is the package manager.
  1. Install VS Code extensions
  • Install the official Python extension.
  • Optionally install Jupyter for notebook-based workflows.
  1. Create and activate a virtual environment
python3 -m venv .venv
source .venv/bin/activate

VS Code automatically detects the virtual environment and lists it in the interpreter selection menu.

  1. Lint and format setup (example: ruff and black)
pip install ruff black

Configure VS Code to run black for formatting and ruff for static analysis on save.

7-2. C/C++ Environment Setup

  1. Install compilers and essential packages
sudo apt update
sudo apt install build-essential gdb
  • Includes gcc, g++, and the gdb debugger.
  1. Install VS Code extensions
  • Install the official C/C++ extension.
  • Optionally add CMake Tools.
  1. Configure build tasks
  • Open the command palette (Ctrl+Shift+P) and select “Tasks: Configure Default Build Task”.
  • Choose g++ build active file.
  • This enables building the current file with Ctrl+Shift+B.
  1. Configure debugging
  • Press F5 and select “C++ (GDB/LLDB)”.
  • A .vscode/launch.json file is created, enabling breakpoint-based debugging.

7-3. Verification and Test Execution

Python example

print("Hello, Python on Ubuntu!")

C++ example

#include <iostream>
using namespace std;

int main() {
    cout << "Hello, C++ on Ubuntu!" << endl;
    return 0;
}

Save the file, build C++ with Ctrl+Shift+B, and run the generated executable to verify functionality.

8. Remote Development: Remote SSH / Dev Containers / Codespaces

VS Code supports comfortable development not only on local machines but also on remote servers and containerized environments. On Ubuntu, combining these features significantly improves flexibility and reproducibility.

8-1. Remote SSH

Overview

Edit and execute code located on a remote server directly from your local VS Code. A VS Code server runs on the remote host, providing a local-like experience.

Procedure

  1. Install the Remote Development Pack (includes Remote – SSH).
  2. Add connection details to ~/.ssh/config. Example:
Host myserver
    HostName 192.168.0.50
    User ubuntu
    IdentityFile ~/.ssh/id_rsa
  1. Open the command palette and select “Remote-SSH: Connect to Host”, then choose myserver.

Advantages

  • Edit, run, and debug code without logging in directly to the server.
  • Keep local environments clean while developing server-specific projects.

8-2. Dev Containers

Overview

Use Docker containers as VS Code development environments. Configuration is stored in a .devcontainer directory, allowing anyone to work with the same setup.

Procedure

  1. Install Docker and Docker Compose on Ubuntu.
  2. Install the Dev Containers extension.
  3. Create .devcontainer/devcontainer.json in the project root. Example:
{
    "name": "Python Dev",
    "image": "python:3.11",
    "features": {},
    "settings": {
        "terminal.integrated.shell.linux": "/bin/bash"
    }
}
  1. Select “Dev Containers: Reopen in Container” from the command palette.

Advantages

  • Completely isolate dependencies and toolchains per project.
  • Ensures consistent environments across team members.

8-3. GitHub Codespaces

Overview

A cloud-based VS Code environment provided by GitHub. Accessible via browser, enabling instant development without local setup.

Procedure

  1. Open a GitHub repository.
  2. Select “Code” → “Codespaces” → “New codespace”.
  3. Within seconds, a cloud environment launches with VS Code in the browser.
  4. Optionally connect from local VS Code.

Advantages

  • Enables full development even on low-spec devices.
  • Work from anywhere with a consistent environment.

9. Common Issues and Troubleshooting

Depending on environment and installation method, several issues may occur when using VS Code on Ubuntu. This section summarizes common problems and solutions.

9-1. Japanese Input Does Not Work or Is Unstable

Causes

  • IME compatibility issues in the Snap version.
  • Input methods not functioning correctly inside sandbox environments.

Solutions

  • Uninstall the Snap version and reinstall using the official DEB (APT-integrated) method.
  • Reconfigure fcitx or ibus if necessary.

9-2. Slow Startup or Poor Performance

Causes

  • Snap sandbox initialization or heavy extension loading.
  • Too many unnecessary extensions enabled.

Solutions

  • Start with code --disable-extensions to identify problematic extensions.
  • Switching from Snap to DEB often improves performance.

9-3. Certain Extensions Do Not Work

Causes

  • Missing libraries or Ubuntu version incompatibilities.
  • Permission issues in container or remote environments.

Solutions

  • Install required dependencies using sudo apt install.
  • Verify access permissions for required paths.

9-4. Display or Input Issues on Wayland

Causes

  • VS Code often runs via XWayland, and native Wayland compatibility is not fully mature.

Solutions

  • Log in using an Xorg session.
  • Or launch with the following option:
code --ozone-platform=x11

9-5. Complete Uninstallation

Solutions

  • DEB version:
sudo apt remove code
sudo apt autoremove
rm -rf ~/.config/Code
  • Snap version:
sudo snap remove code
rm -rf ~/.config/Code

10. Security and Update Policy

For long-term VS Code usage on Ubuntu, maintaining security and up-to-date functionality is essential.

10-1. Update Behavior by Installation Method

  1. APT (Official Repository)
  • Updates are applied together with system updates using sudo apt update && sudo apt upgrade.
  • Provides a good balance between stability and new features.
  1. Snap
  • Automatically updated by snapd.
  • Update timing depends on snapd scheduling.
  1. Standalone DEB (No Repository)
  • No automatic updates.
  • Manual reinstallation is required for new versions.

10-2. Security Considerations

  • Use trusted sources
  • Always download from the official website or Microsoft repositories.
  • Avoid unofficial PPAs or third-party packages.
  • Extension selection
  • Verify publishers and reviews.
  • Avoid extensions that have not been updated for long periods.
  • Permission management
  • Strictly manage keys and permissions for Remote SSH and containers.
  • Avoid unnecessary port exposure and root containers in Docker.

10-3. Recommended Update Frequency

  • Stability-focused: Update every few weeks aligned with Ubuntu LTS schedules.
  • Feature-focused: Check for updates weekly.
  • Snap users: Rely on automatic updates, consider rollback with sudo snap revert code if issues occur.

11. Summary: Build a Fully Usable Ubuntu × VS Code Environment Quickly

This article covered installation methods, initial setup, language environments, remote development, troubleshooting, and security. Below is a concise roadmap for rapid setup.

11-1. Fastest Setup Steps

  1. Installation
  • Choose Official DEB → APT integration for stability and easy updates.
  • Use Snap for quick trials, noting potential IME issues.
  1. Initial configuration
  • Install the Japanese Language Pack.
  • Adjust fonts and themes.
  • Enable format on save and line numbers.
  1. Essential extensions
  • Python, C/C++, GitLens, Remote Development Pack, Prettier.
  • Enable Settings Sync.
  1. Language environment setup
  • Python: virtual environments and lint/format tools.
  • C/C++: compiler, debugger, build and debug tasks.
  1. Remote development
  • Remote SSH for server-based development.
  • Dev Containers for project isolation.
  • GitHub Codespaces for cloud-based workflows.
  1. Security and updates
  • Use only official sources.
  • Perform regular updates via APT or Snap.

11-2. How to Use This Article

  • New Ubuntu users can achieve a fully functional development environment within one hour by following this guide step by step.
  • Users migrating from other editors can greatly improve efficiency using VS Code’s extensions and remote features.
  • In case of issues, Chapter 9 provides quick recovery solutions.

FAQ

Q1. Should I use the Snap or APT version?
A. For long-term stability, the APT version (via official DEB) is recommended. Snap is acceptable for short-term testing but may differ in IME behavior and startup speed.

Q2. How do I enable Japanese localization?
A. Install “Japanese Language Pack for Visual Studio Code” and select ja via Configure Display Language, then restart.

Q3. Japanese input does not work. What should I do?
A. If using Snap, switch to the official DEB version. Also verify ibus or fcitx configuration.

Q4. What is required to start Python development?
A. Install Python, python3-venv, and pip, then add the Python extension in VS Code.

Q5. C/C++ build fails.
A. Install build-essential and gdb, enable the C/C++ extension, and configure build tasks.

Q6. How do I use Remote SSH?
A. Install the Remote Development Pack, configure ~/.ssh/config, and connect via the command palette.

Q7. What are Dev Containers?
A. They allow Docker containers to be used as isolated development environments defined by .devcontainer.

Q8. How often should I update?
A. For stability, update every few weeks. For new features, update weekly. Snap updates automatically.