.NET Core is a powerful, open-source framework for building modern applications. Developed by Microsoft, .NET Core allows developers to create applications that can run on multiple platforms, including Windows, Linux, and macOS. This versatility makes it a popular choice for many developers around the world. With .NET Core, you can build a wide variety of applications, including web, desktop, mobile, cloud, gaming, and IoT applications.
Installing .NET on Debian 12: Step-by-Step Guide
In this guide, we’ll walk you through the steps to install .NET 8 on Debian 12, a popular Linux distribution known for its stability and security.
Prerequisites
Before we begin, make sure you have:
- A system running Debian 12.
- A user account with sudo privileges.
- An internet connection.
Step 1: Update Your System
First, update your system to ensure all packages are current. Open a terminal and run the following commands:
sudo apt update
sudo apt upgrade -y
Step 2: Install Required Dependencies
.NET Core requires some dependencies to run. Install them by running:
sudo apt install -y apt-transport-https ca-certificates gnupg
Step 3: Add Microsoft Package Repository
Next, you need to add the Microsoft package repository to your system. This will allow you to download and install .NET 8.
- Download the Microsoft signing key:
wget https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
- Install the downloaded package:
sudo dpkg -i packages-microsoft-prod.deb
- Update the package list:
sudo apt update
Step 4: Install .NET SDK
Now, you can install the .NET SDK. The SDK includes everything you need to build and run .NET applications.
- Install the .NET SDK:
sudo apt install -y dotnet-sdk-8.0
- Verify the installation:
dotnet --version
You should see the version number of .NET 8 displayed.
Step 5: Install .NET Runtime (Optional)
If you only need to run .NET applications, you can install just the runtime.
- Install the .NET Runtime:
sudo apt install -y dotnet-runtime-8.0
- Verify the runtime installation:
dotnet --list-runtimes
This command should list the installed runtimes, including .NET 8.
Step 6: Create a Simple .NET Application
Let’s create a simple .NET application to verify that everything is working correctly.
- Create a new console application:
dotnet new console -o MyFirstApp
- Navigate to the application directory:
cd MyFirstApp
- Run the application:
dotnet run
You should see the output “Hello, World!” in your terminal.
Conclusion
Congratulations! You have successfully installed .NET 8 on Debian 12. You are now ready to start building and running .NET applications. If you encounter any issues, refer to the official .NET documentation for more help.