Package Management in Ubuntu/Debian
dpkg: Debian Package Manager
It is responsible for installing packages
.deb file is a compressed archive (ar file format) it includes all files needed for the program to run,= and its installation on the system.
To get debian packages for ubuntu
Go to https://packages.ubuntu.com
Get Ubuntu code name: lsb_release -a
Reconfigure DPKG package
Dependency Management with apt
apt or apt-get search packages in the packages repositories configured in /etc/apt/sources.list or /etc/apt/sources.list.d/*
Update Package Definitions
This updates the list of available versions of all packages installed on the ubuntu system from the configured repositories.
Upgrade the packages
Managing full-upgrade / dist-upgrade
dist-upgrade is equivalent to full-upgrade , this can remove some important dependencies packages
Auto removing packages
Source List Management
Structure of line in /etc/apt/source.list
deb http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted
Field one deb: conatins binary packages, deb-src: This contains source packages
Field 2: URI
Field 3 or Field 4 ... : Domains,
Domains: main and universe are free, restricted and multiverse are non-free, code-updates : major bug fixes, code-backports: new version of software
Other format of Sources file
Types: deb
URIs: http://
Suites: code
Components: main
Architecture: amd64 i386
Signed-By: /etc/apt/Keyrings/XXXXXX.key
Custom Repositories
- Creating a new file in
/etc/apt/sources.list.d/* - Adding GPG key to our system for this repository
- Updating the system after adding is recommended
PPA on ubuntu
This works on ubuntu not on debian
Steps:
- Goto https://launchpad.net/ubuntu+ppas
- Search the repository
sudo apt-add-repository ppa:person/package- It will add a file in /etc/apt/source.list.d/
- Update the defnitions of the system
To remove ppa repo
sudo apt-add-repository -remove ppa:person/package
Verifying installation: debsums
Check all packages
Check all packages that has changed
Check all packages that do not have md5
Debug dependencies
Find the dependencies of the packages
Pre-Depends: Should be installed before the package is unpacked and installed
Depends: Should also be installed before the package is unpacked and installed
Recommends: Not required, but should be installed unless any special requirements arise
Suggest: not required, can be ignored
Replaces: Will remove any dependencies that are causing conflicts
Conflict resolution
-f = --fix-broken
To overwrite by ignoring dependencies while installing package using dpkg
If software is not launching due to dependency conflict
- Remove unnecessary packages:
sudo apt autoremove - Remove conflicting packages, and update and upgrade
- Remove the software and install again from official repository