More often than not, I find it easier to install packages via the command line instead of heading through graphical downloaders/installer; also, if you wish to script the setup of your machine, it makes sense to grab and install deb files using the command line directly.
Here’s how you can install .deb packages with ease.
I’m going to show you how I installed Google Chrome onto my test Ubuntu 18.04 (Bionic Beaver) instance, from download to fully installed in 2 commands.
Installing a .deb Package using the Command Line
First, let’s download Google Chrome’s .deb package:
user@standard-machine:~$ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -P /tmp/ --2018-08-03 14:28:35-- https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb Resolving dl.google.com (dl.google.com)... 216.58.213.78, 2a00:1450:4009:80e::200e Connecting to dl.google.com (dl.google.com)|216.58.213.78|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 54076744 (52M) [application/x-debian-package] Saving to: ‘/tmp/google-chrome-stable_current_amd64.deb’ google-chrome-stable_current_amd64.deb 100%[========================================================================================================================================>] 51.57M 13.2MB/s in 4.0s 2018-08-03 14:28:39 (12.9 MB/s) - ‘/tmp/google-chrome-stable_current_amd64.deb’ saved [54076744/54076744]
Now we’ve downloaded the Google Chrome .deb package and placed it under /tmp temporarily, let’s go ahead and use dpkg to install it:
user@standard-machine:~$ sudo dpkg -i /tmp/google-chrome-stable_current_amd64.deb Selecting previously unselected package google-chrome-stable. (Reading database ... 128894 files and directories currently installed.) Preparing to unpack .../google-chrome-stable_current_amd64.deb ... Unpacking google-chrome-stable (68.0.3440.84-1) ... Setting up google-chrome-stable (68.0.3440.84-1) ... update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/x-www-browser (x-www-browser) in auto mode update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/gnome-www-browser (gnome-www-browser) in auto mode update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/google-chrome (google-chrome) in auto mode Processing triggers for man-db (2.8.3-2) ... Processing triggers for gnome-menus (3.13.3-11ubuntu1) ... Processing triggers for desktop-file-utils (0.23-1ubuntu3) ... Processing triggers for mime-support (3.60ubuntu1) ...
And that’s it, we’re all done!
What if you change your mind though and decide you want to remove it?
Removing a .deb Package using the Command Line
First confirm the name of the package, as it won’t be the same as the .deb packages file name that we used to install it.
You can list all installed packages using the following:
user@standard-machine:~$ sudo 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-1ubuntu1 amd64 query and manipulate user account information ii acl 2.2.52-3build1 amd64 Access control list utilities ii acpi-support 0.142 amd64 scripts for handling many ACPI events ii acpid 1:2.0.28-1ubuntu1 amd64 Advanced Configuration and Power Interface event daemon ii adduser 3.116ubuntu1 all add and remove users and groups ii adium-theme-ubuntu 0.3.4-0ubuntu4 all Adium message style for Ubuntu ... ... ... ii google-chrome-stable 68.0.3440.84-1 amd64 The web browser from Google ...
Hint: Pipe command output into grep to save searching through a huge list!
Now we know the package name is “google-chrome-stable“, you can go ahead and remove it:
user@standard-machine:~$ sudo dpkg -r google-chrome-stable (Reading database ... 129000 files and directories currently installed.) Removing google-chrome-stable (68.0.3440.84-1) ... update-alternatives: using /usr/bin/firefox to provide /usr/bin/x-www-browser (x-www-browser) in auto mode update-alternatives: using /usr/bin/firefox to provide /usr/bin/gnome-www-browser (gnome-www-browser) in auto mode Processing triggers for man-db (2.8.3-2) ... Processing triggers for gnome-menus (3.13.3-11ubuntu1) ... Processing triggers for desktop-file-utils (0.23-1ubuntu3) ... Processing triggers for mime-support (3.60ubuntu1) ...
That’s it, now you’re able to install, list, and remove .deb packages from your Ubuntu system!
Leave a Reply