How to install Mono on Ubuntu 20.04

Article Directory

This article was first published in: https://www.itcoder.tech/posts/how-to-install-mono-on-ubuntu-20-04/

Mono is a platform based on ECMA/ISO standards for developing and running cross-platform applications. It is a free and open source implementation of Microsoft's .NET framework.

This article mainly concerns how to install Mono on Ubuntu 20.04.

1. Prerequisites##

The following instructions assume that you are logged into the system as root or other sudo privileges.

2. Install Mono on Ubuntu

Mono is not available in the standard Ubuntu software source repositories. We will install Mono from the official Mono source repository. This is a very simple and straightforward process that only takes a few minutes.

  1. Start installing the necessary packages:
sudo apt update
sudo apt install dirmngr gnupg apt-transport-https ca-certificates software-properties-common
  1. Enter the following command to import the GPG key of the source warehouse:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80--recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF

The output should look like this:

gpg: key A6A19B38D3D831EF:public key "Xamarin Public Jenkins (auto-signing) <[email protected]>" imported
gpg: Total number processed:1
gpg:               imported:1
  1. Add Mono source repository to your system source list:
sudo apt-add-repository 'deb https://download.mono-project.com/repo/ubuntu stable-bionic main'
  1. Install Mono:
sudo apt install mono-complete 

Mono-complete is a meta-package, it will install all the packages you need for Mono development, including the runtime environment, development tools and all class libraries.

  1. The installation will take some time. Once completed, enter the following command to print the Mono version and verify the Mono installation result:
mono --version

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

Mono JIT compiler version 6.8.0.123(tarball Tue May 1215: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, you have successfully installed Mono on your Ubuntu machine, and you can start using it.

Three, Mono entry##

To verify that all settings are normal, we will build a Hello World program, which will print the "hello world" message.

Open your text editor and create a file named hello.cs with the following content:

using System;publicclassHelloWorld{publicstaticvoidMain(string[] args){
  Console.WriteLine("Hello World!");}}

Use the csc compiler to build the program:

csc hello.cs

The above command will build an executable program named: hello.exe.

Run this executable program:

mono hello.exe

The output will look like this:

Hello, World

To run the program by entering the program name, you need to make the file executable:

chmod +x hello.exe

Now you can run hello.exe and type:

. /hello.exe

Four, summary##

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

If you have any questions, please contact us in the following ways:

WeChat:

WeChat group: add the above WeChat, remark the WeChat group

QQ: 3217680847

QQ Group: 82695646

Recommended Posts

How to install Mono on Ubuntu 20.04
How to install Ruby on Ubuntu 20.04
How to install Memcached on Ubuntu 20.04
How to install Java on Ubuntu 20.04
How to install MySQL on Ubuntu 20.04
How to install VirtualBox on Ubuntu 20.04
How to install Elasticsearch on Ubuntu 20.04
How to install Nginx on Ubuntu 20.04
How to install Apache on Ubuntu 20.04
How to install Git on Ubuntu 20.04
How to install Node.js on Ubuntu 16.04
How to install MySQL on Ubuntu 20.04
How to install Vagrant on Ubuntu 20.04
How to install PostgreSQL on Ubuntu 16.04
How to install Git on Ubuntu 20.04
How to install Memcached on Ubuntu 18.04
How to install Jenkins on Ubuntu 16.04
How to install MemSQL on Ubuntu 14.04
How to install MongoDB on Ubuntu 16.04
How to install Mailpile on Ubuntu 14.04
How to install Skype on Ubuntu 20.04
How to install Jenkins on Ubuntu 20.04
How to install Python 3.8 on Ubuntu 18.04
How to install KVM on Ubuntu 18.04
How to install KVM on Ubuntu 20.04
How to install opencv3.0.0 on ubuntu14.04
How to install Anaconda on Ubuntu 20.04
How to install Jenkins on Ubuntu 18.04
How to install Apache on Ubuntu 20.04
How to install R on Ubuntu 20.04
How to install Moodle on Ubuntu 16.04
How to install Teamviewer on Ubuntu 16.04
How to install MariaDB on Ubuntu 20.04
How to install Nginx on Ubuntu 20.04
How to install Go on Ubuntu 20.04
How to install Zoom on Ubuntu 20.04
How to install Nginx on Ubuntu 16.04
How to install OpenCV on Ubuntu 20.04
How to install Spotify on Ubuntu 20.04
How to install Postman on Ubuntu 18.04
How to install Go 1.6 on Ubuntu 16.04
How to install Go on Ubuntu 18.04
How to install MySQL on Ubuntu 14.04
How to install PostgreSQL on Ubuntu 20.04
How to install VLC on Ubuntu 18.04
How to install TeamViewer on Ubuntu 20.04
How to install Webmin on Ubuntu 20.04
How to install Docker Compose on Ubuntu 18.04
How to install Ubuntu on Raspberry Pi
How to install Bacula Server on Ubuntu 14.04
How to install MySQL on Ubuntu 18.04 (linux)
How to install Ubuntu 19.10 on Raspberry Pi 4
How to install Apache Kafka on Ubuntu 18.04
How to install Apache Maven on Ubuntu 20.04
How to install Apache Tomcat 8 on Ubuntu 16.04
How to install Python2 on Ubuntu20.04 ubuntu/focal64
How to install GCC compiler on Ubuntu 18.04
How to install Graylog 1.x on Ubuntu 14.04.
How to install Zabbix on Ubuntu 16.04 Server
How to install Opera web browser on Ubuntu 18.04
How to install Prometheus with Docker on Ubuntu 14.04