December 3, 2020 by Alessandro Segala, @ItalyPaleAle
- Visual Studio Code Apt
- Visual Studio Code Vs Visual Studio Community
- What Is Visual Studio Code
- Visual Studio Code Apt Install
For the last few years, Chromebooks running Google Chrome OS have been providing an alternative to 'traditional' laptops. Thanks to lots of choices, from very affordable models to high-end ones, Chromebooks are especially popular among students, who can use them for learning, completing assignments, and attending classes virtually.
While Chromebooks and Chrome OS are typically centered around the web browser, you can also enable a Linux environment that allows installing native desktop applications, including Visual Studio Code!
With VS Code running on your Chromebook, you can start coding easily and quickly in a variety of languages and frameworks. This includes languages such as Python, JavaScript and Node.js, Java, and C#, among many more!
In this article, the first of two, we'll look at how to install Visual Studio Code on a Chromebook and how to set up an environment to start coding in Python or JavaScript/Node.js. In a later post, we'll also look at how to leverage the Remote Development extensions for VS Code to connect to more powerful development environments.
What you'll need
Visual Studio Code is officially distributed via the Raspberry Pi OS (previously called Raspbian) APT repository, in both 32-bit and 64-bit variants. You can install it by running: sudo apt update sudo apt install code Running VS Code. After installing the VS Code package, you can run VS Code by typing code in a terminal or launching it via the Programming menu. The yum repository above also works for openSUSE and SLE-based systems, the following script will install the key and repository: sudo rpm -import sudo sh -c 'echo -e ' codenname=Visual Studio Codenbaseurl=https://packages.microsoft.com/yumrepos/vscodenenabled=1ntype=rpm-mdngpgcheck=1ngpgkey=https://.
VS Code runs on any recent Chromebook, as long as you are able to enable Linux applications via Crostini, which we'll look at how to do in just a moment.
Visual Studio Code is a lightweight editor, so you will be able to run it on low-powered Chromebooks, with a minimum of 1 GB of RAM. In addition, VS Code is now available for Linux on ARMv7 and ARM64, which means that you can run it on Chromebooks powered by an ARM chip as well!
For this tutorial, I'll be using an entry-level Chromebook, with an ARM64 CPU, 4 GB of RAM, and a 32 GB-disk. Despite the modest specs, VS Code runs just fine on this machine!
Enable Linux on your Chromebook
Before we can install VS Code on Chrome OS, we need to enable support for native Linux apps, using Crostini.
First, open your system's Settings, then look for Linux (Beta) on the sidebar. From there, turn on Linux support.
Follow the instructions on screen to configure the Linux environment (for most people, accepting the default values should be enough). Your Chromebook will then download the tools to create the Linux environment and configure it for you. Behind the scenes, this is actually creating a container running Debian 10, so you get a full Linux distribution to play with!
Once the Linux environment has been set up, you'll see a new terminal window popping up.
Before we can install VS Code, we need to run a couple of commands in the Linux terminal. We need to update the list of Linux packages and to install the optional (but strongly recommended) dependency
gnome-keyring
. In the terminal, type the following two commands (press the Enter key at the end of each command to execute them):The output will be similar to this:
As soon as the second command ends, you can move to the next step.
Visual Studio Code Apt
Install VS Code
We're now ready to install VS Code!
Go to the Visual Studio Code Download page. From there, you need to pick the right package for your Chromebook:
- For Chromebooks running an Intel or AMD chip, pick the .deb in variant 64 bit.
- If your Chromebook is running on an ARM64 chip (like the one I'm testing with), pick the .deb package in the variant ARM64 instead.
If you're unsure what kind of CPU your Chromebook is using, run the command
dpkg --print-architecture
in the Linux terminal to find out. You'll see either amd64
(for both Intel and AMD chips: pick the 64 bit variant for VS Code) or arm64
(pick ARM64).After you've downloaded VS Code, you'll find the package in your Downloads folder. Double-click on the package to launch the installer:
Your Chromebook will then install VS Code and all other dependencies.
After the installation is complete, in your list of apps, you'll find Visual Studio Code inside a folder called Linux apps (along with the Linux terminal). You can now launch VS Code.
You should see VS Code running, and at this point you're ready to start coding!
If you're new to VS Code and want to know how to use the editor, here are some resources for you to explore:
- VS Code Introductory Videos: These videos will explain how to use VS Code to open files and folders, install themes and extensions, configure the editor, and more.
- Learn to code with VS Code: Our 'Learn' section contains articles, tutorials, and videos for people who are new to coding and want to get started.
Code with JavaScript and Node.js
JavaScript is a very flexible programming language, that can be used to build apps running inside a web browser and on web servers with Node.js. Nowadays, JavaScript is also being used to build native desktop apps (Electron) and mobile apps (Apache Cordoba, React Native, etc.), programming Internet-of-Things (IoT) devices, and much more.
Tip: If you want to learn JavaScript, there is a free video series our colleagues made:
Visual Studio Code is a very popular editor for coding with JavaScript and Node.js (State of JS survey), and supports JavaScript natively.
However, in order to use Node.js (and JavaScript in general) on your Chromebook, you'll have to install the Node.js runtime. To do that, we're going to use nvm, a small open-source utility that makes it easier to install Node.js and update it.
To install nvm, run the following commands inside the Linux terminal:
After you have nvm installed, you can install the latest version of Node.js with this command:
Tip: Did you know that VS Code contains an integrated terminal? You can launch it from the Terminal menu and then New Terminal. VS Code is running in the context of the Linux environment, so the integrated terminal is also running in Linux.
nvm offers quite a few options to set up, update, and manage Node.js. If you're interested, you can read more in the official documentation for nvm.
After Node.js is installed, you can use the
node
command in the terminal (running node --version
is a good way to check your Node.js installation), as well as all the built-in features of VS Code, such as the integrated task runner and debugger for Node.js and JavaScript. To learn more about using JavaScript and Node.js in VS Code, check out the VS Code documentation!Code with Python
Python is another popular programming language, and it's especially great for beginners. With Python, you can build apps for the web, desktop, and command line. Python is one of the best-suited languages for working with data science and Artificial Intelligence (AI), and it's also used to program IoT devices, microcontrollers, and more!
VS Code is an excellent editor for coding Python and learning the language. You can use Python in VS Code both for building apps of every kind and for working with notebooks, such as those used by data scientists.
Tip: If you're looking at getting started with Python, there is a free video series for you as well:
Chrome OS already comes with the Python 3 interpreter pre-installed, but we need to install a few more packages to get the best Python coding experience. This includes pip (a dependency manager for Python), venv (for managing Python virtual environments), and some build tools for working with native packages. In the terminal, run:
Python support in VS Code is provided through the Microsoft Python extension. To install the Python extension, from within VS Code, use the left Activity bar to open the Extensions view (⇧⌘X (Windows, Linux Ctrl+Shift+X)), then search for 'python' and install the extension provided by Microsoft:
At this point, you're ready to start developing with Python in VS Code! To learn more about using Python with VS Code, including running your code, using the integrated debugger, linting, etc., check out our documentation for Python in VS Code.
Coming next: using Remote Development
That's all for today! In this post, we looked at how to install VS Code on a Chromebook and how to get started with coding in JavaScript/Node.js and Python.
But wait, there's more. While Chromebooks can run VS Code just fine, even on lower-powered versions like the one I'm testing with, sometimes you need to use faster machines for your development, with more memory and/or a faster CPU. For example, maybe you're using an ARM-powered Chromebook but you need to run your code on a Intel/AMD chip. Or maybe you want to work with Artificial Intelligence and need access to machines with powerful GPUs.
With VS Code and the Remote Development extensions (SSH and Container), as well as GitHub Codespaces, we can solve all of the problems above–and more.
In the next part of this tutorial, you'll learn how VS Code Remote extensions and GitHub Codespaces can turn your Chromebook into a development powerhouse!
In the meanwhile, happy coding… and happy learning!
Alessandro Segala, VS Code Product Manager @ItalyPaleAle
Visual Studio Code is an optimized, feature rich code editor for building web and cloud application’s. It is developed by the Microsoft team. It includes feature like embedded Git, supports debugging feature, syntax highlighting, intelligent code completion, snippets, and code refactoring.
The Visual Studio code is freely available for most of modern operating systems like Windows, Linux (RPM and Debian installation is also available), and macOS.
Visual Studio Code Vs Visual Studio Community
This tutorial will help you to install Visual Studio Code editor on Ubuntu 20.04 using Apt repository as well as snap tool.
What Is Visual Studio Code
Prerequisites
Visual Studio Code Apt Install
Before continuing for Visual Studio Code installation on Ubuntu 20.04:
- Login to Ubuntu as sudo privileged user
- For the newly installed systems, required to complete initial server setup
Method 1 – Install using Snap Tool
The snap package contains all the requirements for any application. So just execute the below command on your system terminal:It will download the eclipse IDE snap package and install on your machine. Once the installation completed successfully, you will see the following output.The snap package has been installed on your system.Next method will instruct you to install visual studio code using the apt package manager. But if you already have installed using snap tool, skip next method.Method 2 – Install Code with Apt
First, Import the GPG key to your system to verify packages before installation. To import gpg key, type:Microsoft team provides an repository for the Debian packages installation. To enable the Visual Studio code Apt repository, type:Once you successfully added the repository to your system, Execute the following commands to install Visual Studio Code on Ubuntu system.
Step 1 – Install Visual Studio Code
Choose one of the below methods to install Visual Studio Code on your Ubuntu system. The Ubuntu 20.04 LTS preferred to use snap tool instead of Apt for packages installation. So, we are providing installation method with snap tool first.
Step 3 – Launch Visual Studio Code
Now, The Visual Studio Code has been installed on your Ubuntu 20.04 system. To launch the application type “code” in search application and click on it.
The Visual Studio Code editor is ready to use.
There are a large number of extensions available for Visual Studio Code like C#, Python, JavaScript, Google Chrome etc. Install the required extensions to enhance your working experience with the Visual Studio Code.
Conclusion
This tutorial helps you to install Visual Studio Code on your Ubuntu 20.04 LTS system.