Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Install Mono on Ubuntu 20.04 - DesignLinux

designlinux 0 Comments

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 covers the steps required to install Mono on Ubuntu 20.04.

Prerequisites #

The instructions assume that you are logged in as root or user with sudo privileges.

Installing Mono on Ubuntu #

Mono is not available in the standard Ubuntu 20.04 repositories. We’ll install the Mono packages from the official Mono’s repositories:

  1. Install the dependencies necessary to add a new repository over HTTPS:

    sudo apt updatesudo apt install dirmngr gnupg apt-transport-https ca-certificates software-properties-common
  2. Import the repository’s GPG key:

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

    The output should look something like this:

    gpg: key A6A19B38D3D831EF: public key "Xamarin Public Jenkins (auto-signing) <[email protected]>" imported
    gpg: Total number processed: 1
    gpg:               imported: 1
  3. Add the Mono repository to your system sources’ list:

    sudo apt-add-repository 'deb https://download.mono-project.com/repo/ubuntu stable-bionic main'
  4. Install Mono:

    sudo apt install mono-complete 

    mono-complete is a meta-package that installs the Mono runtime, development tools, and all libraries.

  5. The installation may take a few minutes to complete. Once completed, verify it by typing the following command which will print the Mono version:

    mono --version

    At the time of writing this article, the latest stable version of Mono is 6.8.0.123.

    Mono JIT compiler version 6.8.0.123 (tarball Tue May 12 15:11:57 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 has been installed on your Ubuntu machine, 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:

hello.cs
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.cs

The command above will create an executable named hello.exe.

Run the executable:

mono hello.exe

The output should look something like this:

Hello, World

To execute the program only by typing its name, set an executable flag:

chmod +x hello.exe

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

./hello.exe

Conclusion #

Installing Mono on Ubuntu 20.04 is a relatively straightforward process, and it will take you only a few minutes.

If you hit a problem or have feedback, leave a comment below.

ubuntu mono

Related

Tags: mono, ubuntu

How to Connect NGINX to PHP-FPM Using UNIX or TCP/IP Socket

Prev Post

What is PostgreSQL? How Does MySQL Work?

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 0
  • 72
  • 605,822

DesignLinux.com © All rights reserved

Go to mobile version