Set the following variables:
export DOTNET_ROOT=$HOME/.dotnet
export PATH=$HOME/.dotnet/:$PATH
export PATH=$HOME/.dotnet/tools/:$PATHSetting DOTNET_ROOT will ensure that powershell, for instance, knows where to access the dotnet runtime since it's now installed in the home-directory rather than /usr/share/dotnet. We also need to update the PATH to include the dotnet cli itself, plus any globally installed tools.
Also set these variables in your system environment variables so they're active outside your terminal session. For instance, in: /etc/profile.d/dotnet.env.
Then Download the dotnet-install.sh script:
# Download script
wget -O ~/Downloads/dotnet-install.sh https://dot.net/v1/dotnet-install.sh
# Make script executable
chmod +x ~/Downloads/dotnet-install.shInstall the latest LTS and STS versions with:
~/Downloads/dotnet-install.sh --version latest --channel LTS
~/Downloads/dotnet-install.sh --version latest --channel STSReboot your session, ensuring the DOTNET_ROOT environment variable points to $HOME/.dotnet when loaded from the system environment variables.
Install PowerShell using the dotnet tool command:
dotnet tool install --global powershellThis will install PowerShell into
$HOME/.dotnet/tools/powershell. This should already be in yourPATH.