How to install visual studio code on Fedora

Hi,

I’m trying to install Visual Studio Code. When I run sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc, I receive “import read failed”. Are there any steps prior to this that I must complete to get this command to work or does anyone know why I’m receiving this error?

I’m new to Qubes and Linux. Any help would be appreciated.

You are running the command in TemplateVM? It has no access to internet so this import will not work.

  • You could enable internet access for this template but it is not advised.
  • You can use snap to install code but I find it unreliable and snaps can brake in time. guide
  • I use flatpak to install code. Plus of this solution is that you can limit access that code have to your VM. And VS code is known for spying on its users.
    On minus side is that you have to manually run flatpak update on AppVM.

if you decide to use flatpak here are the commands:

# Template VM
sudo dnf install flatpak

# AppVM
flatpak remote-add --if-not-exists --user flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak remote-add --if-not-exists --user fedora oci+https://registry.fedoraproject.org
flatpak install --user -y flathub com.github.tchx84.Flatseal
flatpak install --user -y flathub com.visualstudio.code

Flatseal is not required but I recommend to use it to tighten flatpak security.