简体   繁体   中英

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

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!

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.

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

which programm

like:

which firefox
/usr/bin/firefox

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 (ie 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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM