Fork me on GitHub

CentOS设置Mono环境变量

GitHub上有直接通过脚本一键安装Mono的脚本,具体参见 https://github.com/nathanb/iws-snippets/tree/master/mono-install-scripts/fedora

1、安装Mono的最新环境Mono-2.11

mkdir mono-2.11
cd mono-2.11
wget --no-check-certificate https://github.com/nathanb/iws-snippets/tree/master/mono-install-scripts/fedora/install_mono-2.11.sh
chmod 755 install_mono-2.11.sh
./install_mono-2.11.sh

2、在CentOS上设置Mono环境变量

安装脚本将Mono安装到了/opt/mono-2.11/,需要将Mono的目录加入系统$PATH变量

方法一: 在/etc/profile文件中添加变量【对所有用户生效(永久的)】
用VI在文件/etc/profile文件中增加变量,该变量将会对Linux下所有用户有效,并且是“永久的”。

[root@SNDA-192-168-15-161 ~]# vi /etc/profile
在文件末尾加上如下两行代码
PATH=/opt/mono-2.11/bin:$PATH export PATH

要是刚才的修改马上生效,需要执行以下代码

[root@SNDA-192-168-15-161 ~]# source /etc/profile

方法二 :在/etc/profile.d/目录下创建一个Mono的配置

创建一个新的mono.sh

在这个文件内初始化环境变量

export PATH=$PATH:/opt/mono-2.11/bin

要是刚才的修改马上生效,需要执行以下代码

[root@SNDA-192-168-15-161 profile.d]# source mono.sh

现在可以直接执行Mono 的命令了

[root@SNDA-192-168-15-161 profile.d]# mono -V
Mono JIT compiler version 2.11.3 (tarball Thu Oct 11 07:46:58 CST 2012)
Copyright (C) 2002-2012 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            Included Boehm (with typed GC and Parallel Mark)

 

Running ASP.NET MVC4 on Ubuntu 12.04

posted @ 2012-10-11 22:42  张善友  阅读(4039)  评论(2编辑  收藏  举报