Installing Software on Ubuntu »How to Install Mono on Ubuntu 20.04

Mono is a platform for developing and running cross-platform applications based on ECMA / ISO standards. It is a free, open source implementation of the .NET framework from Microsoft.

This article covers the steps required to install Mono on Ubuntu 20.04.


The instructions assume that you are logged in as root or a user with sudo privileges.

Installing Mono on Ubuntu

Mono is not available in the standard Ubuntu 20.04 repositories. We will install the Mono packages from the official Mono repositories:

  1. Install the dependencies required to add new storage over HTTPS:
    sudo apt update
    sudo apt install dirmngr gnupg apt-transport-https ca-certificates software-properties-common

  2. Import the repository GPG key:
    sudo apt-key adv --keyserver hkp:// --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF

    The output should look something like this:

    gpg: key A6A19B38D3D831EF: public key "Xamarin Public Jenkins (auto-signing) <[email protected]>" imported
    gpg: Total number processed: 1
    gpg:               imported: 1

  3. Add the Mono repository to the list of system sources:
    sudo apt-add-repository 'deb stable-bionic main'

  4. Install Mono:
    sudo apt install mono-complete

    mono-complete is a metapackage that installs the Mono runtime, development tools, and all libraries.

  5. Installation may take several minutes. When finished, test it by entering the following command, which will display the Mono version:
    mono --version

    At the time of this writing, the latest stable version of Mono is

    Mono JIT compiler version (tarball Tue May 12 15:11:57 UTC 2020)
    Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors.
        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 it, Mono is installed on your Ubuntu machine and you can start using it.

Getting started with Mono

To make sure everything is set up correctly, we’re going to create a Hello World program that prints the classic “Hello World” message.

Open a text editor and create a file called hello.cs with the following content:


using System;

public class HelloWorld
    public static void Main(string[] args)
        Console.WriteLine ("Hello World!");

Use the csc compiler to build the program:

csc hello.cs

The command above will create an executable file named hello.exe.

Run the executable:

mono hello.exe

The output should look something like this:

Hello, World

To execute a program by typing its name, set the executable flag:

chmod +x hello.exe

You can now run the hello.exe file by typing:



Installing Mono on Ubuntu 20.04 is a fairly straightforward process that will only take you a few minutes.

If you run into an issue or have feedback, please leave a comment below.