How to Install Mono Framework on Linux Mint 20

Mono is a free, open-source development platform based on the .NET Framework. Mono’s .NET implementation is based on the ECMA/ISO standards for C# and the Common Language Infrastructure. The Mono project has been in development for over a decade and continues to feature in many applications.

In the following tutorial, you will know how to install and configure Mono on your Linux Mint 20 system.


Update Operating System

Update your Linux Mint operating system to make sure all existing packages are up to date:

sudo apt update && sudo apt upgrade -y

The tutorial will be using the sudo command and assuming you have sudo status.

To verify sudo status on your account:

sudo whoami

Example output showing sudo status:

[joshua@linuxmint ~]$ sudo whoami

To set up an existing or new sudo account, visit our tutorial on Adding a User to Sudoers on Linux Mint.

To use the root account, use the following command with the root password to log in.


Install Required Dependencies

The following dependencies will be required to successfully install and run Mono on your system. Open your command terminal and run the following command to install and check if they are installed.

sudo apt install dirmngr gnupg apt-transport-https ca-certificates -y

Import Mono GPP Key & Repository

The first part of the installation will be to import the GPG key and repository. By default Linux Mint nor Ubuntu have Mono in the repositories, so installing the official repository will mean you will not only have Mono but the latest version available at all times.

First, import the GPG key:

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

Next, import the Mono repository:

sudo sh -c 'echo "deb [arch=amd64] stable-focal main" > /etc/apt/sources.list.d/mono-official-stable.list'

Note, this is the Ubuntu Focal repository. However, it works for Linux Mint as it’s based on this release of Ubuntu.

Now with the GPG key and Mono repository added, update your repository list to reflect the changes.

sudo apt update

Install Mono Framework

Now that you have the repository successfully installed, it is time to install Mono itself. To do this, you will use the following apt install command.

sudo apt install mono-complete -y

Next, verify the installation and the version installed.

mono --version

Example output:

An alternative to verify the installation of the Mono Framework is to use the apt-cache policy command.

sudo apt-cache policy mono-complete

Example output:

Create a Test Application

To check that Mono is working, you will create a small program with the famous catchphrase (Hello World). You will do this by opening your favorite text editor to accomplish this. For the guide, we will use the nano text editor.

Open your terminal, and create a .cs file as below.

sudo nano helloworld.cs

Next, enter the following programming code:

using System;

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

Once done, CTRL+O to save, then  CTRL+X to exit.

Now you can compile the code. To do this, execute the following command:

mono-csc helloworld.cs

The compiler command will build an executable named helloworld.exe, once complete you can run this to see the code in action by executing the following command:

mono helloworld.exe

You will then get the classic output:

How to Install Mono Framework on Linux Mint 20

An alternative way to execute the program is by making the file executable by itself. This can be done by changing the permissions of the file as below:

chmod +x helloworld.exe

Now you can run the file on its own by executing the following command:



How to Install Mono Framework on Linux Mint 20

You should receive the Hello World output again. If you have trouble at any time, you may need to set the $PATH variable.

export PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"

How to Update Mono

To update Mono is relatively easy and is done with a simple command in your terminal. Type in the following:

sudo apt update

If an update is available, use the standard apt upgrade command.

sudo apt upgrade

How to Remove (Uninstall) Mono

If in the future you no longer require Mono on your Linux Mint operating system, run the following command:

sudo apt autoremove mono-complete --purge -y

You will then get the following result that Mono has been successfully removed from your system.

See also
How to Install Microsoft Edge on Rocky Linux EL9 or EL8

Comments and Conclusion

In the tutorial, you have learned to install the Mono framework and execute your first small program on your Linux Mint system.

Overall, Mono is a terrific option for developers that is cross-platform with not having to pay for software licenses or vendor lock-ins along with being open-source. The only downside to Mono is that sometimes its API cannot be as up to date immediately when a new version of the .NET framework is released.

For more information on using Mono, visit the official documentation

1 thought on “How to Install Mono Framework on Linux Mint 20”

  1. Se instaló perfectamente pero en ninguna parte se muestra como se corre el programa en modo gráfico, ya que no añade ningún ícono al escritorio. Saludos


Leave a Comment

Share to...