Technically Impossible

Lets look at the weak link in your statement. Anything "Technically Impossible" basically means we haven't figured out how yet.

"apt install" of VSCode, Edge, and PowerShell with registering Microsoft repositories

f:id:espio999:20220104212101p:plain

Abstract

The most common package manager in Ubuntu is "apt", but VSCode is not provided there. Canonical, the operating company of Ubuntu, developed a package manager called "snap", and run as app store *1 that uses it. Although VSCode is provided here, there is an operational problem: frankly speaking, they are not serious about supporting multiple languages. Since this is off the subject, I will back to this topic at "Off topic".

Flatpak*2 is the competitor of "snap", and they also have its app store. It also provides VSCode, though adopting multiple package managers is likely to cause problems in operation and management. It is a matter of consistency, and the latter tends to bring serious problems.

  • Apps and the managers who deployed them
  • Apps deployed and their dependencies

My expectation is to manage with a single package manager, and install VSCode with "apt install". And it is possible with registering Microsoft's repository.
This post introduces its How-to.

apt-add-repository ~ apt install

First, check the official information from Microsoft. The following site shows the official Microsoft apt repositories and how to connect to them. And as the next quote indicates, Microsoft has a number of repositories under "packages.microsoft.com".

docs.microsoft.com

Note that not all supported distributions are listed here. See the current supported package repositories at https://packages.microsoft.com/.

Register the repositories of the preferred distribution (in this post, Ubuntu 20.04) as described. The site introduces commands with "curl". In case of "wget", it would be followings.

wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -
sudo apt-add-repository https://packages.microsoft.com/ubuntu/20.04/prod

Only PowerShell can be installed at this stage,
f:id:espio999:20220104183959p:plain

For VSCode and Microsoft Edge, additional repositories must be registered.

Microsoft Edge https://packages.microsoft.com/repos/edge
VSCode https://packages.microsoft.com/repos/code

Registering these repositories, target should be narrow down with options.

sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/code stable main"
sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main"
sudo apt update -y
deb [arch=amd64] only for binary package, Intel 64bit
stable only for stable distribution
main only for main category

VSCode and Microsoft Edge can be installed at this stage.
f:id:espio999:20220104184152p:plain

sudo apt install -y powershell code microsoft-edge-stable --fix-missing
apt list powershell code microsoft-edge-stable powershell

Installation results
f:id:espio999:20220104184231p:plain
f:id:espio999:20220104184244p:plain
f:id:espio999:20220104184301p:plain
f:id:espio999:20220104184311p:plain
f:id:espio999:20220104184320p:plain

Off topic - issues about multiple languages in snap package

Packages provided at Snapcraft is build by Canonical, and it brings with the catch. They lacks consideration for multi-language support, especially integration with input method as IBus and Fcitx.

Although it has been reported for several years and its solution is indicated, they had been leaving the problem.

Cannot use any input method when installed from snap · Issue #77382 · microsoft/vscode · GitHub
unable to input chinese character · Issue #96041 · microsoft/vscode · GitHub
Snap version Vscode cannot use iBus Input in Ubuntu 20.10 · Issue #115399 · microsoft/vscode · GitHub
forum.snapcraft.io