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. Assuming Linux has a path variable or something like it, maybe mono isn't in the path?
我对Linux一无所知 - 我觉得我在日本。假设Linux有一个路径变量或类似的东西,也许单声道不在路径中?
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.
我甚至无法在/ usr / local / src中找到一个名为mono的可执行文件,只是一个单声道文件夹。请注意,我无法弄清楚如何搜索文件,所以我可能看起来不太合适。
How can I tell whether its installed correctly? Maybe its just not available to the non-admin account I use?
如何判断其安装是否正确?也许它不适用于我使用的非管理员帐户?
I'm lost. Help!
我迷路了。帮帮我!
3 个解决方案
#1
12
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
.
如果正确安装了mono,则不应该找到像-bash:mono:command这样的消息。如果安装了某些东西,那么它通常位于$ 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. (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
但是,你的./configure得到了前缀/ opt / mono,所以你的可执行文件也可能位于该特殊路径下。 (因此没有正确安装mono。)为什么要在那里安装?无论如何。如果这是事实,那么你可以使用类似的执行它
/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.
查看所有名为mono的目录条目。其中一个应该是你的可执行文件。
#2
4
If your programm is properly installed you will usually find it's executable using "which"
如果您的程序已正确安装,您通常会发现它的可执行文件使用“which”
which programm
like:
喜欢:
which firefox
/usr/bin/firefox
#3
3
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!). This prefix is normally included in the $PATH environment variable of most distributions. - 而不是使用前缀/ opt / mono使用/ usr / local(实际上,如果你不提供任何前缀,则默认使用./configure或./autogen.sh。)。此前缀通常包含在大多数发行版的$ 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 (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).
许多互联网教程推荐/ opt / mono而不是/ usr / local的原因实际上是因为它们大多数是基于wiki页面(如上所述)解释如何设置Mono Parallel Environment,但它们当然不是包括正确设置这样一个环境的其他步骤(他们只是借用了一下如何调用configure)。
#1
12
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
.
如果正确安装了mono,则不应该找到像-bash:mono:command这样的消息。如果安装了某些东西,那么它通常位于$ 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. (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
但是,你的./configure得到了前缀/ opt / mono,所以你的可执行文件也可能位于该特殊路径下。 (因此没有正确安装mono。)为什么要在那里安装?无论如何。如果这是事实,那么你可以使用类似的执行它
/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.
查看所有名为mono的目录条目。其中一个应该是你的可执行文件。
#2
4
If your programm is properly installed you will usually find it's executable using "which"
如果您的程序已正确安装,您通常会发现它的可执行文件使用“which”
which programm
like:
喜欢:
which firefox
/usr/bin/firefox
#3
3
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!). This prefix is normally included in the $PATH environment variable of most distributions. - 而不是使用前缀/ opt / mono使用/ usr / local(实际上,如果你不提供任何前缀,则默认使用./configure或./autogen.sh。)。此前缀通常包含在大多数发行版的$ 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 (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).
许多互联网教程推荐/ opt / mono而不是/ usr / local的原因实际上是因为它们大多数是基于wiki页面(如上所述)解释如何设置Mono Parallel Environment,但它们当然不是包括正确设置这样一个环境的其他步骤(他们只是借用了一下如何调用configure)。