PackageManagement - ErikStaats/Notes GitHub Wiki

Package Management Notes

Links

How to create a Debian package

In this example, an empty Debian package that depends on make is created. It is then used to install make.

Start by creating the directory "my-pkg/DEBIAN" and add the file named "control". The "control" file contains all the package information.

CarbonX1$ mkdir -p my-pkg/DEBIAN
CarbonX1$ vi my-pkg/DEBIAN/control
CarbonX1$ cat my-pkg/DEBIAN/control
Package: my-pkg
Version: 1
Maintainer: Erik Staats
Architecture: all
Description: My Package
Depends: make

CarbonX1$

Next, create the package using "dpkg-deb --build".

CarbonX1$ dpkg-deb --build my-pkg
dpkg-deb: building package 'my-pkg' in 'my-pkg.deb'.
CarbonX1$ ls
my-pkg  my-pkg.deb
CarbonX1$

To install the package, use "dpkg -i". An error will be encountered due to the dependency on make. Use "apt-get install -f" to fix the broken dependencies and complete the installation.

CarbonX1$ which make
CarbonX1$ sudo dpkg -i my-pkg.deb
.
.
.
Unpacking my-pkg (1) ...
dpkg: dependency problems prevent configuration of my-pkg:
 my-pkg depends on make; however:
  Package make is not installed.
.
.
.
Errors were encountered while processing:
 my-pkg
CarbonX1$ sudo apt-get install -f
.
.
.
The following additional packages will be installed:
  make
.
.
.
Setting up make (4.1-9.1ubuntu1) ...
Setting up my-pkg (1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
CarbonX1$ which make
/usr/bin/make
CarbonX1$

How to remove a Debian package

To remove a Debian package, use "dpkg --remove".

CarbonX1$ which make
/usr/bin/make
CarbonX1$ sudo dpkg --remove make
(Reading database ... 173035 files and directories currently installed.)
Removing make (4.1-9.1ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
CarbonX1$ which make
CarbonX1$
⚠️ **GitHub.com Fallback** ⚠️