=====================
This document provides an in-depth guide to installing and using .NET 8 on Linux systems. It covers the basics of getting started with .NET 8, installation procedures for different Linux distributions, and advanced usage scenarios. The document also includes code examples and sources for further learning.
=============================
.NET 8 is a cross-platform, open-source developer platform that allows you to build many different types of applications. It provides a unified API surface for building apps on Windows, macOS, and Linux platforms.
Before installing .NET 8, ensure your Linux distribution meets the following requirements:
curl -L https://aka.ms/install-dotnet-preview -o install-dotnet-preview.shsudo bash install-dotnet-preview.sh# Create a directory for the download location and change into it
mkdir $HOME/dotnet_install && cd $HOME/dotnet_install
# Download the installation script
curl -L https://aka.ms/install-dotnet-preview -o install-dotnet-preview.sh
# Run the script with sudo
sudo bash install-dotnet-preview.sh
=====================
The following distributions are available for Linux:
We recommend installing the .NET SDK to develop and build applications, and to install one of the runtimes packages (like ASP.NET Core) to exclusively run applications.
=====================
Container images are provided for Linux (Alpine, Debian, and Ubuntu). These images can be used to deploy .NET 8-based applications in containers.
# Pull the official .NET 8 image from Docker Hub
docker pull mcr.microsoft.com/dotnet/core/sdk:8.0
# Create a new container based on the pulled image
docker run -it --rm mcr.microsoft.com/dotnet/core/sdk:8.0 /bin/bash
# Inside the container, install .NET 8 using the script
curl -L https://aka.ms/install-dotnet-preview -o install-dotnet-preview.sh
sudo bash install-dotnet-preview.sh
=====================================
If you encounter issues during installation, refer to the official .NET documentation for troubleshooting guides.
# Check if curl is available on your system
curl -L https://aka.ms/install-dotnet-preview -o install-dotnet-preview.sh || echo "curl not found"
# Run the installation script with sudo to resolve package manager issues
sudo bash install-dotnet-preview.sh
=====================
For more information on using .NET 8 on Linux, refer to the official .NET documentation:
# Create a new console application using the .NET CLI
dotnet new console -o hello-world
# Run the application using dotnet run
cd hello-world && dotnet run Hello World!
=============================
# Create a new web application using the dotnet CLI and the ASP.NET Core template
dotnet new web -o hello-web-app --template "ASP.NET Core Web App"
# Run the application using dotnet run
cd hello-web-app && dotnet run Hello World!
Sources: