Best approach to writing a generic installer for a Linux application?

后端 未结 5 811
走了就别回头了
走了就别回头了 2021-02-03 12:24

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 t

相关标签:
5条回答
  • 2021-02-03 12:49

    You may want to try BitRock InstallBuilder. It is a cross platform installation tool that allows you to do exactly what you are looking for (adding users, installing services, install pre-compiled binaries, etc). Although some of the other posts mention a number of tools that you could use in your scripts, the problem is that every Linux distribution is a bit different and simple tasks like adding an user or installer a service are suddenly non-trivial when you need to do them across Debian, Ubuntu, Mandriva, RedHat, Gentoo, etc. A good cross platform installer should isolate you from all that. Many commercial open source companies like MySQL, SugarCRM, Zenoss, Jaspersoft, Groundwork etc. have built installers based on our technology exactly because of that (in addition to their regular source code tarballs, etc.) We also provide free licenses for open source projects.

    0 讨论(0)
  • 2021-02-03 12:57

    I believe that most of the tasks which you describe are fairly standardized between Linux distros. In my experience, the following should work the Debian family (including Ubuntu) and the Red Hat family (including Fedora and CentOS):

    • Create user / group accounts - adduser command
    • Create directory trees - mkdir or install, or just expand a tarball
    • Install open source applications - Unless you have particularly esoteric needs, this should probably be left to the distro's package manager.
    • Install files - install, or just expand a tarball
    • Startup and shutdown scripts - install to /etc/init.d then symlink to /etc/rc*.d

    VMware Server is freely available for Linux and does most of the tasks which you describe. It uses Perl and maybe shell for its installation and configuration, so you might see the approach that it takes.

    However, speaking as a Linux admin, I strongly prefer applications that integrate with my package management system. In other words, create .deb and .rpm files, as Vinko Vrsalovic suggested. Building packages is extremely well documented:

    • Building RPMs for Fedora (or Red Hat or CentOS): draft documentation, RPM Guide
    • Building .debs for Debian (or Ubuntu): Debian Maintainer's Guide
    0 讨论(0)
  • 2021-02-03 12:58

    I tried Autopackage a few years ago, don't know how universal it is but worked quite well (was the only truly universal way back then). Surely you have to provide some LSB-compatible ways of setting up proper directories on your own, but this piece of software should help you.

    Though there's probably still too much diversity among linux distributions to do everything in a completely platform-agnostic way but I may be wrong.

    0 讨论(0)
  • 2021-02-03 13:04

    Autopackage now merged with Listaller project. Documentation's not really thorough yet but seems to be working.

    0 讨论(0)
  • 2021-02-03 13:15

    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.

    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.

    0 讨论(0)
提交回复
热议问题