• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How to Install Mono on Debian 10 Buster

Written by Admin, Updated On June 23, 2020
debian, mono
How to Install Mono on Debian 10

Mono platform is used to develop and run cross-platform applications. It is open-source and free implementation by the Microsoft. This tutorial explains how to install Mono on Debian 10.

Prerequisites#

Before you start installation, make sure you have logged in as root or user with sudo privileges.

Installing Mono on Debian#

Standard Debian repositories does not includes Mono package. We will install the Mono package from the official Mono’s repositories. It is a very easy to install. Perform the following steps:

1. Start by installing the necessary packages:

sudo apt update
sudo apt install dirmngr gnupg apt-transport-https ca-certificates

2. Import the repository’s GPG keys using below command:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF

The output should look like below:

gpg: key A6A19B38D3D831EF: public key "Xamarin Public Jenkins (auto-signing) <releng@xamarin.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1

3. Add the Mono repository to your system sources list:

sudo sh -c 'echo "deb https://download.mono-project.com/repo/debian stable-buster main" > /etc/apt/sources.list.d/mono-official-stable.list'

4. Update the packages list and install Mono, after the apt repository is enabled:

sudo apt update
sudo apt install mono-complete

The mono-complete is a meta-package and it will install other required packages for Mono development, including the runtime, development tools, and all libraries.

5. Verify the installation printing the Mono version:

mono --version

At the time of writing this article, the latest stable version of Mono is 6.8.0 Stable (6.8.0.123).

Mono JIT compiler version 6.8.0.123 (tarball Tue Feb  4 21:20:43 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. Mono installed successfully on your Debian system, you can start developing your application.

Mono Program Example#

We will create a simple Hello World program to check that everything is set up perfectly.

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!");
    }
}

To build the program use the csc compiler:

csc hello.cs

It will create a executable with name hello.exe

Run the executable using the command below:

mono hello.exe

The output should show something like this:

Hello, World

Make the file executable to execute the program only by typing its name:

chmod +x hello.exe

You can now run the hello.exe file by typing:

./hello.exe

Conclusion#

You have learned successfully how to install latest stable Mono on Debian from the official Mono repositories.

If you have any question or feedback, please leave a comment below.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article Ps Command in Linux (List Processes)
Next Article   How to Check the PostgreSQL Version

Related Posts

  • How to Install WordPress with Nginx on Debian 11

    How to Install WordPress with Nginx on Debian 11

    March 22, 2023
  • How to Install and Use Docker on Debian 11

    How to Install and Use Docker on Debian 11

    March 10, 2023
  • How to Install MariaDB on Debian 11 Bullseye

    How to Install MariaDB on Debian 11 Bullseye

    March 8, 2023

Leave a Reply Cancel reply

DigitalOcean Referral Badge

Popular Posts

  • How to Install Microsoft Edge Browser on Ubuntu 22.04
    How to Install Microsoft Edge Browser on Ubuntu 22.04 March 14, 2023
  • How to Install Ruby on Ubuntu 22.04 LTS
    How to Install Ruby on Ubuntu 22.04 LTS February 27, 2023
  • How to Install LEMP Stack on Ubuntu 22.04
    How to Install LEMP Stack on Ubuntu 22.04 March 18, 2023
  • How to Install Set Up Apache Virtual Hosts on Ubuntu 22.04
    How to Set Up Apache Virtual Hosts on Ubuntu 22.04 March 2, 2023
  • How to Install MariaDB on Debian 11 Bullseye
    How to Install MariaDB on Debian 11 Bullseye March 8, 2023
© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook