X

Running Visual Studio Code on Linux

For my up-coming presentation “ASP.NET Core on Linux” I need Linux VM I can access with Remote Desktop to run Visual Studio Code. After hours of different problems that grew fast over my head I was able to make things work and now I have functioning VM I can use for demos. This post is short overview about what I did and it is for those readers who also want to have Linux VM with Visual Studio Code.

This post focuses on how to set up virtualized Linux environment for Visual Studio Code. I got everything running with Kubuntu after some small struggling. Why Kubuntu? Here’s my long saga in short:

  • RDC connection is way more user-friendly than Hyper-V window or some VNC window
  • xrdp works okay but not with Gnome desktop
  • xrdp works okay with xfce but Visual Studio Code has issues with it
  • Installing K on Ubuntu with Gnome ended up with errors and crashes

NB! I’m very sure I did something wrong or had not enough knowledge and skills for more complex configuring of Linux environment. If you know more or you have friend who is Linux guru then you can use perhaps some other setup of Linux environment. I’m just a happy n00bie here!

Installing Kubuntu

Let’s start with creating Hyper-V virtual machine. To save time it’s good idea to start Kubuntu download before it. I created VM with following properties:

  1. No secure boot enabled
  2. 2 virtual cores
  3. 2048 MB RAM
  4. Network switch with access to local network
  5. 15GB HDD
  6. DVD-ROM

I attached Kubuntu image as DVD, ran Kubuntu and opened VM in Hyper-V window. Installation is actually easy – it’s just stepping through some dialogs and inserting user accound information in the end. Installation went pretty fast – had time for on quick coffee and cigarette. After installation Kubuntu required installation media to be removed and VM to be restarted. If there were no issues then Kubuntu is ready to go.

Installing and configuring xrdp

As a next thing I made remote access work. It was simple process too.

  1. Open terminal and install Krfb:
        sudo apt-get install Krfb
  2. Run Krfb and configure remote access like described in official documentation page Using Desktop Sharing
  3. Install xrdp:
        sudo apt-get install xrdp
        sudo system restart xrdp
  4. Try to access VM using RDC from Windows box.

Installing .NET Core and Visual Studio Code

I installed .NET Core and Visual Studio Code.

  1. There is problem with libicu55 library that must be installed manually. For this follow steps provided by Shannon Deminick’s post Installing .NET Core 1.01 on Ubuntu 16.10.
  2. Open terminal window and type the following commands (more information is available on .NET Core homepage):
        sudo sh -c ‘echo “deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ xenial main” > /etc/apt/sources.list.d/dotnetdev.list’
        sudo apt-key adv –keyserver apt-mo.trafficmanager.net –recv-keys 417A0893
        sudo apt-get update
        sudo apt-get install dotnet-dev-1.0.0-preview2-003131
  3. Open browser, got VS Code homepage and download Ubuntu package. Make sure you save it on hard disk.
  4. In terminal window move to folder where VS Code was downloaded and run the following command:
        sudo dpkg -i vs-code-deb-file-name-here.deb
  5. Install Git using the following command:
        sudo apt-get install git

If there were no errors then Visual Studio Code should start with no issues when logged in using Remote Desktop.

Wrapping up

It was easy to get everything work once I knew what problems there are and if and how I get rid of them. But finding this out takes a lot of time if not familiar with Linux. Once everything works it is easy to make more configuration changes. Actually Linux works very okay and for Windows dudes it’s more question about finding out what things work together. Anyway my environment for ASP.NET of Linux presentation is now ready to go.

Liked this post? Empower your friends by sharing it!

View Comments (1)

Related Post