Categories: Ubuntu

How to Install and Use Mono on Ubuntu 22.04

Mono is a Microsoft .NET framework that is easy to use and also open source so every user can access it and download it. It is used for the development and maintenance of many applications which are written in the C sharp or any other programming language.

Ubuntu Jammy Jellyfish has been released recently which is a Linux-based operating system and widely used by the developers. The Mono can be installed on Ubuntu 22.04 by different methods which are explored in this article.

Installation of the Mono by adding the repository

This method is to download the Mono from its official repository, for which we will first import the repository key:

Sponsored
$ sudo apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF

The next step is to add the repository to the list of our Ubuntu 22.04 repositories by using the command:

$ echo “deb https://download.mono-project.com/repo/ubuntu stable-focal main” | sudo tee /etc/apt/sources.list.d/mono-official-stable.list

Third step is to update the repository of the Ubuntu 22.04 using the update command:

$ sudo apt update

Finally, we will install the Mono again using the apt package manager:

$ sudo apt install mono-complete -y

To check the version of installed Mono:

$ mono –version

Sponsored

How to use the mono on Ubuntu 22.04

To understand the usage of the Mono, we will create a C-sharp code to print “Hello! Welcome to the LinuxHint!” by creating a file, MyCode.cs using the nano editor:

$ nano MyCode.cs

Type the following c sharp code:

using System;
public class Linuxhint
{
   public static void Main(string[] args)
  {
      Console.WriteLine (“Hello! Welcome to the Linuxhint”);
  }
}

Now it saves the file, exits the editor by closing it, and compiles the file using the csc compiler:

$ csc MyCode.cs

Now with the help of the mono, we will run the executable file of the MyCode.cs:

$ mono MyCode.exe

Conclusion

Applications based on the ECMA/ISO Standards are developed and maintained by using the Mono platform. Mono is sponsored by Microsoft and is supported by different programming languages like C#, C, Python, and PHP programming languages. In this write-up, two methods have been demonstrated for the installation of the Mono in Ubuntu 22.04.

Ubuntu Server Admin

Recent Posts

Cut data center energy costs with bare metal automation

Data centers are popping up everywhere. With the rapid growth of AI, cloud services, streaming…

16 hours ago

Build the future of *craft: announcing Starcraft Bounties!

Our commitment to building a thriving open source community is stronger than ever. We believe…

16 hours ago

NodeJS 18 LTS EOL extended from April 2025 to May 2032 on Ubuntu

The clock was ticking: Node.js 18’s upstream End of Life (EOL) The OpenJS Foundation is…

16 hours ago

Native integration now available for Pure Storage and Canonical LXD

June 25th, 2025 – Canonical, the company behind Ubuntu, and Pure Storage, the IT pioneer…

2 days ago

Revolutionizing Web Page Creation: How Structured Content is Slashing Design and Development Time

Co-authored with Julie Muzina A year ago, during our Madrid Engineering Sprint, we challenged ourselves…

3 days ago

Ubuntu Weekly Newsletter Issue 897

Welcome to the Ubuntu Weekly Newsletter, Issue 897 for the week of June 15 –…

3 days ago