从Ubuntu 16.04的源中创建一个.deb文件
时间:2020-03-21 11:43:13 来源:igfitidea点击:
Ubuntu在官方和非官方存储库中有数千个.deb文件。
但是,所有软件包都无法以DEB格式提供。
有时,封装可能仅适用于基于RPM的发行版或者基于拱的发行版。
在这种情况下,了解如何从源文件创建.deb文件是很重要的。
在这篇简短的教程中,让我们了解如何从Ubuntu 16.04 LT中的源文件中创建一个.deb文件。
本教程应适用于所有基于Deb的系统,如Debian,Linux Mint和基本操作系统等。
从Ubuntu的源中创建.deb文件
首先,我们需要安装所需的依赖项来编译并从源文件中创建Deb文件。
为此,运行:
sudo apt-get install checkinstall build-essential automake autoconf libtool pkg-config libcurl4-openssl-dev intltool libxml2-dev libgtk2.0-dev libnotify-dev libglib2.0-dev libevent-dev
我们已安装所需的依赖项。
让我们继续下载包的源文件。
下载源tar包.
出于本教程的目的,让我们为Leafpad源文件创建.deb文件。
如我们所知,Leafpad是简单的图形文本编辑器。
转到Leafpad主页并下载Tar文件。
wget http://tarot.freeshell.org/leafpad/leafpad-0.8.17le2.tar.bz2
然后,提取下载的Tar文件,如下所示。
tar xvjf leafpad-0.8.17le2.tar.bz2
然后,转到提取的文件夹,并逐个运行以下命令以编译源代码:
cd leafpad-0.8.17le2/
./configure
注意:如果找不到/配置命令,请跳过并继续下一个命令。
make
最后,运行以下命令从源代码中创建.deb文件。
sudo checkinstall
示例输出:
在要求为DEB文件创建描述时键入y。
checkinstall 1.6.2, Copyright 2009 Felipe Eduardo Sanchez Diaz Duran This software is released under the GNU GPL. The package documentation directory ./doc-pak does not exist. Should I create a default set of package docs? [y]: y
接下来,键入DEB文件的描述,然后按"输入双倍时间"继续。
Preparing package documentation...OK Please write a description for the package. End your description with an empty line or EOF. >> This Leafpad DEB file has been created from source code >> EOF
在下一个屏幕中,我们将看到要从IT创建Deb文件的源文件的详细信息。
将根据这些详细信息构建DEB包。
查看详细信息,并根据愿望更改它们。
* Debian package creation selected *** * This package will be built according to these values: 0 - Maintainer: [ Hyman@theitroad ] 1 - Summary: [ This Leafpad DEB file has been created from source code ] 2 - Name: [ leafpad ] 3 - Version: [ 0.8.17 ] 4 - Release: [ 1 ] 5 - License: [ GPL ] 6 - Group: [ checkinstall ] 7 - Architecture: [ amd64 ] 8 - Source location: [ leafpad-0.8.17 ] 9 - Alternate source location: [ ] 10 - Requires: [ ] 11 - Provides: [ leafpad ] 12 - Conflicts: [ ] 13 - Replaces: [ ]
例如,我想更改维护者电子邮件ID。
为此,请按数字"0"。
键入维护电子邮件,然后按Enter键。
Enter a number to change any of them or press ENTER to continue: 0 Enter the maintainer's name and e-mail address: >> Hyman@theitroad
最后,如果我们提供详细信息,请按Enter键。
.deb包已成功构建,并自动安装。
** Done. The new package has been installed and saved to /home/theitroad/leafpad-0.8.17/leafpad_0.8.17-1_amd64.deb You can remove it from your system anytime using: dpkg -r leafpad **
.deb将保存在我们提取源文件的目录中。
让我们查看源目录的内容:
ls
示例输出:
ABOUT-NLS config.sub intltool-extract missing aclocal.m4 configure intltool-extract.in mkinstalldirs AUTHORS configure.ac intltool-merge NEWS ChangeLog COPYING intltool-merge.in po compile data intltool-update README config.guess depcomp intltool-update.in src config.h description-pak leafpad_0.8.17-1_amd64.deb stamp-h1 config.h.in doc-pak Makefile config.log INSTALL Makefile.am config.status install-sh Makefile.in Hyman@theitroad:~/leafpad-0.8.17$
正如我们在上面的输出中看到的那样,Deb文件已成功创建并保存在源目录本身中。
我们还可以删除已安装的DEB包,如下所示。
sudo dpkg -r leafpad