UNIVERSITY OF ENGINEERING AND TECHNOLOGY, TAXILA
FACULTY OF TELECOMMUNICATION AND INFORMATION ENGINEERING
Computer ENGINEERING DEPARTMENT
Lab # 2
System Programming
Course Instructor: Dr. Adnan Mustafa
Date: 20/01/2025
System Programming 8th Semester-2k21-CP UET Taxila
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, TAXILA
FACULTY OF TELECOMMUNICATION AND INFORMATION ENGINEERING
Computer ENGINEERING DEPARTMENT
Objectives:
Complete Understanding of Commands regarding the installation of a package on both
RHEL & Debian Platform
Package Management:
Most Linux distributions have a package management system with online repositories
containing thousands of packages. This makes it very easy to install and remove applications,
operating system components, documentation and much more. We first discuss the Debian
package format .deb and its tools. This should be similar on Debian, Ubuntu, Mint and all
derived distributions. Then we look at the Red Hat package format. rpm and its tools rpm and
yum. This should be similar on Red Hat, Fedora, CentOS and all derived distributions.
Repository:
A lot of software and documentation for your Linux distribution is available as packages in one
or more centrally distributed repositories. These packages in such a repository are tested and
very easy to install (or remove) with a graphical or command line installer.
.deb packages:
Debian, Ubuntu, Mint and all derivatives from Debian and Ubuntu use .deb packages. To
manage software on these systems, you can use aptitude or apt-get, both these tools are a front
end for dpkg.
. rpm packages:
Red Hat, Fedora, CentOS, OpenSUSE, Mandriva, Red Flag and others use. rpm packages.
The tools to manage software packages on these systems are yum and rpm.
Dependency:
Some packages need other packages to function. Tools like apt-get, aptitude and yum will
install all dependencies you need. When using dpkg or rpm, or when building from source,
you will need to install dependencies yourself. deb package management:
There are three tools to manage deb package.
• dpkg
• apt-get
• aptitude
System Programming 8th Semester-2k21-CP UET Taxila
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, TAXILA
FACULTY OF TELECOMMUNICATION AND INFORMATION ENGINEERING
Computer ENGINEERING DEPARTMENT
dpkg:
dpkg is a low-level tool to manage packages in Debian because you have to manually resolve all
the dependencies.
Here are the few commands for dpkg
(Note make sure you are login as root or switch user using sudo su -)
dpkg -l:
it will show the list of all the packages installed on your Debian platform.
It can also display total number of packages installed.
By using dpkg -l you can also get the information about individual package by dpkg -l
$package. ii in the beginning mean package is installed.
System Programming 8th Semester-2k21-CP UET Taxila
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, TAXILA
FACULTY OF TELECOMMUNICATION AND INFORMATION ENGINEERING
Computer ENGINEERING DEPARTMENT
dpkg -S:
You can find the package that installed a certain file on your computer with dpkg -S by using
the following syntax dpkg -S filepath.
dpkg -L:
you can obtain the list of files installed by specific package with dpkg -L by using syntax
dpkg -L $package
dpkg -i and dpkg -r:
You can install any package on Debian with dpkg -i and you can remove any package with
dpkg
System Programming 8th Semester-2k21-CP UET Taxila
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, TAXILA
FACULTY OF TELECOMMUNICATION AND INFORMATION ENGINEERING
Computer ENGINEERING DEPARTMENT
-r by using following syntax
dpkg -i $package.deb
apt-get
Debian has been using apt-get to manage packages since 1998. Today Debian and many
Debian-based distributions still actively support apt-get, though some experts claim aptitude is
better at handling dependencies than apt-get
apt-get update:
you can download the names, description and version of all the packages available on all
configured repositories of your system. The output will look like this
System Programming 8th Semester-2k21-CP UET Taxila
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, TAXILA
FACULTY OF TELECOMMUNICATION AND INFORMATION ENGINEERING
Computer ENGINEERING DEPARTMENT
apt-get upgrade:
you can securely update all the software installed on your system with apt-get update
apt-get clean:
apt-get keeps a copy of downloaded packages in /var/cache/apt/archives. You can remove
the .deb files from that folder with apt-clean apt-get install:
you can install new package with apt-get install by using syntax apt-
get install $package
apt-get remove: apt-get remove will remove any individual
package from the system.
System Programming 8th Semester-2k21-CP UET Taxila
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, TAXILA
FACULTY OF TELECOMMUNICATION AND INFORMATION ENGINEERING
Computer ENGINEERING DEPARTMENT
apt-get purge
You can purge one or more applications by appending their name behind apt-get purge.
Purging will also remove all existing configuration files related to that application. The
screenshot shows how to purge the rsync package.
aptitude:
Aptitude is another way to manage packages on Debian. The main advantage aptitude is the
capability to automatically resolve dependencies. It has same function as apt-get and syntax is
also same with aptitude.
Here are some commands and their functions
aptitude update:
To synchronize with the repositories.
System Programming 8th Semester-2k21-CP UET Taxila
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, TAXILA
FACULTY OF TELECOMMUNICATION AND INFORMATION ENGINEERING
Computer ENGINEERING DEPARTMENT
aptitude upgrade:
To patch and upgrade all software to the latest version on Debian.
aptitude safe-upgrade:
To patch and upgrade all software to the latest version on Ubuntu and Mint.
System Programming 8th Semester-2k21-CP UET Taxila
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, TAXILA
FACULTY OF TELECOMMUNICATION AND INFORMATION ENGINEERING
Computer ENGINEERING DEPARTMENT
aptitude install $package:
To install an application with all dependencies, use following syntax
aptitude install $package
aptitude search $string:
To search the repositories for applications that contain a certain string in their name or
description.
System Programming 8th Semester-2k21-CP UET Taxila
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, TAXILA
FACULTY OF TELECOMMUNICATION AND INFORMATION ENGINEERING
Computer ENGINEERING DEPARTMENT
aptitude remove $package:
To remove an application.
aptitude purge $package
To remove an application and all configuration files.
System Programming 8th Semester-2k21-CP UET Taxila
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, TAXILA
FACULTY OF TELECOMMUNICATION AND INFORMATION ENGINEERING
Computer ENGINEERING DEPARTMENT
.rpm
The Red Hat package manager can be used on the command line with rpm
Here are the few commands for rpm
rpm -qa:
You can obtain the list of all the software/packages installed on your system with rpm -qa
You can also check whether particular package installed on your system by
rpm -qa | grep $package
You can also obtain total number of packages installed by wc.
System Programming 8th Semester-2k21-CP UET Taxila
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, TAXILA
FACULTY OF TELECOMMUNICATION AND INFORMATION ENGINEERING
Computer ENGINEERING DEPARTMENT
rpm -q:
you can verify whether particular package install on your system by rpm -q $package
Rpm -Uvh:
You can install or upgrade any package with -Uvh switch. The -U switch is the same as -i for
install, except that older versions of the software are removed. The -vh switches are for nicer
output
Note:
Rpm cannot resolve dependency itself so you have to manually install all the dependencies.
rpm -e:
You can remove any package with rpm -e $package
System Programming 8th Semester-2k21-CP UET Taxila
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, TAXILA
FACULTY OF TELECOMMUNICATION AND INFORMATION ENGINEERING
Computer ENGINEERING DEPARTMENT
/var/lib/rpm:
The rpm database is located at /var/lib/rpm. This database contains all meta information about
packages that are installed (via rpm). It keeps track of all files, which enables complete removes
of software.
Yum:
Yum is another tool to manage packages in Red hat or Fedora Enterprise systems. The
advantage to yum over rpm is that it resolve dependencies itself so you can install packages
much easier than rpm.
Yum list:
You can obtain the list of all the packages installed on your system with yum list.
You can get the total number of packages installed on system by yum list | wc.
System Programming 8th Semester-2k21-CP UET Taxila
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, TAXILA
FACULTY OF TELECOMMUNICATION AND INFORMATION ENGINEERING
Computer ENGINEERING DEPARTMENT
You can check all the versions of one package by yum list $package
Yum search:
Yum can search for particular package by using
Yum search $package
System Programming 8th Semester-2k21-CP UET Taxila
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, TAXILA
FACULTY OF TELECOMMUNICATION AND INFORMATION ENGINEERING
Computer ENGINEERING DEPARTMENT
yum provides:
To search for a package containing a certain file (you might need for compiling things) use
yum provides $filename
System Programming 8th Semester-2k21-CP UET Taxila
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, TAXILA
FACULTY OF TELECOMMUNICATION AND INFORMATION ENGINEERING
Computer ENGINEERING DEPARTMENT
yum install:
To install an application, use yum install $package. Naturally yum will install all the
necessary dependencies.
yum update:
System Programming 8th Semester-2k21-CP UET Taxila
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, TAXILA
FACULTY OF TELECOMMUNICATION AND INFORMATION ENGINEERING
Computer ENGINEERING DEPARTMENT
To bring all applications up to date, by downloading and installing them, issue yum update.
All software that was installed via yum will be updated to the latest version that is available
in the repository
If you want to update individual package use Yum update $package
Yum grouplist:
Yum grouplist is used to see list of all available software groups.
System Programming 8th Semester-2k21-CP UET Taxila
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, TAXILA
FACULTY OF TELECOMMUNICATION AND INFORMATION ENGINEERING
Computer ENGINEERING DEPARTMENT
Yum groupinstall:
You can install set of application brought together by group by using groupinstal $groupname
Lab Task:
• Install any package using dpkg.
System Programming 8th Semester-2k21-CP UET Taxila
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, TAXILA
FACULTY OF TELECOMMUNICATION AND INFORMATION ENGINEERING
Computer ENGINEERING DEPARTMENT
• Verify whether gcc, sudo and wesnoth are installed in ubuntu.
• Use yum to search for and install the scp, tmux, and man-pages packages. Did you find
them all?
• First install and then remove samba including configuration files.
• First obtain list of all group software and Install E-mail server using group install.
System Programming 8th Semester-2k21-CP UET Taxila