How to Install and Use Mono on Debian 11

Mono Framework is an open-source software framework that can be used to create all kinds of applications incl. games.

Mono Framework is dependency-free (No C++ compiler required) and compatible with Windows, Linux, Mac OS X, and FreeBSD.

Mono Framework started as a fork of Microsoft’s .Net Framework v1.0 but now has grown to more than an alternative for it, like more aimed at game development (due to the fact it uses GDI + natively).

The framework currently includes support for C#, VB.NET, Boo, Python, Ruby, and others.

For example: using MonoDevelop with Mono Framework you can write code in a scripting language like Python and then when you want to add logic to your code in more popular languages (like C# or VB.NET) you can do that with Mono Develop, this is perfect for Designers who don’t know any programming language (or lazy programmers 🙂

In Linux, Mono Framework provides the means to compile applications that are compatible with the free software Mono runtime.

Mono Framework does not force programmers to use certain programming patterns, so it is more of a tool than an enabler of development. Because of this flexibility, it has been adopted by both open-source projects and commercial companies.

If you are looking for a guide on how to install Mono Framework on Debian 11, look no further! This guide will take you through the steps necessary to get Mono Framework installed on your Debian 11 machine.


In order to install Mono Framework on Debian 11, you will need:

  • A Debian 11 machine with root access
  • An internet connection SSH client (such as PuTTy)
  • Basic knowledge of the Linux operating system.

Updating your Debian 11 machine

The first step in installing Mono Framework on Debian 11 is to make sure that your machine is up-to-date. You can do this by running the following command.

sudo apt update && sudo apt upgrade -y

Once the update is complete, run the command below to install the required software for Mono Framework. dirmngr is used to manage the certificates that are installed on your machine. gnupg is used to encrypt and sign files and communications. apt-transport-https is used to download packages from Debian repositories that use SSL/TLS. ca-certificates is used to provide a list of trusted Certificate Authority (CA) certificates.

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

After installing the software, we need to refresh our package database.

sudo apt update -y

Installing Mono Framework on Debian 11

Now that your machine is up-to-date, you can now proceed with the installation of Mono Framework.

First, you have to import the GPG repository key for Mono. This key is used to sign the Mono Framework packages.

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

apt-key is the tool used for managing apt keys. adv means that it should be run in advanced mode (in this case to import a key).

–keyserver hkp:// tells APT to look on the Ubuntu keyserver using HTTPS to find the GPG key. This is provided by Canonical and should always be used when adding new keys to your system.

–recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF retrieves the Mono Framework GPG key from the Ubuntu keyserver.

Once the key is imported, you can add the Mono Framework repository as follows:

sudo sh -c 'echo "deb stable-bullseye main" > /etc/apt/sources.list.d/mono-official-stable.list'

sh -c is the shell command to execute a command. In this case, we are creating a file /etc/apt/sources.list.d/mono-official-stable.list by first writing the string echo “deb stable-bullseye main” > and then executing it.

/etc/apt/sources.list.d is the directory where you should put this file. The name of the file ( mono-official-stable.list ) can be anything you want, but it’s best to use the same name as the repository to avoid any confusion.

The next step is to update your machine’s list of packages.

sudo apt update -y

Run the command below to check if the Mono Framework packages are available in the Debian repository. mono-runtime is the main package in Mono Framework which enables you to run programs written in C# or any other CLR language, such as Microsoft .NET Core.

sudo apt-cache policy mono-runtime

This command will show you the following output.

Mono Runtime

Finally, run the following command to install Mono Framework. mono-complete is the package that contains everything you need to develop an application using the Mono Framework.

sudo apt install mono-complete -y

Run the command below to check the installation.

mono --version

You should see the following output.

Check Mono version

Creating a Mono Framework Application

Now that Mono Framework is installed on your machine, you can create a new application to test it. We will create a simple hello world application that will print Hello World on the terminal.

First, create a directory where your application will be stored.

cd && mkdir hello

Now, move into the directory you just created.

cd hello

Create a new file called main.cs using the nano text editor. You can use any text editor, but it is recommended to use nano, because it does not require any additional packages to be installed.

sudo nano main.cs

main is the name of the file, and .cs is the extension. cs stands for C Sharp, which is the language that the Mono Framework uses.

Next, populate the file with the following code.

using System;

public class HelloWorld
  public static void Main(string[] args)
    Console.WriteLine ("Hello World, this just a sample provided by Mono Framework installation guide!");


using System ; is the namespace that contains all the classes needed to execute Console.WriteLine.

public class HelloWorld; starts a new class called HelloWorld.

public static void Main(string[] args); is the main() method of the HelloWorld class. This is where the code will execute.

Console.WriteLine(“Hello World, this is just a sample provided by Mono Framework installation guide!”); prints “Hello World” on the terminal.

Save and close the file by pressing CTRL+X, Y, and ENTER.

Now, compile the code using the Mono compiler.

csc main.cs

csc is the Mono compiler. main is the name of the file that you are compiling, and .cs is the extension. main.cs is the argument of the csc command. This will create a new file called main.exe, which is the executable file of your application.

The following output will be displayed.

Compile Mono App

Now, run the executable file by using the mono command.

mono main.exe

You should see “Hello World” printed on your terminal because that is what was written in the main() of your application. This shows that everything is working fine with Debian 11 and the Mono Framework. Congratulations!

Sample output:

Run Mono app on Debian


In this guide, you have learned how to install the Mono Framework on Debian 11. You have also seen a simple example of how to create a Hello World application.

For more information on the Mono Framework, please visit its official Mono website.