There are a couple of ways to run C# applications on Linux operating systems. Before .NET Core, Mono used to be the only way for C# applications running on Linux machine. Each Linux distro has a different method to install Mono. In this post, we’ll walk through how to install Mono on Amazon Linux.

NOTE: Amazon Linux 2016.03.1 was used for this post.

According to the official document, we can follow the CentOS way. However, when we follow the instruction, we’ll get the following error like:

This can be sorted out by following the steps below:

First of all, take the root privilege by running the sudo su command. This MUST be returned after the installation to avoid further security breach. Taking the root permissions is not necessary. Instead, we MUST use sudo command every time we need to install something onto Amazon Linux.

Download the RPM package by executing the wget command, then install it. Once we complete installing the missing package, then follow the official document again to set up yum.

If necessary, the following commands can help refresh cache.

Now, we’re ready for Mono installation. Try the following command for it.

All downloaded files for missing dependencies are no longer necessary. So delete them.

Mono installation completed! Now exit from the root privilege.

Try a demo code to confirm if Mono has been properly installed. A sample demo code can be found from the official document. If everything is fine, we’ll be able to see the following result:

We’ve installed Mono onto Amazon Linux. As it’s a variation of CentOS/RHEL, it should be as easy as what the document says. However, some missing dependencies need to be installed beforehand. In the next post, we’re going to install .NET Core RC1 and RC2 onto Amazon Linux.

Category:
Application Development and Integration
Tags:
,

Join the conversation! 8 Comments

  1. This helped a lot. Some typos made a bit difficult to follow verbatim.
    Thanks a lot

Comments are closed.