制作安装程序的最佳实践 - 我可以使用 Yum

发布于 2024-09-16 22:47:28 字数 323 浏览 3 评论 0原文

我是安装程序的新手,到目前为止只是手动执行要安装的项目的逐行列表。显然,这不是一种可扩展的方法,特别是当需要定期安装新服务器且不是由同一个人安装时。

目前我需要通过 Yum 安装大约 30 个包(从像 mySQL 这样的大包到较小的 70KB 随机包) 手动安装一堆其他的(Python 包基本上只是“python setup.py install”命令) 创建一些目录,更改一些权限等。

创建自动执行此操作的最佳方法是什么。我不能总是假设客户端服务器有 Yum,所以我是否需要下载所有二进制文件和依赖项并让脚本安装它们?

我知道这是一个有内涵的问题。有谁知道这方面有什么好的教程吗?

I am new to installers and up until now have just been manually executing a line by line list of items to install. Clearly this is not a scaleable approach, especially when new servers need to be installed regularly, and not by the same person.

Currently I need to install about 30 packages via Yum (from large ones like mySQL to smaller 70KB random ones)
Manually install a bunch of others (Python packages that are basically just "python setup.py install" commands)
Create some directories, change some permissions etc.

What is the best way to create something that automatically does this. I can't always assume the client server has Yum, so would I need to download all the binaries and dependencies and have the script install them?

I know this is a loaded question. Does anyone know any good tutorials for this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

岁月蹉跎了容颜 2024-09-23 22:47:28

您同时提出了几个问题,所以我只想谈谈打包和安装 Python 库...

使用 setup.py 您可以将 Python 包转换为 RPM,以便安装在任何 Red 上帽子/CentOS
使用百胜盒子。这就是我在工作中内部安装所有软件包的方式。假设安装了基础 rpmbuild 实用程序,事情就这么简单:

python setup.py bdist_rpm

这将在 dist 文件夹中构建软件包的 RPM(例如 dist/mypackage-1.01 -1-noarch.rpm)。然后,您可以将此 RPM 添加到您的内部 yum 镜像(如果您有内部镜像),然后您可以轻松地将软件包分发到您的内部主机。

You're asking a few questions at once, so I'm just going to touch on packaging and installing Python libraries...

Using setup.py you can turn Python packages into RPMs for installation on any Red Hat/CentOS
box using yum. This is how I install all my packages internally at my job. Assuming the foundation rpmbuild utilities are installed, it's a simple as this:

python setup.py bdist_rpm

This will build an RPM of your package in the dist folder (e.g. dist/mypackage-1.01-1-noarch.rpm). Then you can just add this RPM to your internal yum mirror (if you have an internal mirror) and from there you can easily distribute packages to your internal hosts.

呆头 2024-09-23 22:47:28

您可以根据您需要的软件包创建 RPM 软件包。
http://fedoraproject.org/wiki/PackageMaintainers/CreatingPackageHowTo (对于 Fedora,但会是对于 RHEL/CentOS 来说也是如此)

基本上,.spec 文件中会有这样一行:
需要:mysql-server、httpd、php

因此,您可以将其添加到您的 yum 镜像(假设您有一个),然后无论谁进行安装都可以执行yum install server-setup< /code> 它会自动拉入所有必需的包。正如 jathanism 所说,您可以从 setup.py 脚本创建 RPM 并将它们放在镜像上,然后让您的元包依赖于这些 RPM。

如果有可能使用 Debian 系统,您也可以制作 Debian 软件包。

You can create an RPM package that depends on whichever packages you need.
http://fedoraproject.org/wiki/PackageMaintainers/CreatingPackageHowTo (For Fedora, but would be the same for RHEL/CentOS)

You would basically have a line in the .spec file like this:
Requires: mysql-server, httpd, php

So you can add this to your yum mirror (assuming you have one), then whoever is doing the installing can just do yum install server-setup and it'll automatically pull in all the required packages. As jathanism said, you can create RPMs from the setup.py scripts and put those on your mirror, and then just have your meta package depend on those RPMs.

And you could also do a Debian package if there is a possibility of a Debian system being used.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文