-2

I have a brand new installation of Ubuntu 18.04. I then ran apt-get install curl and it gave me:

Package 'curl' has no installation candidate

I then ran apt-get update and tried installing curl again and it worked this time.

The term "update" can mean lots of things. What does it mean in the above context? what was it updating given that the Ubuntu I had just installed was the latest?

  • Thanks, but how does updating "the package lists for upgrades for packages that need upgrading" explain why curl was not available before and becomes available after update? – Old Geezer Jun 6 '18 at 4:40
  • The old (possibly non-existent) package lists on your system didn't have curl, and the new lists had them. – muru Jun 6 '18 at 4:41
  • as @muru says, and once you ran update you had the new lists so install could now install correctly – kerry Jun 6 '18 at 5:37
0

OK as I understand (speaking as a Ubuntu user) Ubuntu uses a packaging system (in common I believe with other Linux OSs) apt-get accesses this system. apt-get is used to install, upgrade and 'tidy up' existing packages - it is also used to gather information before installing or upgrading via the uptade clause. apt-get update updates the database with information on any new packages or versions. It does not update any installed packages, it updates the database with what is available, apt-get install installs after referencing the database and apt-get upgrade upgrades already installed packages after referencing the database. If you install without updating you may be trying to install an incomplete or out of date system referencing the out of date database. If you then run upgrade you will upgrade the package to include any amendments / enhancements made since the package was released. Be clear on the difference between update and upgrade. Hope this helps.

| improve this answer | |
0

In Ubuntu if you want to install any package you have to type apt-get install package_name Here apt-get is nothing but a python script and it's called synaptic package manager and you can check source code of apt-get on Github.

And update in the apt-get will downloads packages lists from the repositories and updates them to get information on the newest versions of packages and their dependencies. You can see this  http://linux.die.net/man/8/apt-get:

After running apt-get update when you run apt-get install curl since it's updated the curl package will be available now.

And you should see this Where does apt-get install get packages from? to know what install will do.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.