Commit d7c77368 authored by Jyothis Jagan's avatar Jyothis Jagan
Browse files

Added session 3

parent a241d4f1
# Basic Package Management
Refer [AptCLI](https://wiki.debian.org/AptCLI)
apt and aptitude are two popular command line package management tools for Debian. The session discussed usage of apt.
## Basic Commands
* `apt install <package>` installs package
* `apt reinstall <package>` reinstalls package
* `apt remove <package>` removes package
* `apt purge <package>` removes package and all its configuration and data files
* `apt upgrade <package>` Upgrades package
* `apt autoclean` removes older debs stored in the system(at `var/cache/apt/archives`)
* `apt clean` removes all cached debs.
## Search for a package
### Serch package a file belongs to
Refer [apt-file](https://wiki.debian.org/apt-file)
`apt-file search <filename>` can be used to find the package in which a file is included.
jyothisjagan@jyothisjagan:~$ apt-file search pq-fe.h
libpq-dev: /usr/include/postgresql/libpq-fe.h
`dpkg -S <filename>` is similar, but you need to have the package installed.
#### Other Options
* https://packages.debian.org for the search on packages.
* https://tracker.debian.org will tell you details about a package (versions, version control, various automated test results and other details relevant to a package maintainer)
## dpkg
`dpkg -l <pattern>` lists packages matching given pattern. 'dpkg -l' lists all packages installled in the system.
jyothisjagan@jyothisjagan:~$ dpkg -l
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============================================-===================================-============-==========================================================
ii accountsservice 0.6.45-2 amd64 query and manipulate user account information
ii accountwizard 4:18.08.3-1 amd64 wizard for KDE PIM applications account setup
ii acl 2.2.53-4 amd64 access control list - utilities
ii acpid 1:2.0.31-1 amd64 Advanced Configuration and Power Interface event daemon
ii adb 1:8.1.0+r23-5 amd64 Android Debug Bridge
ii adduser 3.118 all add and remove users and groups
ii adwaita-icon-theme 3.30.1-1 all default icon theme of GNOME
...
`dpkg -L <package>` lista files installed to the system from a package
jyothisjagan@jyothisjagan:~$ dpkg -L micro
/.
/usr
/usr/bin
/usr/bin/micro
/usr/share
/usr/share/doc
/usr/share/doc/micro
/usr/share/doc/micro/README.md.gz
/usr/share/doc/micro/changelog.Debian.gz
/usr/share/doc/micro/copyright
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/micro.1.gz
`dpkg-reconfigure` can be used to update choices made during package installation.
jyothisjagan@jyothisjagan:~$ sudo dpkg-reconfigure locales
[sudo] password for jyothisjagan:
Generating locales (this might take a while)...
en_GB.UTF-8... done
en_IN.UTF-8... done
en_US.UTF-8... done
ml_IN.UTF-8... done
Generation complete.
`dpkg -S <filename>` searches for filename from installed packages.
jyothisjagan@jyothisjagan:~$ dpkg -S pthread.h
libc6-dev:amd64: /usr/include/pthread.h
autoconf-archive: /usr/share/doc/autoconf-archive/html/ax_005fpthread.html
## Dependencies
apt-cache rdepends mypackage will tell you packages that depends on mypackage
jyothisjagan@jyothisjagan:~$ apt-cache rdepends rails
rails
Reverse Depends:
ruby-sprockets-rails
ruby-haml
passenger
`reverse-depends -b <package>` shows reverse build dependencies
jyothisjagan@jyothisjagan:~$ reverse-depends -b gedit
Reverse-Build-Depends
=====================
* at-spi2-core
* dogtail
## Check Package Version
`apt policy <package>` shows the version of package which is installed or going to be installed.
jyothisjagan@jyothisjagan:~$ apt policy vim
vim:
Installed: 2:8.1.0875-5
Candidate: 2:8.1.0875-5
Version table:
*** 2:8.1.0875-5 500
500 http://deb.debian.org/debian buster/main amd64 Packages
100 /var/lib/dpkg/status
## Upgrading the Distribution
`apt dist-upgrade` - to upgrade your distro to next version.
## Installing Packages from Source Package
Refer [Packaging SourcePackage](https://wiki.debian.org/Packaging/SourcePackage)
> Source packages provide you with all of the necessary files to compile or otherwise, build the desired piece of software.
`apt-get source <package name>` will get you the source package.
Let us install `bc` from source.
First, get source package.
apt source bc
Let us check the contents of the current directory now.
jyothisjagan@jyothisjagan:~/session3$ ls
bc-1.07.1 bc_1.07.1-2.debian.tar.xz bc_1.07.1-2.dsc bc_1.07.1.orig.tar.gz
Now we need to build the package.
apt source -b bc
If build dependencies are met, then it will generate .deb file.
Note: You can install build dependencies using
apt build-dep <package>
## Installing Packages from Third Party Repositories
Here, we are going to install libjs-pdf from https://people.debian.org/~praveen/gitlab/pool/main/p/pdf.js/
1. Add the gpg public key(at https://people.debian.org/~praveen/gitlab/) as a trusted key.
apt-key add praveen.key.asc
2. Add sources.list entry. For that we can download `gitlab.list` to `/etc/apt/sources.list.d`
3.
apt update
apt install
## Installing Packages from backports
Refer [Instructions](https://backports.debian.org/Instructions/)
Here, we are going to install geary.
1. Add backports to your sources.list
deb http://deb.debian.org/debian buster-backports main
2. Run `apt-get update`
3. Install the package from backports
apt-get -t buster-backports install geary
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment