How to Install Mono on Ubuntu 20.04

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. To find out more about Mono, have a look at the Mono project website.

In this article, I will show you how to install the Mono Stack and c# language runtime on Ubuntu Linux. We will be using Ubuntu 20.04 system here.

Implementation Requirements

A user account with sudo privileges.

Installing Mono on Ubuntu 20.04

By default, the Mono application is not found in the Ubuntu systems. To install Mono from the official repository follow the steps given below:

Step 1: Installing the dependencies

Let’s start off by adding new repositories over HTTPS. To do so, first update the apt repository using:

$ sudo apt update

Update packages

Now install the apt dependencies for mono by using the command:

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

Install Mono dependencies

The system might prompt to ask the user for their confirmation. Press Y and then hit enter key from the keyboard to proceed.

Installing Linux packages

Step 2: Importing GPC Key

After adding the repository users are required to extract the key and place it on the Ubuntu server.

$ sudo apt-key adv --keyserver hkp:// --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF

Import GPG Key

This way users can easily import the GPC key. The output will look like the one displayed below:

Mono GPG Key imported successfully

Step 3: Adding Mono repository

Now, to add the mono repository to the source’s list of the system, append the following command in the terminal window:

$ sudo apt-add-repository 'deb stable-focal main'

Add Mono repository

Step 4: Installing Mono

Once you have installed all dependencies of Mono, the next step is to install Mono. We will be installing mono-complete package.

Installing Mono

The complete package will begin to install when you type Y and hit the enter key from your keyboard at the prompt of the system.

Confirm package installation

The Mono runtime along with relevant tools and libraries will be installed successfully.

Verifying the Mono installation

To verify the installation process, type the following command in the terminal window:

$ mono --version

Check Mono version

You will see that the installed Mono version displayed in the output. The latest version of Mono available at the time of download was This version might vary at the time of your download.

Create a program in Mono

In this chapter. I’ll show you how to create a small C# ‘hello World’ program to test our Mono installation. Let’s create a .cs file and then save it under the name test.cs

Mono hello World program

We will be using the csc compiler to build this program.

$ csc test.cs

Compile Mono application

This command will then create a hello.exe file. Now, run this file using:

$ mono test.exe

Run compiled Mono App

The output will display Hello, World.


In this article, we saw how to install Mono on an Ubuntu 20.04 system in detail. We then verified the installation of the application and wrote a small Hello-World script to test the Mono C# compiler.