Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Linux Distributions»Ubuntu»How to Install .NET Core (dotnet) on Ubuntu 22.04

    How to Install .NET Core (dotnet) on Ubuntu 22.04

    By RahulMay 25, 20224 Mins ReadUpdated:August 4, 2022

    Microsoft .NET Core is a free and open-source software framework designed with keeping Linux and macOS in mind. It is a cross-platform successor to .NET Framework available for Linux, macOS, and Windows systems. .NET Core 6 is an LTR release that will support for the next 3 years. It also supports hot reload and better git integration with Visual Studio 2022.

    Advertisement

    The Ubuntu 22.04 users can only install .NET Core 6.0. It doesn’t support .NET Core 3.1 or 2.0 since the distro only supports OpenSSL 3.

    The developers should install the .NET Core SDK on their system and the staging or production server needs the .NET Core runtime only. This tutorial walks through installing the .NET core on Ubuntu 22.04 LTS Linux system. You can install .NET Core SDK or set up the runtime environment on your system.

    Step 1 – Enable Microsoft PPA

    First of all, enable the Microsoft Apt repository on our Ubuntu systems. The Microsoft team provides a Debian package to set up the PPA on the Ubuntu system.

    Open a terminal on your Ubuntu system and configure Microsoft PPA by running the following commands:

    wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb 
    sudo dpkg -i packages-microsoft-prod.deb 
    

    Above commands will create a /etc/apt/sources.list.d/microsoft-prod.list file in your system with the required configuration.

    Let’s begin the .NET core installation on the Ubuntu system.

    Step 2 – Installing .NET Core SDK on Ubuntu

    .NET Core SDK is the Software development kit used for developing applications. If you are going to create an application or make changes to an existing application, you will require a .net core SDK package on your system.

    To install .NET Core SDK on Ubuntu 22.04 LTS system, execute the following commands:

    sudo apt install apt-transport-https 
    sudo apt update 
    sudo apt install dotnet-sdk-6.0 
    

    Press “y” for any input prompted by the installer.

    That’s it. You have successfully installed .Net core SDK on your Ubuntu system.

    Step 3 – Installing .NET Core Runtime on Ubuntu

    .NET Core Runtime is required for the system, where you only need to run the application. For example, production or staging environments are required to run applications only.

    To install .NET Core Runtime only on Ubuntu 22.04 LTS system, type:

    sudo apt install apt-transport-https 
    sudo apt update 
    sudo apt install dotnet-runtime-6.0 
    

    Press “y” for any input prompted by the installer.

    That’s it. You have successfully installed the .NET core runtime on your Ubuntu system.

    Step 4 – Check .NET Core Version

    You can use dotnet command line utility to check the installed version of the .NET Core on your system. To check dotnet version, type:

    dotnet --version
    

    Output:

    Installing Dotnet Core on Ubuntu 22.04
    Checking .NET Core Version

    Step 5 – (Optional) Create a Sample Application

    Let’s create a sample application with dotnet core on your Ubuntu system. Create a new console application with the command:

    dotnet new console -o HelloWorld
    

    This will create a .Net core application on your system. This will create a directory named “helloworld” under the current directory. You can change to this directory and start working on your application.

    cd  HelloWorld
    

    Make your changes to the application and execute the below command to run this application.

    dotnet run
    

    You will see the following output as a result.

    Install  .NET Core on Ubuntu 22.04
    Running .NET Core HelloWorld Application

    Remove or Uninstall .NET Core on Ubuntu

    In case, the .NET Core is not more required on your system. You can uninstall it from the system with the following commands.

    sudo apt remove --purge dotnet-sdk-6.0 dotnet-runtime-6.0 
    

    Also, remove unused packages installed as dependencies:

    sudo apt auto-remove 
    

    Conclusion

    In this tutorial, you have learned to install .NET Core SDK and Runtime on a Ubuntu 22.04 LTS (Jammy Jellyfish) Linux system. Now, you may like to install Visual Studio Code or Sublime Text editor on your Ubuntu desktop systems.

    .NET Core dotnet dotnet core Ubuntu 22.04
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    How to Setup DKIM (DomainKeys) with Postfix

    A Step-by-Step Guide to Installing OpenDKIM with Postfix on Ubuntu – Unleash the Power of DKIM!

    How to Install Dotnet Core on macOS

    How to Install .NET Core on macOS

    How to Install Composer on Ubuntu 22.04

    How to Install Composer on Ubuntu 22.04

    View 3 Comments

    3 Comments

    1. Khai Nguyen on September 27, 2022 7:45 am

      This is how to install netcore 6 by script
      “`
      sudo apt remove ‘dotnet*’
      sudo apt remove ‘aspnetcore*’
      sudo rm /etc/apt/sources.list.d/microsoft-prod.list
      sudo apt update
      sudo apt install dotnet-sdk-6.0
      “`

      Reply
    2. Matt on June 28, 2022 4:33 pm

      PS it may be because I am running ARM

      Reply
    3. Matt on June 28, 2022 4:33 pm

      Doesn’t work yet:

      E: Unable to locate package dotnet-runtime-6.0
      E: Couldn’t find any package by glob ‘dotnet-runtime-6.0’

      It isn’t in the Microsoft repos yet.

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Error: EACCES: permission denied, scandir (Resolved)
    • How To Install Python 3.11 on Ubuntu 22.04 / 20.04
    • How to Install Python 3.11 on Amazon Linux 2
    • An Introduction to the “./configure” Command: Compiling Source Code in Linux
    • How to Install PHP 8.x on Pop!_OS
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.