This question already has an answer here:

I have a simple question coming from my mind.

What is the difference between :

sudo add-apt-repository ppa:cwchien/gradle
sudo apt-get update
sudo apt-get install gradle

And simply

sudo apt-get install gradle

Which one should i use & why?

Thanks for your time.

marked as duplicate by Rinzwind, Eric Carvalho, Jorge Castro, Richard, Avinash Raj Apr 10 '14 at 15:00

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

There are three steps to what you're running:

  1. add-apt-repository adds a PPA to your list of sources, so that Ubuntu knows to look for updates from that PPA as well as from the official Ubuntu sources. Usually this is used to allow developers to provide updates more quickly than those in the official Ubuntu repositories.

  2. apt-get update tells apt-get to update its database of what packages can be installed and where to install them from. In this case, apt-get will see your newly-added PPA and discover that ppa:maco.m/ruby has the newest version of rubygems that it knows about, so it will make a note to install rubygems from the PPA next time someone asks to install it.

  3. apt-get install causes apt-get to find the package in its database and download and install the indicated file. In this case, it will find the rubygems package, download it from ppa:maco.m/ruby, and install it.

If you were to simply run apt-get install rubygems, you would get a less-recent version (or perhaps nothing at all, depending on whether rubygems is also in the Ubuntu repositories or only in the PPA).

In general, the format ppa:a/b will expand to, where you can view the files and download them individually. In your case, that would be

  • Before answering a question, please search for similar questions in this site, and in the comment section refer to the link that has got the answer or if you can mark as duplicate so that others having the same problem can easily go to the original question :). – ashubuntu May 25 '15 at 9:19

If you're adding PPA from


, maybe you get the latest work of that packages, but don't mean it without risks (maybe more unstable, etc).

If you're use direct command

sudo apt-get install gradle

, so you use ubuntu repositories. It usually provide safer and more stable, but it can be outdated version.

So you can choose between them that fits to your needs.

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