Editing Debian package management

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
== intro ==
* dpkg – Debian package … – for handling the packages themselves
* APT – "Advanced Packaging Tool" – on top of dpkg commands, dealing with dependencies and repositories
* apt-... – addons to APT
== APT ==
== APT ==


* the Debian [http://en.wikipedia.org/wiki/Advanced_Packaging_Tool APT = Advanced Packaging Tool]
* the Debian [http://en.wikipedia.org/wiki/Advanced_Packaging_Tool APT = Advanced Packaging Tool]
** [http://en.wikipedia.org/wiki/Advanced_Packaging_Tool#Update.2C_upgrade_and_dist-upgrade update, upgrade, ...]
** [http://en.wikipedia.org/wiki/Advanced_Packaging_Tool#Update.2C_upgrade_and_dist-upgrade update and upgrade]
* apt-cache
* apt-get
* ...
 
=== apt-cache -- query the APT cache ===
 
* https://manpages.debian.org/unstable/apt/apt-cache.8.en.html
 
<pre>
<pre>
# ...
$ sudo apt-get update  # update is used to resynchronize the package index files from their sources
apt-cache pkgnames | sort
$ sudo apt-get upgrade # upgrade is used to install the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list
 
# perform a full text search on all available package lists for the POSIX regex pattern given
# (options available)
$ apt-cache search regex...
$ apt-cache search --names-only regex...
$ apt-cache search --full regex...
</pre>
</pre>


=== apt-get -- APT package handling utility -- command-line interface ===
== dealing with packages files (dpkg ... .deb) ==


* https://manpages.debian.org/unstable/apt/apt-get.8.en.html
* https://manpages.debian.org/unstable/dpkg/dpkg.1.en.html
* https://manpages.debian.org/experimental/apt/apt-get.8.en.html
* http://man7.org/linux/man-pages/man1/dpkg.1.html
 
* https://www.systutorials.com/docs/linux/man/1-dpkg/
==== APT: resynchronising the package index files from their sources ====
<pre>$ sudo apt-get update</pre>
 
==== APT: installing ... ====
<pre>
$ sudo apt-get install PACKAGE
 
# do not *really* install the PACKAGE,
# just download it to the default cache directory:
$ sudo apt-get install --download-only PACKAGE
 
# do not *really* install the PACKAGE,
# just download it to the cache directory being specified (instead of /var/cache/apt/archives/):
$ sudo apt-get install --download-only --option dir::cache=$HOME/tmp PACKAGE
 
# install PACKAGE
$ sudo apt-get install PACKAGE
</pre>
 
==== APT: installing the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list ====
<pre>
$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade
</pre>
 
==== APT: removing ... ====
<pre>
$ sudo apt-get remove PACKAGE
$ sudo apt-get autoremove PACKAGE
</pre>
 
=== apt-rdepends - performs ... dependency listings (also a reverse one) ===
 
* https://manpages.debian.org/unstable/apt-rdepends/apt-rdepends.1.en.html
 
<pre>
$ apt-rdepends --reverse PACKAGE
</pre>
 
In case of an optional resp. alternate dependency that's not shown (clearly).
 
=== which (installed?) package includes a certain FILE (utility, ...)? ===
<pre>$ apt-file search PATTERN</pre>
 
=== which files does a certain PACKAGE include? ===
<pre>$ apt-file list PACKAGE</pre>
 
== dpkg, dpkg-query, dpkg-deb ==


=== dpkg ===
what's the official package name?
<pre>$ dpkg --info PACKAGE.deb</pre>


* https://manpages.debian.org/unstable/dpkg/dpkg.1.en.html
which files are included? will be created from this package file?
<pre>$ dpkg --contents PACKAGE.deb</pre>


==== installing a Debian package ====
install the Debian package:
<pre>$ sudo dpkg --install PACKAGE.deb</pre>
<pre>$ sudo dpkg --install PACKAGE.deb</pre>


==== removing a Debian package ====
== dealing with installed packages (dpkg-query) ==
<pre>$ sudo dpkg --remove PACKAGE</pre>
 
==== verifying a Debian package ====
<pre>$ sudo dpkg --verify PACKAGE</pre>
 
=== dpkg-deb -- Debian package archive (.deb) manipulation tool ===
 
* https://manpages.debian.org/unstable/dpkg/dpkg-deb.1.en.html
 
'''dpkg-deb''' packs, unpacks and provides information about Debian archives.
 
Use '''dpkg''' to install and remove packages from your system.
 
==== which files are included? will be created from this package file? ====
<pre>$ dpkg-deb --contents PACKAGE.deb</pre>
 
==== what's the official package name? ====
<pre>$ dpkg-deb --info PACKAGE.deb</pre>
 
==== what is the content of the ctrl-tarfile you can extract from PACKAGE.deb? ====
<pre>$ dpkg-deb --ctrl-tarfile PACKAGE.deb | tar tvf  -
drwxr-xr-x root/root        0 2018-08-27 17:39 ./
-rw-r--r-- root/root    21773 2018-08-27 17:39 ./md5sums
-rw-r--r-- root/root      229 2018-08-27 17:39 ./control
-rw-r--r-- root/root      1071 2018-08-27 17:36 ./conffiles
-rwxr-xr-x root/root      1228 2018-08-27 17:39 ./postinst</pre>
 
* PACKAGE.deb contains a tarball (ctrl-tarfile).
* the tarball contains ... .
 
==== what conffiles does PACKAGE.deb contain? ====
<pre>$ dpkg-deb --ctrl-tarfile PACKAGE.deb | tar xf  - --to-stdout ./conffiles</pre>
 
* PACKAGE.deb contains a tarball (ctrl-tarfile),
* the tarball contains ./conffiles,
* ./conffiles is only a list of what is to be treated as conffiles, it does not contain the conffiles themselves, they are an ordinary part of PACKAGE.deb
 
=== dpkg-query ===


* https://manpages.debian.org/unstable/dpkg/dpkg-query.1.en.html
* https://manpages.debian.org/unstable/dpkg/dpkg-query.1.en.html
* http://man7.org/linux/man-pages/man1/dpkg-query.1.html
* https://www.systutorials.com/docs/linux/man/1-dpkg-query/


==== which packages are installed (together with a '''couple''' of details)? ====
which packages are installed (together with a '''couple''' of details)?
<pre>$ dpkg-query --list</pre>
<pre>$ dpkg-query --list</pre>


==== is there an installed package, that sounds like XYZ? ====
is there an installed package, that sounds like XYZ?
<pre>$ dpkg-query --list | fgrep XYZ</pre>
<pre>$ dpkg-query --list | fgrep XYZ</pre>


==== details of an installed package (that you know the name of, e.g. PACKAGE) ====
details of an installed package (that you know the name of, e.g. PACKAGE):
<pre>$ dpkg-query --list PACKAGE</pre>
<pre>$ dpkg-query --list PACKAGE</pre>


==== all details of specified package ====
all details of specified package:
<pre>$ dpkg-query --status PACKAGE</pre>
<pre>$ dpkg-query --status PACKAGE</pre>


==== what's the content of an installed package (e.g. PACKAGE) ====
what's the content of an installed package (e.g. PACKAGE)?
<pre>$ dpkg-query --listfiles PACKAGE</pre>
<pre>$ dpkg-query --listfiles PACKAGE</pre>


==== what conffiles does an installed package (e.g. PACKAGE) include ====
which installed package includes a certain FILE (utility, ...)?
<pre>$ dpkg-query --showformat='${Conffiles}\n' --show PACKAGE
$ dpkg-query --showformat='${Conffiles}\n' --show PACKAGE | perl -pe 's/^ \s* (.*?) \s* \w+ $/$1/x'</pre>
 
===== backup all the conffiles of an installed package (e.g. PACKAGE), each one for itself =====
<pre>$ sudo ~jochen.hayek/bin/create_snapshot.sh $( dpkg-query --showformat='${Conffiles}\n' --show PACKAGE | perl -pe 's/^ \s* (.*?) \s* \w+ $/$1/x' )</pre>
 
===== backup all the conffiles of an installed package (e.g. PACKAGE) to a single tarball =====
<pre>$ sudo tar cvf ~/tmp/PACKAGE.conffiles-$(date '+%Y%m%d%H%M%S').tar --directory / $( dpkg-query --showformat='${Conffiles}\n' --show PACKAGE | perl -pe 's/^ \s* (.*?) \s* \w+ $/$1/x' )</pre>
 
==== which installed package includes a certain FILE (utility, ...)? ====
<pre>$ dpkg-query --search FILE</pre>
<pre>$ dpkg-query --search FILE</pre>


= misc =
== ... (dpkg-source) ==
 
* https://superuser.com/questions/408082/how-do-i-get-a-list-of-available-i-e-uninstalled-packages-in-debian How do I get a list of available (i.e. uninstalled) packages in Debian?
 
= dpkg-source -- Debian source package (.dsc) manipulation tool =


* https://manpages.debian.org/unstable/dpkg-dev/dpkg-source.1.en.html
* https://manpages.debian.org/unstable/dpkg-dev/dpkg-source.1.en.html


...
<pre>$ dpkg-source --extract ....dsc</pre>
<pre>$ dpkg-source --extract ....dsc</pre>
needs a:
needs a:
Line 172: Line 58:
* *.orig.tar.*
* *.orig.tar.*


= rpm2deb -- converting packages from ... to ... =
== rpm2deb ==


* https://en.wikipedia.org/wiki/Rpm_(software)
* https://en.wikipedia.org/wiki/Rpm_(software)
Line 181: Line 67:
* https://www.howtoforge.com/converting_rpm_to_deb_with_alien : alien -k ... ('''important''')
* https://www.howtoforge.com/converting_rpm_to_deb_with_alien : alien -k ... ('''important''')
* https://unix.stackexchange.com/questions/9714/what-is-the-need-for-fakeroot-command-in-linux#9720 ('''important''')
* https://unix.stackexchange.com/questions/9714/what-is-the-need-for-fakeroot-command-in-linux#9720 ('''important''')
* https://salsa.debian.org/perl-team/modules/packages/libdbd-oracle-perl/blob/master/debian/README -- Oracle's Instant Client package comes as RPM -- how to convert to .deb


== alien --to-deb ... ==
=== alien --to-deb ... ===
this command line creates a Debian package from an RPM package
this command line creates a Debian package from an RPM package
(using that e-mail address for the (local Debian) package maintainer).<br/>
(using that e-mail address for the (local Debian) package maintainer).<br/>
CAVEAT: won't actually work, because creating a Debian package requires running this as root
CAVEAT: won't actually work, because creating a Debian package requires running this as root
<pre>$ env EMAIL='john.doe@COMPANY.com' alien --to-deb --keep-version ...</pre>
<pre>$ env EMAIL='john.doe@COMPANY.com' alien --to-deb --keep-version ...</pre>
some command line parameters can only get passed to "alien" as environment variables.
some command line parameters can only get passied to "alien" as environment variables.


== fakeroot ... ==
=== fakeroot ... ===
you do not have root priviliges,
you do not have root priviliges,
but you need to pretend to have them for achieving certain goals like creating a Debian package:
but you need to pretend to have them for achieving certain goals like creating a Debian package:
<pre>$ fakeroot ...</pre>
<pre>$ fakeroot --unknown-is-real ...</pre>
 
== special issues ==
=== fiddling with the tree before creating the .deb ===
<pre>$ env EMAIL='john.doe@COMPANY.com' alien --to-deb --keep-version ...
$ cd ...
# here you want to change a few bits
$ sudo chown ...
$ fakeroot debian/rules binary
</pre>


== open questions ==
=== open questions ===


* how to deal with dependencies specified within the RPM package?
* how to deal with dependencies specified within the RPM package?
* …
* …


= history of this article =
== history of this article ==


This blog article got created 1st, but then the content got moved here to the wiki:
The blog article got created 1st, but then the content got moved here:
* http://Jochen.Hayek.name/wp/blog-en/2018/04/13/rpm2deb/
* http://Jochen.Hayek.name/wp/blog-en/2018/04/13/rpm2deb/


[[Category:ToBeExported]]
[[Category:ToBeExported]]
Please note that all contributions to wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Wiki:Copyrights for details). Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)