Table of Contents
In this article, we will see how to install libpcap-dev package on Ubuntu 20.04 LTS (Focal Fossa). libpcap, also known as packet capture library is a free and open source C/C++library for user-level network traffic capture. libpcap provides a lightweight portable framework for low-level network monitoring. It allows developers to capture link layer packets without worrying much about the local system architecture. It is quite easy to install and use in almost all the famous platforms. libpcap library usually comes in bundled as development library package called libpcap-dev. So to install the library you have to install libpcap-dev package. Here we will see the steps to install libpcap-dev package on Ubuntu 20.04 LTS based systems.
How to Install libpcap-dev package on Ubuntu 20.04 LTS (Focal Fossa)
Also Read: How to Install Nemo File Manager on Ubuntu 20.04 LTS (Focal Fossa)
Step 1: Prerequisites
a) You should have a running Ubuntu 20.04 LTS
Server.
b) You should have sudo
or root
access to run privileged commands.
c) You should have apt
or apt-get
utility available in your Server.
Step 2: Update Your Server
Before installing the libpcap library package, it is essential to check for all the latest available updates and install them by using sudo apt update && sudo apt upgrade
command as shown below.
cyberithub@ubuntu:~$ sudo apt update && sudo apt upgrade
Hit:1 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:2 http://ppa.launchpad.net/flatpak/stable/ubuntu focal InRelease
Hit:3 https://d3nt0h4h6pmmc4.cloudfront.net/ubuntu focal InRelease
Hit:4 https://dl.winehq.org/wine-builds/ubuntu focal InRelease
Hit:5 http://in.archive.ubuntu.com/ubuntu focal InRelease
Hit:6 https://dl.google.com/linux/chrome/deb stable InRelease
Hit:7 http://ppa.launchpad.net/gencfsm/ppa/ubuntu focal InRelease
Hit:8 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:9 https://download.sublimetext.com apt/stable/ InRelease
Hit:10 http://ppa.launchpad.net/juju/stable/ubuntu focal InRelease
Hit:11 http://in.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:12 https://ngrok-agent.s3.amazonaws.com buster InRelease
Hit:13 http://ppa.launchpad.net/libreoffice/ppa/ubuntu focal InRelease
Hit:14 https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal pgadmin4 InRelease
Hit:15 http://ppa.launchpad.net/mojo-maintainers/ppa/ubuntu focal InRelease
Hit:16 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu focal InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
2 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
Get more security updates through Ubuntu Pro with 'esm-apps' enabled:
node-hosted-git-info python2.7-minimal python2.7 node-tar libgsasl7
libopusfile0 libjs-jquery-ui libsdl2-2.0-0 libsdl2-2.0-0
libpython2.7-minimal libpython2.7-stdlib
Learn more about Ubuntu Pro at https://ubuntu.com/pro
The following packages have been kept back:
xdg-desktop-portal xdg-desktop-portal-gtk
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
Step 3: Install libpcap-dev
In the next step, you can install libpcap-dev package from default ubuntu repo by using sudo apt install libpcap-dev
command as shown below. This will download and install the package along with all its dependencies.
cyberithub@ubuntu:~$ sudo apt install libpcap-dev Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: libpcap0.8-dev The following NEW packages will be installed: libpcap-dev libpcap0.8-dev 0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded. Need to get 248 kB of archives. After this operation, 852 kB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://in.archive.ubuntu.com/ubuntu focal/main amd64 libpcap0.8-dev amd64 1.9.1-3 [244 kB] Get:2 http://in.archive.ubuntu.com/ubuntu focal/main amd64 libpcap-dev amd64 1.9.1-3 [3,484 B] Fetched 248 kB in 1s (197 kB/s) Selecting previously unselected package libpcap0.8-dev:amd64. (Reading database ... 258301 files and directories currently installed.) Preparing to unpack .../libpcap0.8-dev_1.9.1-3_amd64.deb ... Unpacking libpcap0.8-dev:amd64 (1.9.1-3) ... Selecting previously unselected package libpcap-dev:amd64. Preparing to unpack .../libpcap-dev_1.9.1-3_amd64.deb ... Unpacking libpcap-dev:amd64 (1.9.1-3) ... Setting up libpcap0.8-dev:amd64 (1.9.1-3) ... Setting up libpcap-dev:amd64 (1.9.1-3) ... Processing triggers for man-db (2.9.1-1) ...
Step 4: Verify Installation
After successful installation, you can verify the installed files path by using dpkg -L libpcap-dev
command as shown below.
cyberithub@ubuntu:~$ dpkg -L libpcap-dev
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/libpcap-dev
/usr/share/doc/libpcap-dev/copyright
/usr/share/doc/libpcap-dev/changelog.Debian.gz
Step 5: Uninstall libpcap-dev
Although I wouldn't recommend but still if in case you are looking to uninstall libpcap-dev package from your system then you have to run sudo apt remove libpcap-dev
command as shown below. Again, be careful in running below command as removal of libpcap-dev package might break some of the active running applications in your system.
cyberithub@ubuntu:~$ sudo apt remove libpcap-dev Reading package lists... Done Building dependency tree Reading state information... Done The following package was automatically installed and is no longer required: libpcap0.8-dev Use 'sudo apt autoremove' to remove it. The following packages will be REMOVED: libpcap-dev 0 upgraded, 0 newly installed, 1 to remove and 2 not upgraded. After this operation, 20.5 kB disk space will be freed. Do you want to continue? [Y/n] Y (Reading database ... 258407 files and directories currently installed.) Removing libpcap-dev:amd64 (1.9.1-3) ...