How to Install Mono on Ubuntu 20.04

Install Mono on Ubuntu 20.04

In this article, we will have explained the necessary steps to install and configure Mono on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Mono is the OpenSource implementation of the Microsoft .NET software stack. It is based on ECMA/ISO standards and implements the C# programming language and the Common Language Runtime.

Install Mono on Ubuntu 20.04

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

sudo apt update
sudo apt upgrade
sudo apt install dirmngr gnupg apt-transport-https ca-certificates software-properties-common

Step 2. Install Mono on Ubuntu system.

We’ll install the Mono packages from the official Mono’s repositories:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
sudo sh -c 'echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" > /etc/apt/sources.list.d/mono-official-stable.list'

Now that Mono repository and key are added, run the commands below to finally install it:

sudo apt update
sudo apt install mono-complete

Once completed, verify it by typing the following command which will print the Mono version:

mono --version

You should see similar lines as below:

Mono JIT compiler version 6.6.0.161 (tarball Tue Feb 02 10:46:32 UTC 2021)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	Interpreter:   yes
	LLVM:          yes(610)
	Suspend:       hybrid
	GC:            sgen (concurrent by default)

That’s all you need to do to install Mono on Ubuntu 20.04 LTS Focal Fossa. I hope you find this quick tip helpful. For further reading on the Mono, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.