Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»General Articles»How to Install Mono on CentOS 8

    How to Install Mono on CentOS 8

    By RahulMarch 2, 20204 Mins ReadUpdated:April 2, 2020

    The Mono project is sponsored by the Microsoft. Mono is a software platform designed to allow developers to easily create cross platform applications. Mono supports most the modern operating systems with 32-bit and 64-bit architecture. This tutorial will help you to install Mono on CentOS 8 Linux systems.

    Advertisement

    Useful tutorial:

    • How to Install Visual Studio Code on CentOS 8

    Prerequisites

    Login to the CentOS 8 system with sudo privileged account.

    Install Mono on CentOS 8

    First of all, install some required packages and import GPG key to your system.

    rpmkeys --import "http://pool.sks-keyservers.net/pks/lookup?op=get&search=0x3fa7e0328081bff6a14da29aa6a19b38d3d831ef"
    

    You need to add yumrepository provide by the official team. Run the following command to add Mono repository to your system based on CentOS 8 version.

    curl https://download.mono-project.com/repo/centos8-stable.repo | tee /etc/yum.repos.d/mono-stable.repo
    

    Once you added the repository, install Mono packages on your CentOS 8 system.

    sudo dnf install mono-complete mono-devel
    

    The mono-devel package is used to compile code. The mono-complete package is used to install everything on the system.

    CentOS-8 - AppStream                                                                                               24 kB/s | 4.3 kB     00:00
    CentOS-8 - Base                                                                                                    19 kB/s | 3.8 kB     00:00
    CentOS-8 - Extras                                                                                                 9.6 kB/s | 1.5 kB     00:00
    mono-centos8-stable                                                                                               4.4 MB/s | 502 kB     00:00
    Node.js Packages for Enterprise Linux 8 - x86_64                                                                   35 kB/s | 2.5 kB     00:00
    Dependencies resolved.
    ==================================================================================================================================================
     Package                          Architecture     Version                                                    Repository                     Size
    ==================================================================================================================================================
    Installing:
     mono-complete                    x86_64           6.8.0.105-0.xamarin.3.epel8                                mono-centos8-stable           7.2 k
     mono-devel                       x86_64           6.8.0.105-0.xamarin.3.epel8                                mono-centos8-stable            34 M
    Installing dependencies:
     giflib                           x86_64           5.1.4-3.el8                                                AppStream                      51 k
     libexif                          x86_64           0.6.21-16.el8                                              AppStream                     355 k
     python3-pip                      noarch           9.0.3-15.el8                                               AppStream                      19 k
     python36                         x86_64           3.6.8-2.module_el8.1.0+245+c39af44f                        AppStream                      19 k
     glib2-devel                      x86_64           2.56.4-7.el8                                               BaseOS                        425 k
     pcre-cpp                         x86_64           8.42-4.el8                                                 BaseOS                         47 k
     pcre-devel                       x86_64           8.42-4.el8                                                 BaseOS                        551 k
     pcre-utf16                       x86_64           8.42-4.el8                                                 BaseOS                        195 k
     pcre-utf32                       x86_64           8.42-4.el8                                                 BaseOS                        186 k
     python3-setuptools               noarch           39.2.0-5.el8                                               BaseOS                        162 k
     libgdiplus-devel                 x86_64           6.0.4-0.xamarin.1.epel8                                    mono-centos8-stable           194 k
     libgdiplus0                      x86_64           6.0.4-0.xamarin.1.epel8                                    mono-centos8-stable           620 k
     ibm-data-db2                     x86_64           6.8.0.105-0.xamarin.3.epel8                                mono-centos8-stable            43 k
     libmono-2_0-1                    x86_64           6.8.0.105-0.xamarin.3.epel8                                mono-centos8-stable           7.1 k
     libmono-2_0-devel                x86_64           6.8.0.105-0.xamarin.3.epel8                                mono-centos8-stable            56 k
     libmono-llvm0                    x86_64           6.8.0.105-0.xamarin.3.epel8                                mono-centos8-stable           9.8 M
     libmonoboehm-2_0-1               x86_64           6.8.0.105-0.xamarin.3.epel8                                mono-centos8-stable           7.5 M
     libmonoboehm-2_0-devel           x86_64           6.8.0.105-0.xamarin.3.epel8                                mono-centos8-stable           7.0 k
     libmonosgen-2_0-1                x86_64           6.8.0.105-0.xamarin.3.epel8                                mono-centos8-stable           8.2 M
     libmonosgen-2_0-devel            x86_64           6.8.0.105-0.xamarin.3.epel8                                mono-centos8-stable            10 k
     mono-core                        x86_64           6.8.0.105-0.xamarin.3.epel8                                mono-centos8-stable            46 M
     mono-data                        x86_64           6.8.0.105-0.xamarin.3.epel8                                mono-centos8-stable           4.4 M
     mono-data-oracle                 x86_64           6.8.0.105-0.xamarin.3.epel8                                mono-centos8-stable            84 k
     mono-data-sqlite                 x86_64           6.8.0.105-0.xamarin.3.epel8                                mono-centos8-stable            71 k
     mono-extras                      x86_64           6.8.0.105-0.xamarin.3.epel8                                mono-centos8-stable           403 k
     mono-locale-extras               x86_64           6.8.0.105-0.xamarin.3.epel8                                mono-centos8-stable           295 k
     mono-mvc                         x86_64           6.8.0.105-0.xamarin.3.epel8                                mono-centos8-stable           437 k
     mono-reactive                    x86_64           6.8.0.105-0.xamarin.3.epel8                                mono-centos8-stable           336 k
     mono-wcf                         x86_64           6.8.0.105-0.xamarin.3.epel8                                mono-centos8-stable           977 k
     mono-web                         x86_64           6.8.0.105-0.xamarin.3.epel8                                mono-centos8-stable           2.2 M
     mono-winforms                    x86_64           6.8.0.105-0.xamarin.3.epel8                                mono-centos8-stable           1.5 M
     mono-winfxcore                   x86_64           6.8.0.105-0.xamarin.3.epel8                                mono-centos8-stable           267 k
     monodoc-core                     x86_64           6.8.0.105-0.xamarin.3.epel8                                mono-centos8-stable            19 M
     mono-llvm-tools                  x86_64           6.0+mono20190708165219-0.xamarin.1.epel8                   mono-centos8-stable            18 M
     msbuild-libhostfxr               x86_64           3.0.0.2019.04.16.02.13-0.xamarin.4.epel8                   mono-centos8-stable           158 k
     msbuild                          noarch           1:16.5+xamarinxplat.2020.01.10.05.36-0.xamarin.2.epel8     mono-centos8-stable            10 M
     msbuild-sdkresolver              noarch           1:16.5+xamarinxplat.2020.01.10.05.36-0.xamarin.2.epel8     mono-centos8-stable            56 k
    Enabling module streams:
     python36                                          3.6
    
    Transaction Summary
    ========================================================================================================================================================
    Install  39 Packages
    
    Total download size: 167 M
    Installed size: 172 M
    Is this ok [y/N]: y
    

    Press y and Enter to complete the Mono installation on CentOS 8.

    Check Mono Version

    Once the installation has finished on your system. Let’s check the installed Mono version using the following command.

    mono --version
    

    Output:

    Mono 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)
    

    Run C# Example with Mono

    As you have installed Mono on your CentOS 8 system. Create a sample c# program to run with Mono. Create a Welcome.cs file and edit in your favorite text editor.

    vim Welcome.cs
    

    Add below value to file.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    using System;
     
    public class Welcome
    {
        public static void Main(string[] args)
        {
            Console.WriteLine ("Welcome to TecAdmin.net");
        }
    }

    Save file and close it. Then compile the c# program with the c# compiler using below command.

    csc Welcome.cs
    

    Once the compilation finished successfully, it will create a exe file in the local directory with the same name as script. In this case a Welcome.exe file is generated in my local directory.

    Set the exectue permission and then run the program

    mono Welcome.exe
    

    You will see the output like below screenshot:

    Install Mono on CentOS 8

    All done, You have successfully installed Mono on your CentOS 8 system. Next you may required to install Visual Studio Code on CentOS 8 Linux system.

    CentOS 8 Mono
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Error: EACCES: permission denied, scandir (Resolved)

    How To Install Python 3.11 on Ubuntu 22.04 / 20.04

    Excluding URLs from ProxyPass in Apache

    View 1 Comment

    1 Comment

    1. Frank Natoli on May 12, 2021 9:56 pm

      Sorry, the “dnf install” step fails as follows:

      Errors during downloading metadata for repository ‘download.mono-project.com_repo_centos8-stable.repo’:
      – Status code: 404 for https://download.mono-project.com/repo/centos8-stable.repo/repodata/repomd.xml (IP: 72.21.81.200)
      Error: Failed to download metadata for repo ‘download.mono-project.com_repo_centos8-stable.repo’: Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

      Suggestions?

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Error: EACCES: permission denied, scandir (Resolved)
    • How To Install Python 3.11 on Ubuntu 22.04 / 20.04
    • How to Install Python 3.11 on Amazon Linux 2
    • An Introduction to the “./configure” Command: Compiling Source Code in Linux
    • How to Install PHP 8.x on Pop!_OS
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.