Mono is an implementation for the Microsoft .NET framework that is designed to develop and manage applications written in c#. Developers can use Mono to develop cross-platform applications. Mono is an open-source application sponsored by Microsoft. Mono is based upon the ECMA standards for both Common Language Runtime and C#.
How do I Install Mono on Ubuntu 24.04
Mono application does not come preinstalled on Ubuntu, however, it can be installed manually. Furthermore, the Mono installation package does not exist in the default Ubuntu repository. To aid this issue we need to import the Mono official repository in the system and then install Mono from it. Check the following steps to install Mono on Ubuntu.
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 apt-transport-https dirmngr

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 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF

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 https://download.mono-project.com/repo/ubuntu vs-bionic main" | sudo tee /etc/apt/sources.list.d/mono-official-vs.list
Adding the official Mono repository to the system will allow you to install every edition of Mono:

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

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

Alternatively, if you are a developer and looking for the MonoDeveloper IDE then execute the following command to install MonoDevelop on Ubuntu:
sudo apt install monodevelop -y

Step 6: Verify Mono Installation
Once the Mono is installed, you can verify its installation by running the given command:
mono --version

How to Use Mono on Ubuntu 24.04?
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:
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 by specifying it to the csc command, as shown below:
csc NewFile.cs
Compiling the program will create a .exe file with the same file name:
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
How to Uninstall Mono from Ubuntu 24.04?
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 completely remove the Mono with all its packages and dependencies, execute the given command:
sudo apt remove mono* -y

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:

Once you get the directories, remove them one by one using the rm command, as shown below:
sudo rm -rf /usr/bin/mono
sudo rm -rf /usr/lib/mono
sudo rm -rf /etc/mono
sudo rm -rf /usr/share/mono
sudo rm -rf /usr/share/man
sudo rm -rf /usr/share/man/man1/mono.1.gz

Conclusion
Mono is an application development tool used to develop cross-platform applications. The Mono installation package is not in the default Ubuntu repository. To install Mono on Ubuntu, we need to add Mono’s official repository to the Ubuntu system, and then install Mono on Ubuntu. To add the official repository run echo “deb https://download.mono-project.com/repo/ubuntu vs-bionic main” | sudo tee /etc/apt/sources.list.d/mono-official-vs.list command. Then, run the sudo apt install mono-complete -y command to install Mono on Ubuntu.
Frequently Asked Questions
How do I install Mono on Ubuntu 24.04 manually?
To install Mono on Ubuntu 24.04 manually, you need to import the official Mono repository and follow the step-by-step installation process as outlined in the article.
What are the dependencies required to install Mono on Ubuntu?
To install Mono on Ubuntu, you need to install dependencies like apt-transport-https and dirmngr. These dependencies can be installed using the command 'sudo apt install apt-transport-https dirmngr.'
How can I import security keys for the MonoDevelop repository?
To import security keys for the MonoDevelop repository, you can use the command 'sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF.'
What is the procedure to add the official Mono repository to Ubuntu?
To add the official Mono repository to Ubuntu, you can run the command 'echo "deb https://download.mono-project.com/repo/ubuntu vs-bionic main" | sudo tee /etc/apt/sources.list.d/mono-official-vs.list.'
How do I update system packages after adding the Mono repository?
After adding the Mono repository to Ubuntu, you can update the system packages using the command 'sudo apt update.' This ensures that you have the latest package information.
Can I install multiple editions of Mono on Ubuntu after adding the official repository?
Yes, after adding the official Mono repository to Ubuntu, you can install multiple editions of Mono by following the installation instructions provided for each edition.
Is Mono application preinstalled on Ubuntu 24.04?
No, the Mono application does not come preinstalled on Ubuntu 24.04. You need to manually install Mono by importing the official repository and following the installation steps.
What is Mono used for in application development?
Mono is used to develop cross-platform applications written in c# that are based on the ECMA standards for the Common Language Runtime and C#. It allows developers to create applications that can run on multiple platforms.