简体   繁体   English

如何判断Mono是否在Linux上正确安装?

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

I asked IT to install Mono on CentOS using the following commands: 我让IT部门使用以下命令在CentOS上安装Mono:

$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 但是,当我运行mono myapp.exe我得到了

-bash: mono: command not found

I know nothing about Linux - I feel like I'm in Japan. 我对Linux一无所知 - 我觉得我在日本。 Assuming Linux has a path variable or something like it, maybe mono isn't in the path? 假设Linux有一个路径变量或类似的东西,也许单声道不在路径中?

I can't even find an executable called mono in /usr/local/src , just a mono folder. 我甚至无法在/usr/local/src找到一个名为mono的可执行文件,只是一个mono文件夹。 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 . 如果正确安装了mono则不应该找到像-bash: mono: command not found这样的消息。 If something is installed then it most typically is in the $PATH . 如果安装了某些东西,那么它通常位于$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. 在我的系统上,可执行文件位于/usr/bin/mono (大多数情况都是如此),但在基于RPM的系统上可能会有所不同。

Your ./configure , however, got the prefix /opt/mono , so probably your executable also is located under that special path. 但是,你的./configure有前缀/opt/mono ,所以你的可执行文件也可能位于该特殊路径下。 (And thus mono isn't properly installed.) Why did you install it there? (因此没有正确安装mono 。)为什么要在那里安装? 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 . 查看所有名为mono目录条目。 One of those should be your executable. 其中一个应该是你的可执行文件。

If your programm is properly installed you will usually find it's executable using "which" 如果您的程序已正确安装,您通常会发现它的可执行文件使用“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 ). 有许多指南和教程建议安装在/opt/mono中,以免与官方分发包(将安装在/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). 然而,大多数这些指南遗漏的是/opt/mono是一个非标准前缀,系统在尝试查找可执行文件时不会考​​虑这些前缀(系统查看$ PATH环境变量)。

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!). 而不是使用前缀/opt/mono使用/usr/local (实际上,如果你不提供任何前缀,则默认使用./configure./autogen.sh 。)。 This prefix is normally included in the $PATH environment variable of most distributions. 此前缀通常包含在大多数发行版的$ PATH环境变量中。
  • 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). 许多互联网教程推荐/opt/mono而不是/usr/local原因实际上是因为它们大多数是基于wiki页面(上面引用的),它解释了如何设置单声道并行环境,但它们当然不是包括正确设置这样一个环境的其他步骤(他们只是借用了一下如何调用configure)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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