Get Started with .NET Core on Linux: A Quick ASP.NET Core Setup
Hey everyone! Ready to dive into the world of .NET Core on Linux? This guide will walk you through setting up ASP.NET Core on your Linux machine quickly and easily. Let’s get started!
image just illustration
Installing .NET Core on Linux (Ubuntu)¶
This guide assumes you’re using Ubuntu and the APT command-line tool. Don’t worry, it’s simpler than it sounds! We’ll cover installing the necessary components and getting your system ready for .NET Core development.
Prerequisites¶
Before we jump in, make sure you’re comfortable with:
- Running commands as a superuser (root): This means having admin privileges.
- Using package managers: APT is our tool of choice here.
If you need a refresher, plenty of online resources can help you get up to speed on these basics.
Installation Steps¶
First, grab the Microsoft package repository configuration:
wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
This command uses wget to download the necessary file. Think of wget as your trusty downloader, fetching files directly from the web.
Next, install the package you just downloaded:
sudo dpkg -i packages-microsoft-prod.deb
dpkg is the package manager for Debian and Ubuntu. This command essentially installs the Microsoft key and repository, which allows you to easily install .NET Core.
Now, update your package manager to recognize the new repository:
sudo apt update
This is like refreshing a store’s inventory – APT now knows about the .NET Core goodies available.
.NET Core Versions: Choosing the Right One¶
At the time of writing this guide, the latest .NET Core version was 5.0. While it’s generally a good idea to use the latest and greatest, for this tutorial, you’ll need .NET Core 3.1 SDK as well. This is because we’ll be using a sample application called BuggyAmb (it’s intentionally buggy for learning purposes!) which is built on .NET Core 3.1.
Don’t worry, different .NET Core versions can coexist peacefully on the same machine.
Identifying the Correct Package Name¶
.NET Core packages follow this naming format: {product}-{type}-{version}.
- product:
dotnetoraspnetcore(installingdotnetalso installsaspnetcore) - type:
sdkorruntime - version: (e.g., 5.0, 3.1, etc.)
So, to install the .NET Core 3.1 SDK, you’d use the package name dotnet-sdk-3.1.
Installing .NET Core 3.1 SDK¶
Finally, the moment we’ve all been waiting for – installing .NET Core 3.1 SDK:
sudo apt install dotnet-sdk-3.1
Type “y” and press Enter to confirm the installation. APT will download and install both .NET Core and ASP.NET Core runtimes and SDKs.
image just illustration
Verification¶
Once the installation completes, verify everything is working as expected:
dotnet --info
This command should display information about the installed .NET Core SDKs and Runtimes, including both 3.1 and any other versions you have installed.
You can also check the SDK folder directly:
ll /usr/share/dotnet/sdk
This will list the installed SDK versions.
What’s Next?¶
Now that you have .NET Core installed, you’re ready to start building amazing applications! You can explore Microsoft’s documentation, online tutorials, and various community resources to begin your .NET Core journey.
Conclusion¶
We’ve covered the basics of installing .NET Core on Linux (Ubuntu). Remember, installing the correct versions is important, especially if you’re following along with specific tutorials or working with existing projects. If you have any questions, feel free to leave a comment below. We’d love to hear your feedback and help you out! What are you waiting for? Start your .NET Core adventure today!
Post a Comment