.NET or .NET Core*1 is the cross-platform development framework. Microsoft provides provides it not only as packages for major Linux distros, but also binary with install script for minor distros.
As .NET is cross-platform SDK and runtime, its dependencies of other packages are pretty limited. It means, this install script supports almost all Linux distros.
Installing .NET, user can utilize its assets including NuGet Gallery*2. And if required, user can install PowerShell from there.
This post introduces installation steps of .NET and PowerShell. Although this is the case of Clear Linux, process is common for any other distros.
Install .NET LTS by using install script
Install script provided by Microsoft has various options. Setting it appropriately, user can specify target as
- channel as Current or LTS
- SDK or runtime only
- dry run, which means just run without installation
Series of commands below is for installing the latest LTS, dry run once before installation.
cd /tmp wget https://dot.net/v1/dotnet-install.sh chmod a+x dotnet-install.sh ./dotnet-install.sh -c LTS --dry-run ./dotnet-install.sh -c LTS
In the case of installing only runtime, options are set as following.
./dotnet-install.sh -c LTS --runtime dotnet --dry-run ./dotnet-install.sh -c LTS --runtime dotnet
Be careful, only runtime is not enough for PowerShell. It requires SDK.
Install PowerShell by using "dotnet" command
.NET provides "dotnet" command. One capability it provides is to access NuGet gravelly and install .NET tools there. And PowerShell is one of them.*3
In advance of installing PowerShell, environment variables below should be set at the end of ".profile".
export DOTNET_ROOT=~/.dotnet export PATH=$PATH:$DOTNET_ROOT export PATH=$PATH:$DOTNET_ROOT/tools
Then, PowerShell can be installed by using next command, and run it.
source ~/.profile dotnet tool install --global PowerShell pwsh