DEV Community

Cover image for How to Install & run Visual Studio Code on Ubuntu Server
David
David

Posted on

How to Install & run Visual Studio Code on Ubuntu Server

Visual Studio Code is a highly versatile and user-friendly cross-platform Integrated Development Environment (IDE) that seamlessly operates on a wide range of operating systems including Windows, Linux, and MacOS. This remarkable software is not only incredibly easy to install and run on the desktop variants of these operating systems, but it also offers a seamless and hassle-free experience. However, when it comes to working on a server operating system, the process of installing and configuring Visual Studio Code may pose some challenges and require a bit more effort and technical expertise.

There are basically two approaches to do so.

  1. To install Visual Studio Code on Ubuntu Server
  2. To install VS Code Server on Ubuntu server, and then remote into Ubuntu server to get the graphical UI from another PC or desktop/laptops right within a Web browser

In this article, I am focusing on the 2nd approach, since this is much more simpler, popular, less error-prone and much quicker to get it working for us.

To install, run the below code in your Ubuntu server terminal:

sudo apt update
curl -fsSL https://code-server.dev/install.sh | sh
Enter fullscreen mode Exit fullscreen mode

To start VSCode server, run the below code in your Ubuntu server terminal:

code-server
Enter fullscreen mode Exit fullscreen mode

Start Code Server

After running the code-server app above, you will see below prompts, by clicking the link and opening it in your browser, you will see that you almost get a brand new VSCode working in your browser!

Code Server password

The default password can be shown by running below commands in terminal:

nano ~/.config/code-server/config.yaml
Enter fullscreen mode Exit fullscreen mode

You can also set the IP address and the port therein as well.

Input the password and click Submit button to proceed:

  • You can open a file
  • You can open a folder
  • Change the editor theme
  • You can install the plugins, get themes, code coloring etc.

VSCode running in a browser

You got almost al functionalities just like you installed VSCode on the server!

VSCode running in a browser


Just in case you would install VSCode on the server, follow the below procedures:

sudo apt update
sudo apt install -y curl gpg software-properties-common apt-transport-https
curl -sSL <https://packages.microsoft.com/keys/microsoft.asc> | sudo gpg --dearmor -o /usr/share/keyrings/microsoft-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] <https://packages.microsoft.com/repos/vscode> stable main" | sudo tee /etc/apt/sources.list.d/vscode.list
sudo apt update
sudo apt install -y code
Enter fullscreen mode Exit fullscreen mode

Once the installation is complete, you can run Visual Studio Code by typing code in the terminal.

Top comments (0)