# Old NET Core Setup on Ubuntu 22

This used to be the method of setting up the dot net runtime and SDK on an ubuntu machine.

But, the Ubuntu packages for dotnet conflict with Microsoft’s, and give errors when attempting to list the runtimes that got installed.

<p class="callout info">NOTE: This old method is left, here, in case a pre-Ubuntu 22 machine needs it.</p>

<p class="callout info">NOTE: See this page for how to install .NET in Ubuntu 24: https://wiki.galaxydump.com/books/howto/page/install-dotnet-6-on-ubuntu-2404</p>

## NET Core Setup

This section is here to cover both runtime and SDK installations.

However, the steps for installing the dotnet runtime and dependencies is in a tested ansible role, docker-runtime.  
Call it from the build server to perform the tasks defined here.

These instruction were taken from here: [https://docs.microsoft.com/en-us/dotnet/core/install/linux-debian](https://docs.microsoft.com/en-us/dotnet/core/install/linux-debian)

Update packages:

```bash
sudo apt-get update
```

Install keys for Debian:

```bash
wget https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
```

Install the SDK:

```bash
sudo apt-get update &&
sudo apt-get install -y dotnet-sdk-6.0
```

Check that the SDK was installed:

```bash
dotnet --list-sdks
```

Install the runtime (this is only required if the SDK was NOT installed):

```bash
sudo apt-get update &&
sudo apt-get install -y aspnetcore-runtime-6.0
```

Check that the runtime was installed:

```bash
dotnet --list-runtimes
```

## Dotnet Cannot be Found

If you have a naked service running on Ubuntu 22, and it fails to startup, and its journalctl logs show this error:

```
.NET location: Not found
```

Be sure to check that your dotnet runtime is installed with:

```bash
dotnet --info
```

If the proper runtime is installed, your problem is likely that the Ubuntu package is hosed.  
See this for details: [https://github.com/dotnet/runtime/issues/79237#issuecomment-1342719457](https://github.com/dotnet/runtime/issues/79237#issuecomment-1342719457)

Here’s the package manager bug reference: [https://bugs.launchpad.net/ubuntu/+source/dotnet6/+bug/1999266](https://bugs.launchpad.net/ubuntu/+source/dotnet6/+bug/1999266)

To fix the problem, your dotnet application needs to be able to locate the base dotnet runtime folder.

Edit this file: /etc/dotnet/install\_location

If something is wrong, it likely points to: /usr/lib/dotnet, which is where dotnet SHOULD be installed.

But, the net6 packages are messed up, and get installed, here: /usr/share/dotnet, instead.

To fix things, edit the file (/etc/dotnet/install\_location), to point to the correct folder:

![image.png](https://wiki.galaxydump.com/uploads/images/gallery/2026-06/scaled-1680-/hD3KMiaQX2nEtHRl-image.png)

Save the change, and try to restart your naked service. It should start up, fine.