为Linux应用程序创建安装程序

时间:2023-02-04 06:31:21

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?

我正在开发一个小型的跨平台应用程序,我需要一些关于如何在Linux中安装它的建议。我在Windows中使用InnoSetup,在OSX中使用application bundle,但是我不知道如何在Linux中安装我的应用,Linux中有没有opensource安装程序创建者?

Thanks.

谢谢。

5 个解决方案

#1


16  

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

在*nix系统上所有强大的通用安装程序(不仅如此)的标准是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.

您还可以为Debian、Ubuntu提供特定于发行版的安装程序,如RedHat上的RPM或CentOS或deb上的Debian,尽管一旦您有了由自动工具提供的Makefile,这些就变得轻而易举了。

# 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.

Autotools也称为“GNU构建系统”是一见钟情有点吓人,和新用户困惑当会议像古代m4宏系统& co .),但注意这是大多数人的方式,是非常容易的一旦你熟悉了它。

Learning resources

学习资源

#2


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. 使用autoconf、
  3. Using CMake,
  4. 使用CMake,
  5. Using a Java installer like IZPack
  6. 使用像IZPack这样的Java安装程序
  7. etc

#3


2  

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.

看看安装程序。您可以为您的Windows和Linux安装程序编写一个单独的项目,Mac支持很快就会到来。

#4


1  

Write a really robust makefile! or use CMake

编写一个真正健壮的makefile!或者使用CMake

#5


1  

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

当您必须在各种发行版上安装二进制包时,我开始编写unistall。

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
  • 实现操作系统类型和包管理器,允许您使用系统包管理器来提取程序可能需要的任何依赖项。例如,如果使用debian/ubuntu,它将知道使用apt-get install libncurses5-dev,如果使用RHEL/Fedora/CentOS, yum将安装libncurses-devel
  • Understand what mechanism is used to update init, if needed
  • 如果需要,了解用于更新init的机制
  • Create a safe un-installer
  • 创造一个安全un-installer
  • Work on any shell (bash, dash, zsh, pdksh, busybox ash, etc)
  • 在任何外壳上工作(bash、dash、zsh、pdksh、busybox ash等)

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.

我放弃了repo,因为它有很多有用的位,但是我很快放弃了为Linux发行版安装sheild类型程序的想法。您会发现,为.deb、.rpm和(可能的)slackware .tgz格式生产可安装的软件包会好得多。

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.

可以使用checkinstall这样的工具将其集成到您的构建系统中。注意,根据Debian和其他人制定的严格lint指导原则,checkinstall生成的包并不总是完美的,但是这些包工作得很好。

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

您可以为用户提供的最佳安装体验是允许他们使用本地包管理器安装(和更新)您的软件。

#1


16  

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

在*nix系统上所有强大的通用安装程序(不仅如此)的标准是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.

您还可以为Debian、Ubuntu提供特定于发行版的安装程序,如RedHat上的RPM或CentOS或deb上的Debian,尽管一旦您有了由自动工具提供的Makefile,这些就变得轻而易举了。

# 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.

Autotools也称为“GNU构建系统”是一见钟情有点吓人,和新用户困惑当会议像古代m4宏系统& co .),但注意这是大多数人的方式,是非常容易的一旦你熟悉了它。

Learning resources

学习资源

#2


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. 使用autoconf、
  3. Using CMake,
  4. 使用CMake,
  5. Using a Java installer like IZPack
  6. 使用像IZPack这样的Java安装程序
  7. etc

#3


2  

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.

看看安装程序。您可以为您的Windows和Linux安装程序编写一个单独的项目,Mac支持很快就会到来。

#4


1  

Write a really robust makefile! or use CMake

编写一个真正健壮的makefile!或者使用CMake

#5


1  

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

当您必须在各种发行版上安装二进制包时,我开始编写unistall。

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
  • 实现操作系统类型和包管理器,允许您使用系统包管理器来提取程序可能需要的任何依赖项。例如,如果使用debian/ubuntu,它将知道使用apt-get install libncurses5-dev,如果使用RHEL/Fedora/CentOS, yum将安装libncurses-devel
  • Understand what mechanism is used to update init, if needed
  • 如果需要,了解用于更新init的机制
  • Create a safe un-installer
  • 创造一个安全un-installer
  • Work on any shell (bash, dash, zsh, pdksh, busybox ash, etc)
  • 在任何外壳上工作(bash、dash、zsh、pdksh、busybox ash等)

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.

我放弃了repo,因为它有很多有用的位,但是我很快放弃了为Linux发行版安装sheild类型程序的想法。您会发现,为.deb、.rpm和(可能的)slackware .tgz格式生产可安装的软件包会好得多。

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.

可以使用checkinstall这样的工具将其集成到您的构建系统中。注意,根据Debian和其他人制定的严格lint指导原则,checkinstall生成的包并不总是完美的,但是这些包工作得很好。

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

您可以为用户提供的最佳安装体验是允许他们使用本地包管理器安装(和更新)您的软件。