Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I tell if Mono is installed properly on Linux?

Tags:

linux

mono

I asked IT to install Mono on CentOS using the following commands:

$yum install bison gettext glib2 freetype fontconfig libpng libpng-devel libX11 libX11-devel glib2-devel libgdi* libexif glibc-devel urw-fonts java unzip gcc gcc-c++ automake autoconf libtool make bzip2 wget
$cd /usr/local/src 
$wget http://download.mono-project.com/sources/mono/mono-3.2.5.tar.bz2
$tar jxf mono-3.2.5.tar.bz2
$cd mono-3.2.5
$./configure --prefix=/opt/mono
$make && make install

However, when I run mono myapp.exe I get

-bash: mono: command not found

I know nothing about Linux - I feel like I'm in Japan. Assuming Linux has a path variable or something like it, maybe mono isn't in the path?

I can't even find an executable called mono in /usr/local/src, just a mono folder. Mind you I can't work out how to even search for a file so I might not be looking properly.

How can I tell whether its installed correctly? Maybe its just not available to the non-admin account I use?

I'm lost. Help!

like image 695
Luke Puplett Avatar asked Dec 06 '13 11:12

Luke Puplett


People also ask

How do you know if Mono is installed?

To check the version of Mono that is installed, please open Terminal and type "mono -V" (note capital 'V') and the result will be displayed. Mono versions.

Where is Mono installed on Linux?

Mono is Microsoft's . NET compatible and based on EMCS. Mono can be installed on Linux Mint 20 from the synaptic package manager, command line, and mono official repositories.

Where is Mono installed?

The installer will deposit all the necessary files in C:\Program Files\Mono-1.0, but you can override that by entering a different folder. Batch files that wrap each of the Mono executables will be installed in C:\Program Files\Mono-1.0\bin, so must add that to your PATH environment variable.


3 Answers

If mono is properly installed, you should not get a message like -bash: mono: command not found. If something is installed then it most typically is in the $PATH.

On my system the executable is located on /usr/bin/mono (as most things are) but things may be different on a RPM-based system.

Your ./configure, however, got the prefix /opt/mono, so probably your executable also is located under that special path. (And thus mono isn't properly installed.) Why did you install it there? Anyway. If this is the fact, then you can execute it using sth like

/opt/mono/bin/mono foo.exe

to find the executable below your prefix path you could use

find /opt/mono -name mono

to see all directory entries which are named exactly mono. One of those should be your executable.

like image 60
Alfe Avatar answered Oct 09 '22 04:10

Alfe


If your programm is properly installed you will usually find it's executable using "which"

which programm

like:

which firefox
/usr/bin/firefox
like image 29
Serious Sammy Avatar answered Oct 09 '22 04:10

Serious Sammy


There are many guides and tutorials out there that recommend installing in /opt/mono in order to not conflict with the mono supplied by official distribution packages (which would be installed in /usr).

However what most of those guides miss is that /opt/mono is a non-standard prefix that will not be taken in account by the system when trying to find the executables (the system looks at the $PATH environment variable).

There are 2 possible solutions to this:

  • Instead of using the prefix /opt/mono use /usr/local (which is actually what ./configure or ./autogen.sh uses by default if you don't supply any prefix!). This prefix is normally included in the $PATH environment variable of most distributions.
  • Use your custom mono installation from a Parallel Environment. This is a bit more complicated to set up, but it's specially recommended for people who want to install two versions of mono in parallel (i.e. a very modern version, and a more stable version supplied by the official distribution packages), and have good control of when they can use one or another.

The reason that many internet tutorials recommend /opt/mono instead of /usr/local is actually because most of them are based on the wiki page (referenced above) that explains how to set up a Mono Parallel Environment, but they of course don't include the other steps to properly set up such an environment (they just borrowed the bit about how to call configure).

like image 3
knocte Avatar answered Oct 09 '22 05:10

knocte