CentOS搭建Mono开发环境
参考:腾讯云手动实验https://cloud.tencent.com/developer/labs/lab/10101
安装Mono
安装yum-utils,用来提高yum性能
[root@localhost ~]# yum -y install yum-utils
安装指定密钥用于验证mono的下载
[root@localhost ~]# rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF"
设置下载Mono的yum源
[root@localhost ~]# yum-config-manager --add-repo http://download.mono-project.com/repo/centos7/
安装Mono
[root@localhost ~]# yum -y install mono-complete
查看版本
[root@localhost ~]# mono -V
Mono JIT compiler version 6.8.0.105 (tarball Tue Feb 4 19:25:27 UTC 2020)
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
Interpreter: yes
LLVM: yes(610)
Suspend: hybrid
GC: sgen (concurrent by default)
创建并运行Mono程序
创建Mono程序
[root@localhost ~]# mkdir /home/monotest
[root@localhost ~]# vim /home/monotest/HelloWorld.cs
# 添加
using System;
public class HelloWorld
{
public static void Main()
{
Console.WriteLine("Hello Mono World");
}
}
运行程序
[root@localhost ~]# mcs /home/monotest/HelloWorld.cs
[root@localhost ~]# mono /home/monotest/HelloWorld.exe
Hello Mono World
Mono环境搭建完成