Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Linux Distributions»Ubuntu»How to Install .NET Core (dotnet) on Ubuntu 22.04

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

    RahulBy RahulMay 25, 20224 Mins ReadUpdated:May 25, 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.

    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 .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 stating 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 installed version of .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 dependecies:

    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
    Previous ArticleHow to Install Latest Git on Ubuntu 22.04
    Next Article How to Install MariaDB on Ubuntu 22.04

    Related Posts

    How to Install Composer on Ubuntu 22.04

    Updated:June 24, 20223 Mins Read

    How to Create SFTP User in Ubuntu 22.04 (No Shell Access)

    Updated:June 14, 20224 Mins Read

    How To Install Anaconda on Ubuntu 22.04

    4 Mins Read

    How to Install Apache Kafka on Ubuntu 22.04

    Updated:June 5, 20225 Mins Read

    How To Install XRDP on Ubuntu 22.04

    3 Mins Read

    Setting Up Environment Variables on Ubuntu

    Updated:May 28, 20222 Mins Read

    2 Comments

    1. Matt on June 28, 2022 4:33 pm

      PS it may be because I am running ARM

      Reply
    2. 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

    Recent Posts
    • What is the /etc/aliases file
    • What is the /etc/nsswitch.conf file in Linux
    • How to Install Ionic Framework on Ubuntu 22.04
    • What is the /etc/hosts file in Linux
    • How to Install Angular CLI on Ubuntu 22.04
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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