How To Install and Use Mono on Centos 7

In this guide, we want to teach you How To Install and Use Mono on Centos 7.

Mono is a software platform designed to allow developers to easily create cross-platform applications part of the.NET Foundation. Sponsored by Microsoft, Mono is an open-source implementation of Microsoft’s.NET Framework based on the ECMA standards for C# and the Common Language Runtime.

How To Install and Use Mono on Centos 7

To install Mono, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide on Initial Server Setup with Centos 7.

Now you can follow the steps below to complete this guide.

Install Mono Software on Centos 7

First, you need to import the GPG keys for Mono with the following command:

rpmkeys --import ""

Then, you need to add the Mono repository on Centos 7 with the command below:

su -c 'curl | tee /etc/yum.repos.d/mono-centos7-stable.repo'

Next, you need to update your local package index with the following command:

sudo yum update -y

At this point, you can use the following command to install Mono on your server:

sudo yum install mono-complete

The package mono-complete should be installed to install everything – this should cover most cases of “assembly not found” errors.

You can verify your Mono installation by checking its version:

mono --version

In your output you will see:

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

Test Your Mono Installation

At this point, that you have Mono installed on your server, you can create a test application to see that Mono working correctly on Centos 7.

First, create a file named hello.cs with your favorite text editor, here we use vi:

sudo vi hello.cs

Add the following content to the file:

using System;

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

Use CSC to build the program:

sudo csc hello.cs
Microsoft (R) Visual C# Compiler version 3.6.0-4.20224.5 (ec77c100)
Copyright (C) Microsoft Corporation. All rights reserved.

This command will build an executable named hello.exe.

Run the executable file with the following command:

sudo mono hello.exe

In your output you will see:

Hello World!

That’s it. You are Done.


At this point, you learn to Install and Use Mono on Centos 7.

Hope you enjoy it.

You may be interested in these articles:

How To Add Swap on Centos 7

Install and Configure Nagios on Centos 7

How To Install Slack on Centos 7

Install and Configure Postfix Mail Server on Centos 7

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!