1. Offline installation (recommended)
1. Download the installation package
Official website download address
2. Installation
(1) Upload the installation package to the specified directory on the linux server, such as: /root/dotnet/sdk, and run the following command to decompress it
# cd /root/dotnet/sdk
# mkdir -p $HOME/dotnet && tar zxf dotnet-sdk-6.0.100-linux-x64.tar.gz -C $HOME/dotnet
(2) Set environment variables (temporary)
export DOTNET_ROOT=$HOME/dotnet
export PATH=$PATH:$HOME/dotnet
(3) Set environment variables (permanent)
Modify the profile file
vim /etc/profile
Add to the file:
export DOTNET_ROOT="root/dotnet"
export PATH=root/dotnet:$PATH
or
export DOTNET_ROOT=$HOME/dotnet
export PATH=$PATH:$HOME/dotnet
Execute the following command to make the environment variable take effect
source /etc/profile
(4) View the sdk installation version
dotnet --list-sdks