Install Mono using the yum command in centos 7, centos 7 yum
Preface
After trying to install mono on the Internet, this installation process went through about two weeks and tried various versions and all the installation methods described by the blogs. You can try different versions of mono by installing the following content. And Standard installation in informal environments.
1. Install the required Library
yum -y install wget glib2-devel libtiff libtiff-devel libjpeg libjpeg-devel giflib giflib-devel libpng libpng-devel libX11 libX11-devel freetype freetype-devel fontconfig fontconfig-devel libexif libexif-devel gcc-c++ gettext unzip zip bzip2 bzip2-devel curl-devel gtk2-devel boost-devel
2. Add an rpm Source
rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF"yum-config-manager --add-repo http://jenkins.mono-project.com/repo/centos/
3. Search for available versions
yum search mono-snapshot
4. Select to install the latest snapshot.
yum -y install mono-snapshot-latest
Ps: If you want to install a snapshot of a certain version, the command is
yum -y install mono-snapshot-XXXXXXXXX
5. view available Mono snapshots
mono-snapshot
The result is as follows:
This script will help you to set up your environment to use asnapshot package of Mono. To use it, run: . mono-snapshot APP/VERYou have the following possible combinations of APP/VER: mono/20150520032320Calling APP without specifying VER will load the latest version
6. Execute the specified Snapshot
Mono-snapshot mono
Or
Mono-snapshot mono/XXXXXXXXX
Display result:
[Mono-20150520032320] [root @ localhost ~] #
Mono-20150520032320 indicates the snapshot used by mono.
7. Check whether Mono is successfully installed.
mono --version
Display result:
Mono JIT compiler version 4.1.0 (tarball Tue May 19 23:45:50 EDT 2015)Copyright (C) 2002-2014 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: sgen
8. Set Mono environment variables on CentOS
Use the find/-name 'libmonoposixhelper. so' command to find the installation address of the version;
find / -name 'libMonoPosixHelper.so'/opt/mono-20150520032320/lib/libMonoPosixHelper.so
Write down/opt/mono-20150520032320 (used below)
If multiple versions are installed, multiple records are generated.
The following content mainly refer to the Article (http://www.cnblogs.com/shanyou/archive/2012/10/11/2720597.html)
The installation script installs Mono/Opt/mono-20150520032320/, you need to add the Mono directory to the system $ PATH variable
Method 1: Add a variable to the/etc/profile file [effective for all users (permanent )]
Use VI to add a variable to the/etc/profile file. This variable will be valid for all users in Linux and will be "permanent ".
vi /etc/profile
Add the following two lines of code to the end of the file:
PATH=/opt/mono-20150520032320/bin:$PATH export PATH
The modification takes effect. Run the following code (otherwise restart reboot)
source /etc/profile
Method 2: Create a Mono configuration under the/etc/profile. d/directory.
cd /etc/profile.d/
Create a new mono. sh
vi mono.sh
Write the following content into this file:
export PATH=$PATH:/opt/mono-20150520032320/bin
The "mono-20150520032320" in the path is shown above. If you need to configure an updated version, you can configure the path.
The modification takes effect. You need to execute the following code:
source mono.sh
Now you can directly execute the Mono command.
mono -VMono JIT compiler version 4.1.0 (tarball Tue May 19 23:45:50 EDT 2015)Copyright (C) 2002-2014 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: sgen
The execution results are consistent. Mono installation is complete.