Centos下安装最新版Mono并为windwos服务配置开机启动项

Posted Devops、小铁匠

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos下安装最新版Mono并为windwos服务配置开机启动项相关的知识,希望对你有一定的参考价值。

一:安装Mono,此步骤参照官网

1:配置Yum仓库

#Centos 7
yum
install yum-utils rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" yum-config-manager --add-repo http://download.mono-project.com/repo/centos7/
#Centos 6
yum install yum-utils
rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF"
yum-config-manager --add-repo http://download.mono-project.com/repo/centos6/

2:安装mono

yum install mono-devel
#这里面是官网的安装说明,一般情况下安装devel就可以了!,安装所有,可以把对应的包名都加上!

The package mono-devel should be installed to compile code.

The package mono-complete should be installed to install everything - this should cover most cases of "assembly not found" errors.

The package referenceassemblies-pcl should be installed for PCL compilation support - this will resolve most cases of "Framework not installed: .NETPortable" errors during software compilation.

The package xsp should be installed for running ASP.NET applications.

二:配置windows程序的开机启动项

1: vim /etc/init.d/mfgRemotingServer,并输入以下内容


#!/bin/bash # #chkconfig: 2345 20 80 #description:remotingservice start() {
#这里面的-l是指定lock文件,后面跟的是exe程序所在的绝对路径,可以通过mono-service命令查看帮助 mono
-service -l:/root/remotingservice-lock /home/setquestion/Mfg.Setquestion.RemotingServer.exe } stop() { kill `cat /root/remotingservice-lock` } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; *) echo $"Usage: $0 {start|stop|restart}" exit 1 esac

 2:执行时service mfgRemotingServer stop 会遇到  env: /etc/init.d/mfgRemotingServer: Permission denied,解决办法如下:

chmod +x /etc/init.d/mfgRemotingServer
service mfgRemotingServer stop
#加入到开机启动项
chkconfig --add mfgRemotingServer
chkconfig mfgRemotingServer on

3:mono-service的相关参数如下:

You must specify at least the assembly name

Usage is: /usr/bin/mono-service [options] service

    -d:<directory>         Working directory
    -l:<lock file>         Lock file (default is /tmp/<service>.lock)
    -m:<syslog name>       Name to show in syslog
    -n:<service name>      Name of service to start (default is first defined)
    --debug                Do not send to background nor redirect input/output
    --no-daemon            Do not send to background nor redirect input/output

Controlling the service:

    kill -USR1 `cat <lock file>`    Pausing service
    kill -USR2 `cat <lock file>`    Continuing service
    kill `cat <lock file>`          Ending service

PS:如果给为在安装和配置过程中有任何疑问,望留言。

 

以上是关于Centos下安装最新版Mono并为windwos服务配置开机启动项的主要内容,如果未能解决你的问题,请参考以下文章

CentOS 7.2下安装Mono 5.0

CentOS 7 yum安装lamp,三者位于不同服务器,并为之安装WordPress及phpmyadmin

CentOS 7 yum安装lamp,三者位于不同服务器,并为之安装WordPress及phpmyadmin

Centos下安装Jexus.net,上传部署运行asp.net项目

CentOS6.x生产环境下一键安装mono+jexus的脚本,自启动,带服务,版本号自控

Centos6.4安装Mono和MonoDevelop