使用 Debian (.deb) 软件包将我们的软件分发到生产服务器是否明智?
我们创建了各种程序和脚本,需要在测试后将其部署到生产 Ubuntu 服务器上。我们正在考虑将我们的软件打包为 Debian (.deb) 文件,并使用 apt-get 或 aptitude 之类的工具来安装该软件。
这很简单,但我不清楚如何回滚或卸载不受欢迎的新版本。一个明显的选择是 apt-get remove new-pkg ,然后是 apt-get install old-pkg ,但这是正确的方法吗?
在 postinst、prerm 或 postrm 中是否需要遵循特殊规则(或需要避免的事情)以帮助事情顺利进行?
请注意,我们所有的软件和服务器都是私有的,如果有帮助的话,我们可以完全控制一切。
We have various programs and scripts that we create that we need to deploy on production Ubuntu servers after testing. We are considering packaging our software as Debian (.deb) files and using something like apt-get or aptitude to install the software.
This is straightforward, but it is not clear to me how one would rollback or uninstall new versions that prove undesirable. An obvious choice is apt-get remove new-pkg
followed by apt-get install old-pkg
, but is that the right approach?
Are there special rules to follow (or things to avoid) in postinst, prerm, or postrm to help make things go smoothly?
Note that all our software and servers are private, and we have complete control over everything, if that helps.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在Debian方案中,通常不考虑自动降级。首选方法是固定版本的新的和更高的版本号(即使“固定”意味着“删除所有新功能”)。
如果您确实必须回滚升级,您可以考虑使用 Debian 纪元号来声明版本号的新开始,从回滚版本开始。举个例子,假设一个包的 1.2 版本坏了,你必须赶紧降级到 1.1,那么你将 debian 包 1.1-5 重新版本为 1:1.1-6,这是比普通包更高的版本号1.2-1。
手动降级似乎是不可取的,在至少一次降级期间您肯定会错过至少一台关键服务器。
对于 postinst、prerm 和 postrm,请考虑 Debian 新维护者指南。
In the Debian scheme, automatic downgrades are usually not considered. The preferred way would be a new and higher version number for a fixed build (even if "fixed" means "all new features removed").
If you absolutely have to roll back an upgrade, you might consider using a Debian epoch number to declare a new start in version numbers, beginning with the roll-back version. For an example, suppose the version 1.2 of a package is broken and you have to downgrade to 1.1 in a hurry, then you re-version the debian package 1.1-5 as 1:1.1-6, which is a higher version number than plain 1.2-1.
A manual downgrade certainly seems undesirable, you'll certainly miss at least one critical server during at least one downgrade.
For postinst, prerm and postrm, consider the Debian New Maintainer Guide.
apt-get 和 aptitude 都允许您指定所需的安装版本:
在任何情况下,建议在部署过程中使用它,这样您就可以准确地指定将哪个版本部署到服务器。
要回滚到以前的版本,只需指定以前的版本号即可。当然,如果使用新版本解决问题更有意义,那么就这样做而不是回滚。
Both apt-get and aptitude allow you to specify the desired installed version:
It would be advisable to make use of this, in any case, in your deployment process, so you mandate exactly which version is deployed to the servers.
To roll back to a previous version should simply be a case of specifying the previous version number. Of course, if it makes more sense to solve the problem with a new version, then do that rather than roll back.