为Linux应用程序编写通用安装程序的最佳方法? [英] Best approach to writing a generic installer for a Linux application?

查看:119
本文介绍了为Linux应用程序编写通用安装程序的最佳方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个Linux服务器应用程序,其中包含许多开源工具以及我们自己编写的程序.理想情况下,我们希望能够在任何常见的Linux发行版上安装此应用程序.

We have a Linux server application that is comprised of a number of open-source tools as well as programs we've written ourselves. Ideally we would like to be able to install this application on any common Linux distribution.

过去,我们已经编写了perl脚本来自动执行此应用程序的安装.不幸的是,由于不同Linux发行版的特殊性,这些安装脚本中的逻辑变得非常复杂,并且可能会随着每个受支持发行版的新版本发布而发生变化.因此,维护安装程序成为项目中最耗时的部分之一!

In the past, we've written perl scripts to automate installs of this application. Unfortunately, due to idiosyncrasies of different Linux distros, the logic inside these install scripts gets horribly complex, and can change as new versions of each supported distro are released. Maintaining the installer thus becomes one of the most time-intensive parts of the project!

我正在寻求帮助,无论是框架,文档还是代码示例,它们都可以减轻此过程的痛苦.以下是我们的安装程序需要做的事情:

I'm looking for assistance, be it a framework, documentation, code samples, that can make this process less painful. Here are the types of things our installer needs to do:

  • 创建用户/组帐户

  • Create user/group accounts

创建具有特定所有权和权限的目录树

Create directory trees with specific ownership and permissions

安装开源应用程序,可能在安装过​​程中从源代码编译它们

Install open-source applications, potentially compiling them from source during install

将预编译的二进制文件,脚本,配置文件和文档插入特定目录

Insert pre-compiled binaries, scripts, config files, and docs into specific directories

注册初始化类型的启动和关闭脚本

Register init-type startup and shutdown scripts

生成加密密钥

验证与中央服务器的连接

Verify connectivity to a central server

推荐答案

与安装程序时使用单个脚本相比,我认为有一种比生成安装程序的脚本更好的方法是使用生成.deb或.rpm文件适合在您必须支持的每个系统上进行安装.

Instead of the installer approach, I think a better way than having a single script that does it at install time is to have a build system which generates .deb or .rpm files suitable for installation on each system you have to support.

一个穷人的解决方法可能是使用 checkinstall ,它通过"make install"安装的文件创建软件包.因此,您将在每个系统上构建应用程序,并以发行版的本机格式神奇地创建该软件包.

A poor man's way of going at that might be to use checkinstall, which creates packages from the files installed via 'make install'. So you'd build your app on each system and have the package magically created in the distro's native format.

这篇关于为Linux应用程序编写通用安装程序的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆