How to Install Mono on Debian

Debian Mono C#

Mono is a free and open-source .NET Framework-compatible, cross-platform development framework. It implements Microsoft’s .NET legacy for several platforms using a single codebase, including Windows, macOS, and Linux. Mono can be thought of as a toolkit working much like the Microsoft .NET Framework does, however it is released as Free and open-source software under the MIT license rather than being proprietary software.

The main goal of Mono is to allow for the creation of .net applications on different platforms without restrictions from other toolsets. This includes the same DLL file format so that no code has to be rewritten for new platforms and the same infrastructure for executing .NET applications so that the same APIs can be used.

Mono can be used to create applications for the following platforms: Windows, Mac OS X, iOS, and Android. It also includes support for web applications, web servers, and CLI applications on Linux. The Mono Framework has been used to support enterprise, retail, and field services applications. Mono has been used for developing applications for the following purposes:

The Mono project was started in 2002 by Miguel de Icaza and was formally launched on November 15, 2003. The initial release of the Mono Runtime was not free software but offered only a Windows installer. This condition was removed in 2005 with the first commercial version. Contributions took another year to convert the C# compiler source code into the general public’s appreciation when it was released as a free software download on December 6, 2006. However, work to allow cross-platform development continued, and on February 6, 2008, the first stable release of the Mono CLI was made.

Are you a .NET developer looking to port your existing C# application to Debian Linux? Or would you like to start developing native iOS apps for your business? If so, you need to install Mono on your Debian Linux machine.

This guide will show you how to install Mono Framework on your Debian 10 Linux. After you have installed it, we will show you how to create a simple hello world C# application to check how Mono Framework works on Debian.


To install Mono on Debian, you will need to have:

  • A Debian 10 Linux machine with root user access
  • A working internet connection to download the package installer.
  • A text editor, like vim or nano.

Updating Your System

Before you begin the installation of Mono, it is recommended that you update your system.

1. Execute the following command to update your system.

sudo apt update && sudo apt upgrade -y

Once the update process completes, run the command below to install the required dependencies. Some packages are required to install Mono because they are the tools that Mono uses. There are several ways in which you can install these packages. Use a package manager. This is the easiest way to install required dependencies, as they will be compatible with your distribution’s package manager and can be installed automatically.

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

tolist c#

Installing Mono Framework on Debian

Now that you have the required packages, follow the steps below to install Mono Framework on your Debian Linux machine.

The base Debian 10 repositories do not include any Mono package by default, so to install Mono, you need to add a third-party repository first. This example uses the Mono repository from its developer.

1. Run the sudo apt-key adv command below to add the GPG repository key to your APT. The package manager uses a repository key to authenticate the packages you intend to install. It ensures that you receive a package from a trusted source and prevents any malicious packages from being installed on the Debian 10 machine.

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

2. Once you’ve run the above command and successfully added the GPG key, run the command below to add the necessary package repository for installing Mono on Debian to your system sources’ list.

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

3. After adding the Mono repository, run the apt update command to refresh the package list with the new repository information and get the latest packages available.

sudo apt update -y

4. Next, run the sudo apt-policy mono-runtime command to check if Mono is available in your repository. The output below has no missing packages. But you should review the result of this command carefully and install any missing packages listed there.

sudo apt-policy mono-runtime

Sample output:

5. At this point, you are ready to install Mono. Run the apt install below command to get started.

sudo apt install mono-complete -y

The package manager will now download and install Mono Framework on your Debian machine, and a new binary called mono will also be installed. mono-complete is a meta package that is a complete set of tools. When you run the command sudo apt install mono-complete , it will install several packages, including:

  • mono-common – Mono base binaries and libraries.
  • mono-dbg – Mono debugging symbols and libraries.
  • mono-devel – Development files needed to compile applications with Mono. This includes the compiler, linker, C# compiler infrastructure, build system and GUI toolkits, and XML parsing libraries.

6. Once the installation has finished, run the command mono –help to check out the Mono Help menu.

mono --help

mono is a microsoft. net framework alternative

7. You can check out the Mono version that you have installed by running the following command.

mono --version

Testing Mono on Debian

Now that you have the Mono framework installed on your Debian Linux machine, you can create a very simple hello world C# application.

A hello world C# application is a simple program designed to introduce you to C# programming, and more specifically, the features required for compiling a program. It’s often your first exposure when learning a new language or framework.

1. Run the following command to create a new directory named hello-world, in which we will place our hello world c# application.

mkdir hello-world

2. Run the command below to move into the newly-created directory and create a new text file called helloworld.cs. This file will be our first C# application for the Mono Framework. This is a C# source code file containing our hello world C# application. This application will print the “Hello, World!” string to the console when the program is run. Furthermore, it defines the Main method, which tells the C# compiler where to start executing our program.

cd hello-world && sudo nano helloworld.cs

3. Copy and paste the following code into the created helloworld.cs file. Once you’re done, save the file and exit from the editor.

using System;
public class helloworld
public static void Main(string[] args)
Console.WriteLine ("Hello World! This sample provided by Mono FrameWork!");


  • using System; is used to import the System namespace, which holds the objects used by our program.
  • public class HelloWorld is a class that defines an object that consists of data and methods.
  • public static void Main is the entry point for a C# program and it tells the compiler where to start executing your application code. This is the command syntax to create a new console application.
  • Console.WriteLine(“”); is used to print the Hello World string to the console when the program runs.

4. Now that we have the source code for our hello world c# program, we need to compile it into an executable. Run the following command in the root of the directory that contains the helloworld.cs file.

csc helloworld.cs

This command will compile your C# application into an executable called “helloworld.exe” and place it in your current directory.

5. Run the ls command to list the contents of your current directory, and you should be able to see the “helloworld.exe” executable file listed there.

ls -la

6. Finally, we need to run this program on our Debian machine in order to test it out and make sure that everything is working properly. Use the mono command from your shell to run the helloworld.exe application that was created.

mono helloworld.exe

You will get the following output. Congratulations! You’ve successfully installed the Mono framework and created your first hello world application on your Debian Linux machine.


This guide taught you how to install Mono on Debian 10 and create your first hello world C# application. With this, you have a solid foundation to build Mono applications on every operating system that supports Linux. Thank you for your time, and happy coding! See also Microsoft net framework download for Windows.

Categorized as Debian