i'm new to using ubuntu or any linux distro.
On reading and watching tutorials on the internet, I've seen others just use
sudo apt-get install package-name
while others do these commands before using sudo apt-get install
sudo add-apt-repository (commands here)
what's the better way to install packages?
This command installs a new package. But if the package can't be found you have to tell the installer where to find it, and that's when you add a PPA(repositiry).
1Source:Launchpad Help
If you run
It installs the latest version of
package-name
available in the official repository or in one of theppa
. So Ubuntu comes with an official repository where there is many packages in relatively recent version. But some packages are not yet in the official repository so their developer (or other people) create appa
to make it available for you through apt-get. That is an easy way to install packages that are not yet officially supported by Ubuntu.Sometimes, there is also
ppa
with newer version of packages that the version in the official repository. Be aware that sometimes, theseppa
contains unstable version but most of the time it is stated in the tutorials or even in the names of theppa
or their description.Also, if you prefer a graphical interface instead of the command line, you can use the Ubuntu Software Center instead of
apt-get
.I would say that the version in the Ubuntu Software Center is preferred but if it is not yet available and if it is stable, add the
ppa
. Or if you need a feature from a newer release, use theppa
too. Theppa
are very confortable, their upgrade also appear in the Software Update. However, you sometimes only need a few days before Ubuntu release the new version or the software, that's always the case with. Most of the times, if the tutorials are up to date, you can follow their recommendation IMHO.The first command you listed here is used to install packages, whereas the second one is a script which allows you to add external software repositories to your system really easily.
An example:
Typing in
sudo apt-get install geary
will install Geary, a lightweight email client.However if you'd like to test a daily build of geary (daily might be unstable) you could add a repository (ppa) by doing this:
sudo apt-add-repository ppa:yorba/daily-builds