Tuesday, March 1, 2016

apt - How to install a downloaded .deb file along with its dependencies in a system with an internet connection


I thought when I executed apt install pkg, a deb file would be downloaded and put into /var/cache/apt/archives. But today after executing apt install python2.7 python-pip, I can't find any deb file in var/cache/apt/archives. I don't know why. Is it because I write sudo apt install pkg into a bash script and didn't execute the script with sudo?


For some reason, I need to be able to install some package from deb files, meaning that I should be able to execute dpkg -i pkg.deb, instead of apt install pkg to do the installation.


I've tried the command apt download pkg and it did download a deb file but it is a tiny file. When I execute dpkg -i pkg.deb, there are many errors about dependencies and I have to execute apt install -f to solve them.


My system has a working internet connection. How can I get a complete .deb package?



You need to run a command that automatically resolves all the .deb file's dependencies and installs the .deb file and its missing dependencies with the same command. You will need a working internet connection and your installed software to be updated with sudo apt update && sudo apt upgrade to download any missing dependencies. Open the terminal, change directories using cd to the directory containing package-name.deb, and type:


sudo apt-get install ./package-name.deb

where package-name.deb should be replaced by the name of the .deb file that you are trying to install.


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...