×


Install Mono on CentOS 8 - Step by Step Process ?

Mono is a cross-platform framework that is used for developing and operating various applications based on some additional specified standards. It supports .net frameworks and standard API as well as .net desktop APIs. It is an open-source and free implementation of the .net framework.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform Software Installation tasks on CentOS Linux Systems.

In this context, we shall look into how to install Mono and how to use this platform on CentOs 8.


How to install Mono on CentOS 8 ?

To proceed with this installation procedure, you should have sudo command or root privileges.

Launch the terminal from the left sidebar of your desktop Activities section and then implement the following steps.


1. Import repository's GPG key

Import the GPG key of Mono's repository on your CentOS 8 system by using the below-mentioned command:

$ sudo rpm --import 'http://pool.sks-keyservers.net/pks/lookup?op=get&search=0x3fa7e0328081bff6a14da29aa6a19b38d3d831ef'

None statement shows in output on the terminal, when you execute the above command.


2. Add Mono’s Repository on CentOS 8

Use the following command to include the Mono's repository to your CentOS 8 system:

$ sudo dnf config-manager --add-repo https://download.mono-project.com/repo/centos8-stable.repo


3. Mono Installation on CentOS 8

Once the Mono's repository is included and enabled, the following command you can use to install the Mono on CentOS 8 system:

$ sudo dnf install mono-complete

Press 'y' to confirm the remaining installation process.

Here, mono-complete is a meta-package through which you can install all required Mono's runtime development tools and libraries.


4. Check installed version

To verify the Mono installation on CentOS 8 system, use the following command to display the installed version:

$ mono --version

The output will display the installed version details on the terminal.

Now, you have been completed the Mono's installation on your CentOS 8 system. 

You can use and start Mono on your system.


How to work with Mono?

To test that all installations have been completed in the correct way. You need to build a test program to test the working of the Mono tool.

For this purpose, create a testprogram.cs file by using any text editor. 

Here, we have created testprogram.cs file using the nano text editor.

$ sudo nano testprogram.cs

Now, paste the following source code in this file:

using System;
public class testprogram
{
    public static void Main(string[] args)
    {
        Console.WriteLine ("This is My Test Program!");
    }
}

Now, compile the testprogram.cs by using the 'csc' compiler as follows:

$ csc testprogram.cs

The above command creates an executable file 'testprogram.exe'.

Run the above test program by executing the following command:

$ mono testprogram.exe


How to uninstall Mono from CentOS 8 system ?

Mono can be uninstalled from your system by running the below-given command:

$ sudo dnf remove mono


[Need urgent assistance in fixing missing packages on CentOS Linux System ? We can help you. ]


Conclusion

This article covers how to install and use Mono on CentOS 8 system. Mono is a platform for developing and running cross-platform applications based on the ECMA/ISO Standards. 

It is a free and open-source implementation of Microsoft’s .NET framework.


To Verify the installation by running the following command that prints the Mono version:

$ mono --version