Ubuntu Linux: How Do I install .deb Packages? nixCraft Updated Tutorials/Posts

I am a new Ubuntu Linux user. How can I install a package called package.deb? Can I use Synaptic front-end package management tool to install packages from the CD or Internet such as apt command or apt-get command. However, I would like to install a special .deb file. How do I install .deb package from the terminal using command line option in Ubuntu Linux or Debian Linux?

You need to use the dpkg command, which is a package manager from shell/command prompt for Debian and Ubuntu Linux. You can use this tool to install, build, remove and manage packages. dpkg itself is controlled entirely via command line parameters.

How Do I install .deb Packages on an Ubuntu Linux?

The syntax is as follows to install .deb file via the command line:

dpkg -i package-name-here.deb
dpkg --install package-name-here.deb
dpkg -i -R /path/to/dir/name/with/lots/of/dot-deb-files/
dpkg -i --recursive /path/to/dir/name/with/lots/of/dot-deb-files/

Where,

  1. -i or --install : Install the .deb package on Ubuntu Linux.
  2. -R or --recursive : Recursively installed all *.deb files found at specified directories and all of its sub-directories. /path/to/dir/name/with/lots/of/dot-deb-files/ must refer to a directory instead of package-name-here.deb file name.

How do I install .deb file on Ubuntu?

To install a single package file called /tmp/package.deb type the following commands. Open a terminal and then cd to directory where package.deb is kept. In this example, package.deb is kept in /tmp directory:
$ cd /tmp
Type the following command to install the package:
$ sudo dpkg -i package.deb
OR as root user:
# dpkg -i package.deb

How do I install a atop_2.3.0-1_amd64.deb file via the bash command line?

Say you downloaded a deb file named atop_2.3.0-1_amd64.deb:
$ ls -l *.deb
To install .deb packages named atop_2.3.0-1_amd64.deb, run:
$ sudo dpkg -i ./atop_2.3.0-1_amd64.deb
How Do I install .deb Packages on Ubuntu Linux

Install all packages from /nfs/pkgs/ubuntu-builds directory

Recursively handle and install all regular files matching pattern *.deb found at /nfs/pkgs/ubuntu-builds/ directory and all of its subdirectories, type:
$ sudo dpkg -i -R /nfs/pkgs/ubuntu-builds/
OR
# dpkg -i -R /nfs/pkgs/ubuntu-builds/

A note about GUI tools

Open your file manager. Visit folder such as ~/Downloads/ or /tmp/. Choose .deb file. Double click on the .deb file and installation will start automatically. It works if you have a GUI installed on your system or server:
Install downloaded packages in Ubuntu using GUI 1
Next a dialog box comes on screen as follows:
Install downloaded atop packages in Ubuntu using GUI 2
Click on the Install button. You must authorized yourself to install software/.deb package file:
authentication required to install .deb file on Ubuntu
Once authenticated, .deb file install and you will see progress as follows:
Installing .deb file on Ubuntu Linux

Conclusion

You learned about installing deb package on an Ubuntu Linux using the dpkg command. For more info see the following pages:

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Facebook Comments
Spread the love

Posted by News Monkey