{"id":6027,"date":"2021-04-26T11:33:57","date_gmt":"2021-04-26T11:33:57","guid":{"rendered":"https:\/\/linuxways.net\/?p=6027"},"modified":"2021-04-26T11:33:57","modified_gmt":"2021-04-26T11:33:57","slug":"how-to-install-mono-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-install-mono-on-ubuntu-20-04\/","title":{"rendered":"How to Install Mono on Ubuntu 20.04"},"content":{"rendered":"<p>Mono is an open-source and free exertion original exertion of Microsoft\u2019s. NET.\u00a0 This open-source platform is intended designed for developing cross-platform applications. It builds and executes applications to follows the ECMA\/ISO Standards.<\/p>\n<p>We will show you in this article, how to install Mono with all dependencies on Ubuntu 20.04 system.<strong>\u00a0<\/strong><\/p>\n<h2><strong>Prerequisites<\/strong><\/h2>\n<p>You should have privileges to execute the sudo command or root account credentials.<\/p>\n<h2><strong>Mono installation on Ubuntu 20.04 Distribution<\/strong><\/h2>\n<p>Mono is not present in the default Ubuntu 20.04 standard repository. However, you can install mono packages from the mono\u2019s official repository. Follow the below-mentioned steps to install Mono from its official repository on Ubuntu 20.04 system:<\/p>\n<h3><strong>Step 1: Install required mono dependencies<\/strong><\/h3>\n<p>First, update the apt packages list of your Ubuntu system then, use the following command to install all mono dependencies by adding a new repository over HTTPS:<\/p>\n<pre>$ sudo update apt<\/pre>\n<pre>$ sudo apt install dirmngr gnupg apt-transport-https ca-certificates software-properties-common<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1095\" height=\"794\" class=\"wp-image-6028\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-297.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-297.png 1095w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-297-300x218.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-297-1024x743.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-297-768x557.png 768w\" sizes=\"auto, (max-width: 1095px) 100vw, 1095px\" \/><\/p>\n<h3><strong>Step 2: Extract repository\u2019s GPG key<\/strong><\/h3>\n<p>Once the new repository is added to your Ubuntu system, you need to extract the GPG key and then placed them on your Ubuntu server. So, run the below-mentioned command to extract the repository\u2019s GPG key:<\/p>\n<pre>$ sudo apt-key adv --keyserver hkp:\/\/keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1089\" height=\"254\" class=\"wp-image-6029\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-298.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-298.png 1089w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-298-300x70.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-298-1024x239.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-298-768x179.png 768w\" sizes=\"auto, (max-width: 1089px) 100vw, 1089px\" \/><\/p>\n<h3><strong>Step 3: Add Mono repository\u00a0<\/strong><\/h3>\n<p>After extracting the GPG key, add the mono repository to your Ubuntu system by using the following command:<\/p>\n<pre>$ sudo apt-add-repository 'deb https:\/\/download.mono-project.com\/repo\/ubuntu stable-focal main'<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1086\" height=\"552\" class=\"wp-image-6030\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-299.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-299.png 1086w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-299-300x152.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-299-1024x520.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-299-768x390.png 768w\" sizes=\"auto, (max-width: 1086px) 100vw, 1086px\" \/><\/p>\n<h3><strong>Step 4: Install Mono on Ubuntu 20.04<\/strong><\/h3>\n<p>Now, install the mono-complete meta-package by running the below-mentioned command. This package will automatically install all required mono runtime dependencies, libraries, and development tools on your system.<\/p>\n<pre>$ sudo apt install mono-complete<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1090\" height=\"730\" class=\"wp-image-6031\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-300.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-300.png 1090w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-300-300x201.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-300-1024x686.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-300-768x514.png 768w\" sizes=\"auto, (max-width: 1090px) 100vw, 1090px\" \/><\/p>\n<p>The dialogue will be prompted during the installation. Press \u2018y\u2019 and then hit \u2018Enter\u2019 to confirm the installation process.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1088\" height=\"755\" class=\"wp-image-6032\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-301.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-301.png 1088w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-301-300x208.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-301-1024x711.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-301-768x533.png 768w\" sizes=\"auto, (max-width: 1088px) 100vw, 1088px\" \/><\/p>\n<p>The installation will take a few minutes to complete on your Ubuntu system.<\/p>\n<p>If you want to build your projects through the IDE development method then, use the following command to install mono:<\/p>\n<pre>$\u00a0 sudo apt install monodevelop<\/pre>\n<h3><strong>Step 5: Verify Mono installation<\/strong><\/h3>\n<p>Once all mono packages are installed on your Ubuntu system, issue the below-given command to view the installed mono version:<\/p>\n<pre>$ mono --version<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1097\" height=\"419\" class=\"wp-image-6033\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-302.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-302.png 1097w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-302-300x115.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-302-1024x391.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-302-768x293.png 768w\" sizes=\"auto, (max-width: 1097px) 100vw, 1097px\" \/><\/p>\n<p>Congratulations! mono is installed on your Ubuntu 20.04 system now. You can start and use it.<\/p>\n<h2><strong>How to build the project using Mono?<\/strong><\/h2>\n<p>To verify that everything is working well. We will build a project \u2018testprogram\u2019 that will print output \u2018How to install mono on Ubuntu\u2019.<\/p>\n<p>Create a text file in any text editor and paste the below-mentioned source code in it:<\/p>\n<p>using System;<\/p>\n<pre>public class testprogram\r\n\r\n{\r\n\r\n\u00a0\u00a0\u00a0\u00a0public static void Main(string[] args)\r\n\r\n\u00a0\u00a0\u00a0\u00a0{\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Console.WriteLine (\"How to install mono on Ubuntu\");\r\n\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\r\n}<\/pre>\n<p>Save the above file with the name \u2018testprogram.cs\u2019 in your system.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1094\" height=\"357\" class=\"wp-image-6034\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-303.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-303.png 1094w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-303-300x98.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-303-1024x334.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-303-768x251.png 768w\" sizes=\"auto, (max-width: 1094px) 100vw, 1094px\" \/><\/p>\n<p>Now, build the above source code by using the \u2018csc\u2019 compiler:<\/p>\n<pre>$ csc testprogram.cs<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1077\" height=\"171\" class=\"wp-image-6035\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-304.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-304.png 1077w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-304-300x48.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-304-1024x163.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-304-768x122.png 768w\" sizes=\"auto, (max-width: 1077px) 100vw, 1077px\" \/><\/p>\n<p>The above command creates an executable file named \u2018testprogram.exe\u2019. You can now execute this file through the mono to display the output.<\/p>\n<pre>$ mono testprogram.exe<\/pre>\n<p>The following result show display on the terminal screen after running the above\u00a0program:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1082\" height=\"110\" class=\"wp-image-6036\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-305.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-305.png 1082w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-305-300x30.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-305-1024x104.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/04\/word-image-305-768x78.png 768w\" sizes=\"auto, (max-width: 1082px) 100vw, 1082px\" \/><\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>We have implemented in this article how to install mono on Ubuntu 20.04 system. We have also explored how you can build a program using the mono framework. The mono installation takes time to complete on your Ubuntu system. So, be patient when you will install mono on your system.<\/p>\n<p>&nbsp;<\/p>","protected":false},"excerpt":{"rendered":"<p>Mono is an open-source and free exertion original exertion of Microsoft\u2019s. NET.\u00a0 This open-source platform is intended designed for developing cross-platform applications. It builds and executes applications to&hellip;<\/p>","protected":false},"author":1,"featured_media":6090,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[235,100],"class_list":["post-6027","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-mono","tag-ubuntu-20-04"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/6027","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=6027"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/6027\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/6090"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=6027"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=6027"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=6027"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}