Last updated:

Mono is an open-source implementation of the Microsoft .NET Framework that runs C# and other .NET Framework applications on Linux. If you also need a JVM on the same machine, see how to install Java on Ubuntu 24.04.

Quick answer

On Ubuntu 26.04 and 24.04, install Mono from Ubuntu’s own universe repository: sudo apt update, then sudo apt install mono-complete, then check it with mono --version. Compile C# with mcs and run the result with mono. No third-party repository is needed. The csc command used in older versions of this guide is not installed by the Ubuntu package, so use mcs instead.

What was tested: Method 1 was installed and run on Ubuntu 24.04.5 LTS (Mono 6.8.0.105, output shown below). The Ubuntu 26.04 package version comes from Launchpad and was not run on a 26.04 machine. Method 2 (the Mono project repository) was not run; its package host was not reachable from my test machine.

Source Release Mono version
Ubuntu universe 26.04 LTS (resolute) 6.14.1+ds2-2 (Launchpad, 29 Oct 2026)
Ubuntu universe 24.04 LTS (noble) 6.8.0.105+dfsg-3.6ubuntu2 (installed and run)
Mono project repository stable-focal suite, Ubuntu 20.04 and later 6.12.0.206 (per mono-project.com/download/stable, not run)
Advertisement

Method 1: Install Mono from the Ubuntu repository (recommended)

Mono is not installed by default, but it is packaged in the universe component of Ubuntu 26.04 and 24.04, so APT can install it directly. If APT cannot find the package, enable universe with sudo add-apt-repository universe and run sudo apt update again.

sudo apt update
sudo apt install mono-complete

mono-complete installs the runtime, the compiler and the class libraries. For compiling only, mono-devel is smaller. Verify the install:

mono --version

Expected first line on Ubuntu 24.04.5 (captured output):

Mono JIT compiler version 6.8.0.105 (Debian 6.8.0.105+dfsg-3.6ubuntu2 Sun Mar 31 02:55:28 UTC 2024)

To confirm which package source APT used, run apt-cache policy mono-complete. On 24.04 it showed noble/universe at version 6.8.0.105+dfsg-3.6ubuntu2.

Method 2: Install Mono from the Mono project repository

Use this only if you need the newer upstream release listed in the table above. The steps below follow the current instructions on mono-project.com (read 29 Oct 2026): the key goes into its own keyring file and the repository uses signed-by, instead of the deprecated apt-key. The screenshots in Steps 1 to 5 are from the original 2024 version of this guide and show the older commands, so follow the commands in the text, not the images.

Step 1: Install MonoDevelop Dependencies

In Linux, the installation of some packages depends on other packages called dependencies. So, is the case with the Mono package. To successfully install Mono on Ubuntu, we need to install the required dependencies by running the below command:

sudo apt install ca-certificates gnupg
Terminal output of sudo apt install apt-transport-https dirmngr for Mono dependencies on Ubuntu 24.04

Step 2: Import the MonoDevelop Repository Keys

Besides installing dependencies, we need to communicate with the installation server securely. To do so, import the security keys by running the below-mentioned command:

sudo gpg --homedir /tmp --no-default-keyring --keyring gnupg-ring:/usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
sudo chmod +r /usr/share/keyrings/mono-official-archive-keyring.gpg
Terminal output of apt-key adv importing the Mono repository signing key on Ubuntu 24.04

Step 3: Add the Mono Repository

Now, add the official Mono repository to the Ubuntu’s list of repositories by running the below command:

echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list

Adding the official Mono repository to the system will allow you to install every edition of Mono:

Terminal output of echo command adding the Mono official repository on Ubuntu 24.04

Step 4: Update System Packages

After adding the Mono repository to the system, update the system packages by executing the below command:

sudo apt update
Terminal output of sudo apt update after adding the Mono repository on Ubuntu 24.04

Step 5: Install Mono on Ubuntu

Once the official Mono repository is added, you can install Mono on Ubuntu by running the below command:

sudo apt install mono-complete -y
Terminal output of sudo apt install mono-complete completing on Ubuntu 24.04

Alternatively, if you are a developer and looking for the MonoDeveloper IDE then execute the following command to install MonoDevelop on Ubuntu. Many developers prefer to install Visual Studio Code on Ubuntu 24.04 for C# work instead:

sudo apt install monodevelop -y
Terminal output of sudo apt install monodevelop completing on Ubuntu 24.04

Step 6: Verify Mono Installation

Once the Mono is installed, you can verify its installation by running the given command:

mono --version
Terminal output of mono --version confirming Mono installation on Ubuntu 24.04

How to Compile and Run a C# Program with Mono

Let’s use the Mono program practically by creating a .exe file that prints out a text when gets executed. Check the following steps to use the Mono file on Ubuntu and create a program.

Step 1: Create a New C# File

First of all create a .CS (C Sharp) file using the Nano editor. To do so, first, write the nano keyword to specify the Nano editor then write the file name along with the .CS extension, as shown below:

Stuck at this step? Ask us, it is free and include the exact error.

nano NewFile.cs

Step 2: Add Code Inside the C# File

In the C# file, copy and paste the given code. This code when compiled will return the text line “This is a Mono code example” in the Terminal:

using System;
public class test
 {
     public static void Main(string[] args)
     {
        Console.WriteLine ("This is a Mono code example");
     }
 }

Once done with editing, press CTRL + O, then press Enter to save the file and exit the Nano editor.

Step 3: Compile the File

Now, compile the C# file you just edited with the Mono C# compiler, mcs, as shown below (the Ubuntu package does not include csc):

mcs NewFile.cs

Compiling creates NewFile.exe in the same folder. Running it prints the message (captured on Ubuntu 24.04.5):

Step 4: Run the .exe File

Lastly, execute the compiled program that is NewFile.exe, by specifying the program to the mono command, as shown below:

mono NewFile.exe
This is a Mono code example
Advertisement

How to Uninstall Mono from Ubuntu

Once you are done with using the Mono application, you can remove it from Ubuntu. To remove the Mono Complete package, execute the given command:

sudo apt remove mono-complete -y

This will remove all the Mono packages including runtime and IDE:

To only remove the Mono IDE from Ubuntu, then, run this command:

sudo apt remove monodevelop -y

To remove Mono together with its configuration files and the dependencies nothing else needs, purge the packages (list only the ones you installed; the shell wildcard mono* from the original guide can expand to files in your current folder, so it was removed):

sudo apt purge mono-complete mono-devel monodevelop -y
sudo apt autoremove -y
Terminal output of sudo apt remove mono removing Mono packages from Ubuntu 24.04

Now, remove the directories associated with the Mono packages to completely remove Mono from Ubuntu. To get the directories associated with the Mono package, run the given command:

sudo whereis mono

This command will get all the directories where Mono files are located:

Terminal output of sudo whereis mono showing Mono installation directories on Ubuntu 24.04

sudo whereis mono can still be useful to check that nothing is left over after the purge.

The original 2024 guide then deleted directories by hand with rm -rf, including /usr/share/man. Do not do that: it deletes the manual pages of every installed program, and apt purge already removes the files Mono installed. The screenshot below is the old manual cleanup, kept only for reference.

Terminal output of sudo rm -rf commands removing Mono directories from Ubuntu 24.04

Troubleshooting

Symptom Cause and fix
csc: command not found The Ubuntu mono packages ship mcs, not csc (confirmed on 24.04). Compile with mcs NewFile.cs.
E: Unable to locate package mono-complete The universe component is disabled or the package lists are old. Run sudo add-apt-repository universe and sudo apt update.
An application reports a missing assembly Install mono-complete; the Mono project says it resolves most “assembly not found” errors.
HTTPS requests fail inside a Mono app Install ca-certificates-mono (named on mono-project.com).
apt-key warnings or NO_PUBKEY with Method 2 Use the keyring and signed-by commands in Step 2 and Step 3 instead of apt-key.

When Mono is the right choice

Use Mono when you need compatibility with older .NET Framework or C# applications on Linux. To run a full Windows desktop program rather than a .NET assembly, you may instead want to install Wine on Ubuntu 24.04. For new cross-platform .NET projects, the modern .NET SDK may be the better choice.

If an application specifically says it needs Mono, install Mono and verify the runtime first. If it says it needs .NET 6, .NET 8, or newer, follow the .NET SDK/runtime instructions instead of assuming Mono is required.

Advertisement