Skip to content

Instantly share code, notes, and snippets.

@ramonsmits
Last active April 11, 2024 23:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ramonsmits/b15d97965bcfacc19920be2e84b49c4e to your computer and use it in GitHub Desktop.
Save ramonsmits/b15d97965bcfacc19920be2e84b49c4e to your computer and use it in GitHub Desktop.
Install .NET 8 on Raspberry pi

Install .NET 8 on Raspberry pi

Install .NET via the following script:

1. Perform dry run and review envvar DOTNET_INSTALL_DIR

I advise to first do a dry run and to enable verbose mode to review if envvar DOTNET_INSTALL_DIR is set correctly:

curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version latest --verbose --dry-run

Note: Preview must include the full preview release label like 8.0.100-rc.1.23463.5

2. Set DOTNET_INSTALL_DIR if needed

Inspect the output and validate the install path. You can override this as listed in the script its help:

export DOTNET_INSTALL_DIR=/opt/dotnet

I already had older SDK's installed in /opt/dotnet but the script will not add new SDK's to that path automatically although the DOTNET_ROOT envvar already points to this path.

3. Perform actual install

Run the script but now without --dry-run:

Latest

curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version latest --verbose

4. Review installed SDK's

Review the SDK's after installation:

dotnet --list-sdks

5. Remove old SDK's

You can easily remove SDK's by removing the corresponding folders:

sudo -s
cd DOTNET_INSTALL_DIR
rm -r sdk/$version
rm -r shared/Microsoft.NETCore.App/$version
rm -r shared/Microsoft.AspNetCore.All/$version
rm -r shared/Microsoft.AspNetCore.App/$version
rm -r host/fxr/$version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment