Linux 在 CentOS 5.x/6.x 上安装 Mono 和 Monodevelop

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16900575/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 23:06:41  来源:igfitidea点击:

Install Mono and Monodevelop on CentOS 5.x/6.x

linuxmonocentosmonodevelop

提问by hawx

I am trying to install Mono and Monodevelop on a CentOS 5.9 environment.

我正在尝试在 CentOS 5.9 环境中安装 Mono 和 Monodevelop。

I have tried the following instructions, with no luck.

我已经尝试了以下说明,但没有成功。

http://fealves78.blogspot.co.uk/2012/08/install-mono-and-monodevelop-on-centos.html

http://fealves78.blogspot.co.uk/2012/08/install-mono-and-monodevelop-on-centos.html

Can anyone suggest an alternative to the the above link.

任何人都可以建议上述链接的替代方案。

采纳答案by Justin

On these systems, I typically install Mono from source. It is a bit more work but you do not have to rely on dated or broken packages that may or may not be maintained. Also, it makes it easy to upgrade to the latest versions of Mono.

在这些系统上,我通常从源代码安装 Mono。这需要更多的工作,但您不必依赖可能会或可能不会维护的过时或损坏的软件包。此外,它可以轻松升级到 Mono 的最新版本。

The instructions below were tested on CentOS 6.4.

以下说明已在 CentOS 6.4 上测试。

Head over to /usr/srcas root

/usr/srcroot 身份前往

su
cd /usr/src

Ensure GCC and friends are installed (to build the Mono source code)

确保安装了 GCC 和朋友(构建 Mono 源代码)

yum install gcc gcc-c++ libtool bison autoconf automake

Grab and unpack the Mono source code

抓取并解压 Mono 源代码

wget http://download.mono-project.com/sources/mono/mono-3.0.7.tar.bz2
tar -xvjf mono-3.0.7.tar.bz2

Build and install Mono

构建和安装 Mono

cd mono-3.0.7
./configure --prefix=/usr
make && make install

Verify that you have a working Mono installation with mono --versionand mcs --version

验证您是否有可用的 Mono 安装mono --versionmcs --version

Build the GDI+ compatibility layer (required for System.Drawing)

构建 GDI+ 兼容层(System.Drawing 需要)

yum install glib2-devel libX11-devel pixman-devel fontconfig-devel freetype-devel libexif-devel libjpeg-devel libtiff-devel libpng-devel giflib-devel

cd /usr/src
wget http://download.mono-project.com/sources/libgdiplus/libgdiplus-2.10.9.tar.bz2
tar -xvjf libgdiplus-2.10.9.tar.bz2
cd libgdiplus-2.10.9
./configure --prefix=/usr
make && make install

That is it for Mono but building MonoDevelop is another story...

这就是 Mono,但构建 MonoDevelop 是另一回事......

Build Gtk-Sharp

构建 Gtk-Sharp

yum install gtk2-devel libglade2-devel

cd /usr/src
wget http://download.mono-project.com/sources/gtk-sharp212/gtk-sharp-2.12.8.tar.bz2
tar -xvjf gtk-sharp-2.12.8.tar.bz2
cd gtk-sharp-2.12.8
./configure --prefix=/usr
make && make install

Unfortunately, I do not think there is a proper source tarball of gnome-sharp that is new enough for what we need. So, we will get it from the Git repository.

不幸的是,我认为没有一个合适的 gnome-sharp 源 tarball 足够新,可以满足我们的需要。因此,我们将从 Git 存储库中获取它。

yum install pango-devel atk-devel libgnome-devel libgnomecanvas-devel libgnomeui-devel git svn libtool

cd /usr/src
git clone git://github.com/mono/gnome-sharp
cd gnome-sharp
./bootstrap-2.24 --prefix=/usr
make && make install

Same for Mono Addins...

单声道插件也一样......

cd /usr/src
git clone git://github.com/mono/mono-addins
cd mono-addins
./autogen.sh --prefix=/usr
make && make install

Finally, we can build MonoDevelop itself.

最后,我们可以构建 MonoDevelop 本身。

cd /usr/src
wget http://download.mono-project.com/sources/monodevelop/monodevelop-3.1.1.tar.bz2
tar -xvjf monodevelop-3.1.1.tar.bz2
cd monodevelop-3.1.1
PKG_CONFIG_PATH=/usr/lib/pkgconfig
export PKG_CONFIG_PATH
./configure --prefix=/usr --select
make && make install

You should now see MonoDevelop in the Programming menu under Applications!

您现在应该在应用程序下的编程菜单中看到 MonoDevelop!

Now that we are doing all this fun Git stuff, it is easy enough to upgrade to the latest (pre-release) version of Mono any time we want...

现在我们正在做所有这些有趣的 Git 工作,随时可以轻松升级到 Mono 的最新(预发布)版本......

First time checking out of Git:

第一次检出 Git:

cd /usr/src
git clone git://github.com/mono/mono
cd mono
./autogen.sh --prefix=/usr
make && make install

To just upgrade to the latest version (after the first time building from Git)

升级到最新版本(第一次从 Git 构建之后)

cd /usr/src/mono
git pull
./autogen.sh --prefix=/usr
make && make install

If you do not want the bleeding edge, you can use Git to check-out more stable branches of Mono instead. I will leave that as an exercise for Wikipedia.

如果您不想要最新的边缘,您可以使用 Git 来检出更稳定的 Mono 分支。我将把它作为维基百科的练习。

回答by Justin

On these systems, I typically install Mono from source. It is a bit more work but you do not have to rely on dated or broken packages that may or may not be maintained.

在这些系统上,我通常从源代码安装 Mono。这需要更多的工作,但您不必依赖可能会或可能不会维护的过时或损坏的软件包。

The instructions below were tested on CentOS 5.9.

以下说明已在 CentOS 5.9 上测试。

Because of limitations in the installed versions of Glib and GTK+, the newest version of GTK# you can compile on RHEL5 (CentOS 5.x) is 2.10.4. With this version of GTK#, the newest version of MonoDevelop that you can build is 2.0 (not even 2.2).

由于已安装的 Glib 和 GTK+ 版本的限制,您可以在 RHEL5 (CentOS 5.x) 上编译的最新 GTK# 版本是 2.10.4。使用这个版本的 GTK#,您可以构建的 MonoDevelop 的最新版本是 2.0(甚至不是 2.2)。

You can still run very recent versions of Mono though. I have CentOS 5.x boxes serving up ASP.NET MVC3 apps.

不过,您仍然可以运行最新版本的 Mono。我有提供 ASP.NET MVC3 应用程序的 CentOS 5.x 机器。

Head over to /usr/srcas root

/usr/srcroot 身份前往

su
cd /usr/src

Ensure GCC and friends are installed (to build the Mono source code)

确保安装了 GCC 和朋友(构建 Mono 源代码)

yum install gcc gcc-c++ libtool bison autoconf automake

Grab and unpack the Mono source code

抓取并解压 Mono 源代码

wget http://download.mono-project.com/sources/mono/mono-3.0.7.tar.bz2
tar -xvjf mono-3.0.7.tar.bz2

Build and install Mono

构建和安装 Mono

cd mono-3.0.7
./configure --prefix=/usr
make && make install

Verify that you have a working Mono installation with mono --versionand mcs --version

验证您是否有可用的 Mono 安装mono --versionmcs --version

Build the GDI+ compatibility layer (required for System.Drawing)

构建 GDI+ 兼容层(System.Drawing 需要)

yum install glib2-devel libX11-devel pixman-devel fontconfig-devel freetype-devel libexif-devel libjpeg-devel glib2-devel libtif-devel libpng-devel giflib-devel

cd /usr/src
wget http://download.mono-project.com/sources/libgdiplus/libgdiplus-2.10.tar.bz2
tar -xvjf libgdiplus-2.10.tar.bz2

回答by Francois Richard

In order for gtk-sharp to build I had to set the following environment variable:

为了构建 gtk-sharp,我必须设置以下环境变量:

PKG_CONFIG_PATH=/usr/lib/pkgconfig
export PKG_CONFIG_PATH

Without this, the configure script was looking for csc.exe

没有这个,配置脚本正在寻找 csc.exe