When I try to install any package through the command line, I get an error.
$ sudo apt-get install <package> Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package <package>
Can anyone help me on this?
When apt-get install
is unable to locate a package, the package you want to install couldn’t be found within repositories that you have added (those in in /etc/apt/sources.list
and under /etc/apt/sources.list.d/
).
The following (general) procedure helps to solve this:
- Make sure you have enabled Ubuntu repositories:To enable all repositories (
main
,universe
,restricted
,multiverse
), use the following commands:sudo add-apt-repository main sudo add-apt-repository universe sudo add-apt-repository restricted sudo add-apt-repository multiverse
Visit Help for more information.
- For finding PPA for more packages:
- Go to Ubuntu Package Search.
- If the package that you are unable to locate is from a PPA go to the PPA and check if it is available there for your release.
- For External Repositories, Visit Ubuntu Updates and search by
button. or Visit PPAs.
- Or Search in Launchpad ppa
- Find appropriate ppa according to your Ubuntu release version.
- Add PPA (by command-line):Use this command:
sudo add-apt-repository ppa:<repository-name>
Visit Ubuntu community help for more information.
- Don’t forget to update (make apt aware of your changes):It is essential to run this command after changing any repositories:
sudo apt-get update
Selecting best download server may help to speed up update.
- Finally install the package:
sudo apt-get install <package>
Refer to Package management by commandline.
Additional/Tip: you can find the correct package-name (i.e the name in the repository) using apt-cache search <package-name>
.
Note: If package is not available on repository any how, than you have to wait until it is available (in the case of new/updated versions) or use other installation processes than apt-get
e.g. compiling from source, downloading executable binary, etc.