Creating an installer for Linux application [close

2019-03-09 07:46发布

问题:

I'm developing a small cross-platform application and I need some advice on how to install it in Linux. I am using InnoSetup in Windows and an application bundle in OSX but I have no idea how to get my app installed in Linux, are there any opensource installer creators for Linux?

Thanks.

回答1:

The standard all mighty universally available installer on *nix systems (and not only) is Autotools.

# the user will install like so:
./configure --with-stuff
make # if package is from source
make install

You can also provide distribution specific installers like a RPM on RedHat or CentOS or deb for Debian, Ubuntu, although once you have the Makefile spitted by Autotools, making these is a breeze.

# the user will install like so:
yum install your-package-1.0.rpm # on redhat or
apt-get install your-package-1.0.deb # on debian

Autotools also known as "the GNU build system" is a little scary on the first sight, and the new user is puzzled when meeting things like the ancient m4 macro system & co. but nota bene this is the way most people do it and is pretty easy once you get the hang of it.

Learning resources



回答2:

If possible, opt for not requiring an installer but using a simple extract-and-run approach. This will allow the user to put the file(s) anywhere they want and run it.

But, you do have other options, such as:

  1. Using autoconf,
  2. Using CMake,
  3. Using a Java installer like IZPack
  4. etc


回答3:

Take a look at InstallJammer. You can write a single project for both your Windows and your Linux installer, and the Mac support is coming very soon.



回答4:

Write a really robust makefile! or use CMake



回答5:

I started writing unistall for situations when you had to install binary packages on a variety of distros.

It attempts to do a few things:

  • Realize the OS type and package manager, allowing you to use the system package manager to pull in any dependencies that your program might require. For instance, it will know to use apt-get install libncurses5-dev if using debian/ubuntu, yum install libncurses-devel if using RHEL/Fedora/CentOS
  • Understand what mechanism is used to update init, if needed
  • Create a safe un-installer
  • Work on any shell (bash, dash, zsh, pdksh, busybox ash, etc)

I leave the repo up because its full of useful bits, however I quickly gave up on the idea of an install sheild type program for Linux distributions. You'll find that its much, much better to produce installable packages for .deb , .rpm and (possibly) slackware .tgz formats.

This can be integrated into your build system using a tool like checkinstall. Note, the packages that checkinstall generates are not always perfect, according to strict lint guidelines set out by Debian and others, however the packages work just fine.

The best installation experience you can provide a user is allowing them to install (and update) your software using their native package manager.