Objective
Ubuntu 10.10 comes with Mono 2.6.7. The current version is Mono 2.8.2. Because software such as "sticky Notes" in the Ubuntu operating system is developed in C #, they rely on Mono. In order not to disrupt this type of software in the Ubuntu operating system, we need to install Mono 2.8.2 in parallel, by installing it into the/opt/mono-2.8.2 directory. This allows two versions of Mono to coexist.
Preparatory work
Prepare the build environment first, using the following command to install:
[email protected]:~$ sudo apt-get install build-essential automake libtool Mono-complete gendarme subversion libpng-dev libtiff-dev libgif-dev libjpeg-dev libexif-dev autoconf Bison Flex libcairo- Dev Libpango1.0-dev
The Build-essential package above is the basic compilation environment, including the C + + compiler. Mono-complete is the compilation environment for Mono, including the C # compiler. The Ubuntu operating system is installed by default for Mono and does not include the build environment. you're not mistaken, we want to compile mono 2.8.2 from source code, first install a mono compilation environment provided by the operating system, which is the Mono 2.6.7 compilation environment for Ubuntu 10.10 operating system. The core part of Mono's source code is written in C + + language, and perhaps part of it is written in assembly language. But there is a large part, such as the. NET Framework Base Class Library, that is written in the C # language. so, to compile a higher version of mono from the source code, you need to install the lower version of Mono first. (this sentence is not correct, see: Compiling mono 2.8.2 from source code if you need a lower version of mono)
Compiling Mono 2.8.2 from source code
Now let's compile one ourselves from Mono's source code:
[Email protected]:~$CD src[Email protected]:~/src$wget http://ftp.novell.com/pub/mono/sources/mono/mono-2.8.2.tar.bz2--2011-01-07 10:02:49--http://ftp.novell.com/pub/mono/sources/mono/mono-2.8.2.tar.bz2 is parsing host ftp.novell.com ... 130.57.1.88 Connecting ftp.novell.com|130.57.1.88|:80 ... is connected. An HTTP request has been made and is waiting for a response ... $ OK Length: 31292886 (30M) [APPLICATION/X-BZIP2] is saving to: "mono-2.8.2.tar.bz2" 100%[===========================>] 31,292,886 15.5k/s Flower 28m 14s2011-01-07 10:31:04 (18.0 kb/s)-Saved "mono-2.8.2.tar.bz2" [31292886/31292886]) [Email prot ected]:~/src$tar xjf mono-2.8.2.tar.bz2[Email protected]:~/src$RM mono-2.8.2.tar.bz2[Email protected]:~/src$CD mono-2.8.2[Email protected]:~/src/mono-2.8.2$./configure --prefix=/opt/mono-2.8.2 ==========> A lot of output is omitted here <==========MCS Source:mcs Olive Source:Engine:GC:sgen and bundled Boehm GC with typed GC and parallel markglib : Embeddedtls: __threadsigaltstack:yesengine:building and using the Jitoprofile:nobigarra Ys:noDTrace:noParallel MARK:YESLLVM back End:no (dynamically loaded:no) Libraries:moon Profile:nomono Touch:nojni SUPPORT:IKVM nativelibgdiplus:assumed to be Installedzlib:system zlib[email protected]:~ /src/mono-2.8.2$ Make=====> This is a lengthy compilation process and produces a lot of output <=====[Email protected]:~/src/mono-2.8.2$sudo make install===> The installation process is not so lengthy and produces a lot of output <===[Email protected]:~/src/mono-2.8.2$
Note that the--prefix=/opt/mono-2.8.2 parameter is used when configuring the environment for compilation, which is the key to parallel installation. If this argument is omitted, the original Mono 2.6.7 version will be overwritten when the installation is finally made using make install.
Post-installation configuration
After the installation is complete, you can add some quick commands:
CD Bin Cat DMCs cat mono28exec/opt/mono-2.8.2/bin/mono "[Email protected]"
The above means to use your favorite editor, such as Vim, or gedit, to create a shortcut command in the $HOME/bin directory for ease of use. The contents of the command are as shown above. The mono28 command is used to run the "Mono 2.8.2 runtime" itself, DMCs the C # 4.0 compiler used to run mono 2.8.2. Note that the C # compiler for Mono 2.6.7 is GMCs, not DMCs, so you don't have to write Dmcs28. Mono 2.8.2 also has C # 2.0 compiler, also called GMCs, if necessary, directly with the/opt/mono-2.8.2/bin/gmcs run well.
Verifying the installation Results
Try running:
[Email protected]:~$mono28--versionMono JIT Compiler version2.8.2(Tarball Friday, January 07, 2011 10:52:34 CST) Copyright (C) 2002-2010 Novell, Inc and Contributors. Www.mono-project.comTLS: __threadsigsegv:altstacknotifications:epollarchitecture:amd64disabled:n Onemisc:debugger softdebug llvm:supported, not enabled. Gc:included Boehm (with typed GC and Parallel Mark) [Email protected]:~$DMCs--versionMono C # Compiler version2.8.2.0[Email protected]:~$/opt/mono-2.8.2/bin/gmcs--versionMono C # Compiler version2.8.2.0
Check out the Ubuntu 10.10 comes with mono 2.6.7:
Mono--version(Debian 2.6.7-3ubuntu1) Copyright (C) 2002-2010 Novell, Inc and Contributors. Www.mono-project.comTLS: __threadgc: Included Boehm (with typed GC and Parallel Mark) SIGSEGV: Altstacknotifications:epollarchitecture: amd64disabled: GMCs--version2.6.7.0
The original mono was not destroyed by us.
Practical application
Let's use the newly installed Mono 2.8. And then compile and run a C # program:
DMCs @mak. RSP mono28 AboutDialogTester.exe
As you can see, the operating environment for Mono 2.8.2 is CLR 4.0.30319.1, which is consistent with the CLR version of Microsoft. NET Framework 4 RTM. By the way, all the source code of this WinForm program can be found in the general "about this Software" dialog.
Using the Ubuntu 10.10 operating system comes with Mono 2.6.7来 to compile and run this C # program:
GMCs @mak. RSP ./aboutdialogtester.exe
As you can see, the runtime environment for Mono 2.6.7 is CLR 2.0.50727.1433, which corresponds to the CLR version of the Microsoft. NET Framework 2.0 SP1. See version of Microsoft. NET Framework.
Disk occupancy
Let's take a look at how big this package is for Mono 2.8.2:
du-hs src/mono-2.8.2/opt/mono-2.8.2917msrc/mono-2.8.2234m/opt/mono-2.8.2
As you can see, the source code for Mono 2.8.2 consumes 917 MB of disk space. The compiled Mono 2.8.2 package consumes 234 MB of disk space and is much smaller than the source code. In fact, after the completion of the compilation, the source code is not required, you can use the following command to delete:
RM-RF src/mono-2.8.2
Of course, if you don't care about this disk space, or want to study the source code of Mono 2.8.2, you don't have to delete it.
In addition, the compiled Mono 2.8.2 software is all located in the/opt/mono-2.8.2 directory. If you install a new Mono version later, just delete the/opt/mono-2.8.2 directory directly.
Configuring the Mono 2.8.2 operating environment
We can also configure a Mono 2.8.2 operating environment as follows:
CD Bin Cat Mono28-env chmod +x mono28-env
This way, we can use the Mono 2.8.2 operating environment as follows, a bit like the command-line environment of Microsoft Visual Studio 2010:
[email protected]:~$ . Mono28-env [Mono] ~ @ Mono--version Mono JIT Compiler version 2.8.2 (tarball January 07, 2011 Friday 10:52:34 CST) Copyright (C) 2002-2010 Novell, INC and Contributo Rs. Www.mono-project.comTLS: __threadsigsegv:altstacknotifications:epollarchitecture:amd64disabled:n Onemisc:debugger softdebug llvm:supported, not enabled. Gc:included Boehm (with typed GC and Parallel Mark) [mono] ~ @ GMCs--version Mono C # compiler Version 2.8.2.0[mono] ~ @ DMCs--version Mono C # compiler version 2.8.2.0[mono] ~ @
Notice that the first line above is entered. Mono28-env ", meaning to enter a decimal point followed by a space, and then the" mono28-env ". You can also enter "source Mono28-env" as such. But wouldn't it be better to have a few more words? :)
A further topic
This time we only installed the Mono 2.8.2 itself, and did not install the supporting Libgdiplus, Gtk-sharp, Mod_mono, MonoDevelop and other related stuff. If it works, it will use the default version installed in the Ubuntu 10.10 operating system.
Copyright NOTICE: This article for Bo Master http://www.zuiniusn.com original article, without Bo Master permission not reproduced.
Installing Mono 2.8.2 in the Ubuntu 10.10 operating system