Mono provides a complete implementation of the Common Language Runtime that can run class libraries or components that target the actual Microsoft .NET runtime. These class libraries are compatible with any system that has the latest version of Mono installed, including Linux vps server, Mac OS X, Windows, Solaris, BSD and more. In this article, we are going to teach you How to Install Mono on AlmaLinux.

Introduction to Mono

Mono is a free, open-source platform for developing and running multi-platform applications and libraries based on ECMA/ISO standards and implementation of the Microsoft .NET framework. It should be noted that Mono is mostly used to develop multi-platform tools and applications integrated with .NET technologies. Mono provides .NET framework compatibility for non-Windows platforms at both the library level and at the programming interface level. The Mono project has been in development for over a decade and continues to feature in many applications.

Prerequisites to Install Mono on AlmaLinux

– A user account with sudo privileges or root access

– AlmaLinux system

Installing Mono on AlmaLinux

You must be logged in as a non-root user with sudo privileges. To install Mono software on AlmaLinux 8, follow the steps below in order.

Update the local package list with the following command:

sudo dnf update

Enter the GPG key of the tank with the following command:

sudo rpmkeys --import "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF"

Successfully no output is generated.

Now, you must add the Mono repository to AlmaLinux 8:

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

In the output you will see the following:

Output
Adding repo from: https://download.mono-project.com/repo/centos8-stable.repo

In this step, install the Mono software on AlmaLinux 8 using the following command:

sudo dnf install mono-complete

Confirm the installation with the Mono version as follows:

mono --version

In the output you will see the following:

Output
Mono JIT compiler version 6.12.0.107 (tarball Wed Dec 9 21:44:58 UTC 2020)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
Interpreter: yes
LLVM: yes(610)
Suspend: hybrid
GC: sgen (concurrent by default)

You have successfully installed Mono on AlmaLinux 8. Start using it now.

How To Use Mono Software on AlmaLinux

To make sure the Mono is setup correctly on the server, create a Hello World application that displays the classic “hello world” message. Create a file called hello.cs with a text editor, we used vi in the following command:

sudo vi hello.cs

Put the following content in the desired file:

using System;

public class HelloWorld
{
public static void Main(string[] args)
{
Console.WriteLine ("Hello World!");
}
}

Save and close the file when done. Now use the CSC compiler to build the program:

csc hello.cs

The following command creates an executable program called hello.exe. Run the app with Mono on AlmaLinux 8:

mono hello.exe

In the output you will see the following command:

Output
Hello World!

If you want to run the program just by typing its name, set the executable flag. To do this, use the following command:

chmod +x hello.exe

Now run the hello.exe file with the following command:

./hello.exe

Conclusion

In this article, you learned how to install Mono on Almalinux 8. After installing Mono, you also learned to use it by printing the hello world message. I hope this article was useful for you. Leave your comments with us through the form below.

Rate this post