Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Linux Distributions»Debian»How to Install Mono on Debian 10/9

    How to Install Mono on Debian 10/9

    RahulBy RahulJanuary 6, 20203 Mins ReadUpdated:April 1, 2020

    The Mono project is sponsored by the Microsoft. It is an open source, cross platform implementation of Microsoft .NET Framework. Mono supports most the modern operating systems with 32-bit and 64-bit architecture. This tutorial helps you with step by step to install Mono on Debian 10 and Debian 9 systems.

    Useful tutorial:

    • How to Install Visual Studio Code on Debian

    Prerequisites

    SSH or Shell access to Debian system with sudo privileged account.

    Install Mono on Debian

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

    sudo apt install gnupg ca-certificates
    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys D3D831EF
    

    Now, add Apt repository on your system provide by the official website. Use one of the following commands to add Mono repository to your system based on Ubuntu version.

    ### Debian 10 (Buster) 
    
    echo "deb https://download.mono-project.com/repo/debian stable-buster main" | sudo \
       tee /etc/apt/sources.list.d/mono-stable.list
    
    ### Debian 9 (Xenial) 
    
    echo "deb https://download.mono-project.com/repo/debian stable-xenial main" | sudo \
       tee /etc/apt/sources.list.d/mono-stable.list
    

    Once the repository is added. Update the apt cache and install Mono packages on your Ubuntu system.

    sudo apt update
    sudo apt 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.

    Find 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 21:20:20 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 Ubuntu 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.

    Default
    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 compilation is completed 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.

    Then, set the execute permission on newly created executable file. After than run the program as below commands.

    chmod +x Welcome.exe
    ./Welcome.exe
    

    See the results on screen:

    Install Mono on Ubuntu

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

    Mono
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Setup Apache As Frontend Proxy for Node.js
    Next Article CentOS 8 – Initial Server Setup

    Related Posts

    How to Create a Sudo User in Debian

    Updated:June 26, 20212 Mins Read

    How To Install XRDP (Remote Desktop) on Debian 10

    4 Mins Read

    Initial Server Setup with Debian 10/9/8

    Updated:June 25, 20214 Mins Read

    How To Install and Configure VNC Server on Debian 10

    Updated:June 26, 20215 Mins Read

    How to Install TeamViewer on Debian 10

    3 Mins Read

    How to Install .NET Core on Debian 10

    2 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Install JAVA on Ubuntu 22.04
    • Switching Display Manager in Ubuntu – GDM, LightDM & SDDM
    • Changing the Login Screen Background in Ubuntu 22.04 & 20.04
    • How To Install PHP (8.1, 7.4 or 5.6) on Ubuntu 22.04
    • (Resolved) Please install all available updates for your release before upgrading
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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