DEV Community

Cover image for How to install DotNet Core in Manjaro Linux
Kelvin Mai
Kelvin Mai

Posted on

How to install DotNet Core in Manjaro Linux

I recently started picking up .NET Core again. I was a bit worried because I'm on a linux operating system, and state of .NET is not exactly stable. (Also the obligatory "btw I use arch" meme). The process was pretty much straightforward but I still decided to do some troubleshooting. And here is the result.

Installation process

Install dotnet-sdk and dotnet-runtime from the Manjaro package manager GUI or you can use the following terminal command. I assume this will work on vanilla Arch as well using the pacaur command instead of pacman.

pacman -S dotnet-sdk dotnet-runtime

You can check if dotnet is installed by running the version command. And it will also be important to check where dotnet is running for reasons we'll get into later.

$ dotnet --version
3.1.103
$ whereis dotnet
dotnet: /usr/bin/dotnet /usr/share/dotnet

If the location of dotnet is not /usr/share/dotnet you will have to create a new file in /etc/profile.d/dotnet.sh with the following content as root so remember to use sudo. Doing this will require you to reboot or re-login. This note was found here.

export DOTNET_ROOT=/opt/dotnet
export MSBuildSDKsPath=$DOTNET_ROOT/sdk/$(${DOTNET_ROOT}/dotnet --version)/Sdks
export PATH=${PATH}:${DOTNET_ROOT}

Then finally in ~/.bashrc file add the following lines, ~/.zshrc if you're using zsh.

# DOTNET - Required
export PATH="$PATH:/home/YOUR_USER_NAME/.dotnet/tools"
# DOTNET - Optional
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export ASPNETCORE_ENVIRONMENT=Development

And now you should be ready to start developing .NET Core applications on your Manjaro linux machine.

Links

Discussion (2)

Collapse
dsschnau profile image
Dan Schnau

Hey Kelvin, thanks for typing this up. I'm playing with Manjaro Linux tonight.

I went to run my .net 5 app and got a weird error. It turned out there was one more package I needed to install to run ASP.NET applications.

pacman -S aspnet-runtime

More info at this Stack Overflow post: stackoverflow.com/questions/663014...

Collapse
rgarcia profile image
Robert D. Garcia

Nice post, worked perfect.