构建 ubuntu 服务器包
我在 Ubuntu 桌面上开发了一些 C++ 应用程序。我想创建安装包,以便可以将它们安装在 Ubuntu 服务器上。
谁能提供有关如何创建 Ubuntu 服务器包的指南?
I have developed some C++ apps on my Ubuntu desktop. I want to create installation packages so that I can install them on a Ubuntu server.
Can anyone provide guidelines on how to create an Ubuntu server package?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最简单的方法是在 makefile 中创建一个“安装”部分来安装程序,然后运行
checkinstall
。您可能需要使用aptitude install checkinstall
来安装它。checkinstall 运行
make install
,找出更改的内容,然后基于它构建一个包。要在 makefile 中执行安装部分,只需输入安装程序所需的命令即可。下面是一个程序示例,该程序创建一个名为“myprogram”的二进制文件,并需要在 /etc 中进行一些配置:
有一个名为
install
的命令,它类似于cp
并允许您指定权限,但我不太了解语法。您还需要为每个 .o 文件指定一个部分,说明如何编译它(可能是
gcc -c filename.cpp
)。The easiest way is to create an "install" section in your makefile which will install the program, then run
checkinstall
. You may need to install it withaptitude install checkinstall
.checkinstall runs
make install
, finds out what was changed, then builds a package based on it.To do the install section in a makefile, just put the commands it would take to install your program. Here's an example of a program that creates a binary called "myprogram" and needs some configuration in /etc:
There's a command called
install
that's likecp
and lets you specify permissions, but I don't know the syntax well enough.You'd also need a section for each .o file that says how to compile it (probably
gcc -c filename.cpp
).Ubuntu 使用 Debian 软件包格式 (.deb)。生成的包可以针对某个体系结构(例如 i386、AMD64 等),也可以独立于体系结构。
然后,您可以使用“dpkg -i packagefile.deb”作为 root 来安装生成的包。
现在更重要的是:我建议您查找有关如何制作 Debian 软件包的信息。我确信有很多很好的参考网站和工具,例如这个: http://debcreator .cmsoft.net/
Ubuntu uses the Debian package format (.deb). The resulting package can target an architecture (such as i386, AMD64, etc) or be architecture independent.
Then you can install the resulting package with 'dpkg -i packagefile.deb' as root.
Now more to the point: I suggest you to look for information about how to make a Debian package. I'm sure there are plenty of good reference sites out there and also tools, such as this one: http://debcreator.cmsoft.net/