How to Install Mono on CentOS 8

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.
This tutorial describes how to install Mono on CentOS 8.
Prerequisites
The instructions assume that you are logged in as root or user with sudo privileges .
Installing Mono on CentOS
The easiest and the recommended way to install Mono on CentOS 8 is to install it from Mono’s repositories. It is a relatively simple process and will only take a few minutes.
Start by importing the repository’s GPG key:
Terminalsudo rpm --import 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3fa7e0328081bff6a14da29aa6a19b38d3d831ef'On success, no output is produced.
Add the Mono repository to your system by running the command below:
Terminaldnf config-manager --add-repo https://download.mono-project.com/repo/centos8-stable.repoThe output should look something like the following:
outputAdding repo from: https://download.mono-project.com/repo/centos8-stable.repoOnce the repository is enabled install Mono:
Terminalsudo dnf install mono-completemono-completeis a meta-package that installs the Mono runtime, development tools, and all libraries.Verify the installation by running the following command that prints the Mono version:
Terminalmono --versionAt the time of writing this article, the latest stable version of Mono is 6.8.0.105:
outputMono JIT compiler version 6.8.0.105 (tarball Tue Feb 4 19:28:42 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)
That’s it. You have successfully installed Mono on your CentOS system, and you can start using it.
Getting Started with Mono
To ensure that everything is set up correctly, we’re going to build a Hello World program that prints the classic “hello world” message.
Open your text editor
and create a file named hello.cs with the following content:
using System;
public class HelloWorld
{
public static void Main(string[] args)
{
Console.WriteLine ("Hello World!");
}
}Use the csc compiler to build the program:
csc hello.csThe command above will create an executable named hello.exe.
Run the program using the command below:
mono hello.exeThe output should look something like this:
Hello, WorldIf you want to execute the program only by typing its name, you’ll need to set an executable flag :
chmod +x hello.exeYou can now run the hello.exe file by typing:
./hello.exeConclusion
The latest stable Mono release packages are available for installation from the official Mono package repository.
If you hit a problem or have feedback, leave a comment below.
Tags
Linuxize Weekly Newsletter
A quick weekly roundup of new tutorials, news, and tips.
About the authors

Dejan Panovski
Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 800+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.
View author page