установка визуал студио код убунту
Как установить код Visual Studio в Ubuntu 18.04
Самый простой и рекомендуемый способ установки Visual Studio Code на машины с Ubuntu — включить репозиторий VS Code и установить пакет VS Code через командную строку.
Хотя это руководство написано для Ubuntu 18.04, те же шаги можно использовать для Ubuntu 16.04.
Подготовка
Установка кода Visual Studio в Ubuntu
Чтобы установить Visual Studio Code в вашей системе Ubuntu, выполните следующие действия:
Сначала обновите индекс пакетов и установите зависимости, набрав:
Затем импортируйте ключ Microsoft GPG, используя следующую команду wget :
И включите репозиторий Visual Studio Code, набрав:
После включения репозитория apt установите последнюю версию Visual Studio Code с помощью:
Вот и все. Visual Studio Code установлен на вашем рабочем столе Ubuntu, и вы можете начать его использовать.
Запуск кода Visual Studio
Когда вы запускаете VS Code в первый раз, должно появиться следующее окно:
Теперь вы можете приступить к установке расширений и настройке VS Code в соответствии с вашими предпочтениями.
Обновление кода Visual Studio
Когда будет выпущена новая версия, вы можете обновить пакет Visual Studio Code с помощью стандартного инструмента обновления программного обеспечения на рабочем столе или выполнив следующие команды в своем терминале:
Выводы
Если у вас есть вопросы, оставьте комментарий ниже.
Как установить Visual Studio Code в Ubuntu и производных. 3 способа
В этом руководстве я хочу показать, как установить Visual Studio Code в Ubuntu, а также ее производных. Как это часто бывает в Linux, программу можно установить несколькими способами и три из них я опишу ниже. Поэтому, если вы пришли сюда именно за этим — читайте дальше.
Что такое Visual Studio Code
Visual Studio Code — это редактор исходного кода, разрабатываемый компанией Microsoft. Был анонсирован и выпущен весной 2015 года для платформ Linux, Windows и Mac OS.
Обладает большими возможностями в том числе по редактированию, отладке и тестированию кода. VS Code часто ставят в один ряд с Sublime Text, Atom или же Bracket.
Основные возможности Visual Studio Code:
В какой-то степени редактор напоминает IDE, но при этом работает намного быстрее. Думаю, на этом достаточно оффтопа, перейдем к теме поста.
Установка Visual Studio Code с deb пакета
Вероятно, самый привычный для пользователей Windows вариант — установка приложения из установочного файла. Для Debian based дистрибутивов это deb пакеты. Чтобы установить данным способом VS Code:
Установка из репозитория
Если первый способ вам не подошел, можно установить Visual Studio Code в Ubuntu используя репозиторий разработчика. Для этого проделайте следующие шаги:
Обновите базу данных пакетов:
Затем установите поддержу протокола https и другие пакеты:
Следующим шагом импортируйте Microsoft GPG ключ:
Добавьте репозиторий Visual Studio Code в систему:
Еще раз обновите базу данных пакетов:
Наконец, установите редактор:
По завершении процесса можете запустить VS Code либо через меню приложений:
Либо через терминал командой:
Установка Visual Studio Code используя snap
Если вам и предыдущий способ не подошел, можно установить редактор кода из snap пакета. Для этого:
Включите поддержку snap если она у вас отключена:
Выполните установку Visual Studio Code:
По завершению запустите приложение
На сегодняшний день я не так много работаю с кодом (веб разработка), и еще реже пользуюсь подобными редакторами. Поэтому оценивать могу их лишь поверхностно. Однако, положительные отзывы других пользователей, а также популярность вопроса о том, как установить Visual Studio Code в Ubuntu, позволяют говорить о том, что редактор заслуживает внимания.
Отдельно стоит похвалы кроссплатформенность и бесплатное распространение редактора. Это определенно добавляет ему популярности. Так же, вы сами только что могли убедиться, насколько просто его установить в Debian based дистрибутивах. И на этом по данной теме все.
Как установить код Visual Studio на Ubuntu 20.04
Visual Studio Code является кроссплатформенным, доступен в Windows, Linux и macOS.
В этом руководстве показаны два способа установки Visual Studio Code на Ubuntu 20.04. VS Code можно установить как snap-пакет через магазин Snapcraft или как deb-пакет из репозиториев Microsoft.
Выберите метод установки, наиболее подходящий для вашей среды.
Установка кода Visual Studio в виде Snap-пакета
Пакет оснастки Visual Studio Code распространяется и поддерживается Microsoft.
Снапсы — это автономные программные пакеты, которые включают в двоичный файл все зависимости, необходимые для запуска приложения. Пакеты Snap легко обновить и защитить. В отличие от стандартных пакетов deb, снимки занимают больше места на диске и дольше запускают приложение.
Пакеты Snap могут быть установлены либо из командной строки, либо через приложение Ubuntu Software.
Чтобы установить привязку VS Code, откройте свой терминал ( Ctrl+Alt+T ) и выполните следующую команду:
Вот и все. Visual Studio Code установлен на вашем компьютере с Ubuntu.
Если вы предпочитаете использовать графический интерфейс, откройте программное обеспечение Ubuntu, найдите «Код Visual Studio» и установите приложение:
Каждый раз при выпуске новой версии пакет Visual Studio Code будет автоматически обновляться в фоновом режиме.
Установка кода Visual Studio с помощью apt
Код Visual Studio доступен в официальных репозиториях Microsoft Apt. Чтобы установить его, выполните следующие действия:
Обновите индекс пакетов и установите зависимости, выполнив следующую команду от имени пользователя с привилегиями sudo :
Импортируйте ключ Microsoft GPG с помощью следующей команды wget :
И включите репозиторий Visual Studio Code, набрав:
После включения репозитория apt установите пакет Visual Studio Code:
Когда будет выпущена новая версия, вы можете обновить пакет Visual Studio Code с помощью стандартного инструмента обновления программного обеспечения на рабочем столе или выполнив следующие команды в своем терминале:
Запуск кода Visual Studio
В строке поиска действий введите «Код Visual Studio» и щелкните значок, чтобы запустить приложение.
Когда вы запускаете VS Code в первый раз, должно появиться следующее окно:
Теперь вы можете приступить к установке расширений и настройке VS Code в соответствии с вашими предпочтениями.
Выводы
Мы объяснили, как установить VS Code в Ubuntu 20.04.
Если у вас есть вопросы, оставьте комментарий ниже.
Как установить Visual Studio Code на Ubuntu
В этой статье мы рассмотрим, как установить Visual Studio Code на Ubuntu 18.04 или более поздних версий. Для этого лучше всего использовать официальный репозиторий от Microsoft. Однако можно также воспользоваться snap-пакетом или центром приложений Ubuntu.
Установка Visual Studio Code на Ubuntu
Для работы репозитория нужно установить несколько пакетов. Для этого выполните команду:
sudo apt install software-properties-common apt-transport-https wget
Затем установите ключ репозитория:
И добавьте сам репозиторий:
sudo add-apt-repository «deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main»
После этого остается обновить списки пакетов и установить VS Code:
sudo apt update
sudo apt install code
После завершения установки вы можете запустить программу, выполнив в терминале команду code, или через главное меню системы:
Главное окно программы будет выглядеть вот так:
Также можно установить программу с помощью менеджера пакетов snap. Для этого выполните:
А ещё программа есть в центре приложений Ubuntu:
Удаление Visual Studio Code в Ubuntu
Удалять программу надо так, как вы её устанавливали. Если установка Visual Studio Code Ubuntu 18.04 выполнялась из репозитория Microsoft, то для удаления выполните:
sudo apt purge code
Затем можно отключить репозиторий с помощью утилиты Программы и обновления:
А если установка выполнялась через менеджер пакетов snap или центр приложений, то для удаления достаточно выполнить:
sudo snap remove code
Выводы
Теперь у вас есть успешно установленная VS Code Ubuntu 18.04, и вы можете переходить к её настройке, а затем к программированию. Далее вам нужно настроить внешний вид среды, а также установить необходимые дополнения. Но об этом поговорим в следующих статьях.
Visual Studio Code on Linux
Installation
See the Download Visual Studio Code page for a complete list of available installation options.
By downloading and using Visual Studio Code, you agree to the license terms and privacy statement.
Debian and Ubuntu based distributions
Note that other binaries are also available on the VS Code download page.
Then update the package cache and install the package using:
RHEL, Fedora, and CentOS based distributions
We currently ship the stable 64-bit VS Code in a yum repository, the following script will install the key and repository:
Then update the package cache and install the package using dnf (Fedora 22 and above):
Or on older versions using yum :
Due to the manual signing process and the system we use to publish, the yum repo may lag behind and not get the latest version of VS Code immediately.
Visual Studio Code is officially distributed as a Snap package in the Snap Store:
You can install it by running:
Once installed, the Snap daemon will take care of automatically updating VS Code in the background. You will get an in-product update notification whenever a new update is available.
Note: If snap isn’t available in your Linux distribution, please check the following Installing snapd guide, which can help you get that set up.
Learn more about snaps from the official Snap Documentation.
openSUSE and SLE-based distributions
The yum repository above also works for openSUSE and SLE-based systems, the following script will install the key and repository:
Then update the package cache and install the package using:
AUR package for Arch Linux
To get more information about the installation from the AUR, please consult the following wiki entry: Install AUR Packages.
Nix package for NixOS (or any Linux distribution using Nix package manager)
There is a community maintained VS Code Nix package in the nixpkgs repository. In order to install it using Nix, set allowUnfree option to true in your config.nix and execute:
Note that other binaries are also available on the VS Code download page.
Updates
VS Code ships monthly and you can see when a new release is available by checking the release notes. If the VS Code repository was installed correctly, then your system package manager should handle auto-updating in the same way as other packages on the system.
Note: Updates are automatic and run in the background for the Snap package.
Node.js
Node.js is a popular platform and runtime for easily building and running JavaScript applications. It also includes npm, a Package Manager for Node.js modules. You’ll see Node.js and npm mentioned frequently in our documentation and some optional VS Code tooling requires Node.js (for example, the VS Code extension generator).
If you’d like to install Node.js on Linux, see Installing Node.js via package manager to find the Node.js package and installation instructions tailored to your Linux distribution. You can also install and support multiple versions of Node.js by using the Node Version Manager.
To learn more about JavaScript and Node.js, see our Node.js tutorial, where you’ll learn about running and debugging Node.js applications with VS Code.
Setting VS Code as the default text editor
xdg-open
You can set the default text editor for text files ( text/plain ) that is used by xdg-open with the following command:
Debian alternatives system
Debian-based distributions allow setting a default editor using the Debian alternatives system, without concern for the MIME type. You can set this by running the following and selecting code:
Windows as a Linux developer machine
Another option for Linux development with VS Code is to use a Windows machine with the Windows Subsystem for Linux (WSL).
Windows Subsystem for Linux
With WSL, you can install and run Linux distributions on Windows. This enables you to develop and test your source code on Linux while still working locally on a Windows machine. WSL supports Linux distributions such as Ubuntu, Debian, SUSE, and Alpine available from the Microsoft Store.
See the Developing in WSL documentation to learn more or try the Working in WSL introductory tutorial.
Next steps
Once you have installed VS Code, these topics will help you learn more about it:
Common questions
Azure VM Issues
I’m getting a «Running without the SUID sandbox» error?
You can safely ignore this error.
Debian and moving files to trash
If you see an error when deleting files from the VS Code Explorer on the Debian operating system, it might be because the trash implementation that VS Code is using is not there.
Run these commands to solve this issue:
Conflicts with VS Code packages from other repositories
Some distributions, for example Pop!_OS provide their own code package. To ensure the official VS Code repository is used, create a file named /etc/apt/preferences.d/code with the following content:
«Visual Studio Code is unable to watch for file changes in this large workspace» (error ENOSPC)
The limit can be increased to its maximum by editing /etc/sysctl.conf (except on Arch Linux, read below) and adding this line to the end of the file:
While 524,288 is the maximum number of files that can be watched, if you’re in an environment that is particularly memory constrained, you may want to lower the number. Each file watch takes up 1080 bytes, so assuming that all 524,288 watches are consumed, that results in an upper bound of around 540 MiB.
Arch-based distros (including Manjaro) require you to change a different file; follow these steps instead.
I can’t see Chinese characters in Ubuntu
Package git is not installed
This error can appear during installation and is typically caused by the package manager’s lists being out of date. Try updating them and installing again:
The code bin command does not bring the window to the foreground on Ubuntu
Under General > General Options > Focus & Raise Behaviour, set «Focus Prevention Level» to «Off». Remember this is an OS-level setting that will apply to all applications, not just VS Code.
This can happen when sources.list.d doesn’t exist or you don’t have access to create the file. To fix this, try manually creating the folder and an empty vscode.list file:
Cannot move or resize the window while X forwarding a remote window
Using the custom title bar
The custom title bar and menus were enabled by default on Linux for several months. The custom title bar has been a success on Windows, but the customer response on Linux suggests otherwise. Based on feedback, we have decided to make this setting opt-in on Linux and leave the native title bar as the default.
The custom title bar provides many benefits including great theming support and better accessibility through keyboard navigation and screen readers. Unfortunately, these benefits do not translate as well to the Linux platform. Linux has a variety of desktop environments and window managers that can make the VS Code theming look foreign to users. For users needing the accessibility improvements, we recommend enabling the custom title bar when running in accessibility mode using a screen reader. You can still manually set the title bar with the Window: Title Bar Style ( window.titleBarStyle ) setting.
Broken cursor in editor with display scaling enabled
Repository changed its origin value
If you receive an error similar to the following:
Use apt instead of apt-get and you will be prompted to accept the origin change: