You can install packages from third party sources by adding their APT repositories to Ubuntu. If you do not want to keep them later, these packages can be removed and the repositories can be removed too.
If you remember the name of the repository, say
ppa:joe/foobar, use this command:
$ sudo add-apt-repository --remove ppa:joe/foobar
-r can be used instead of
If you do not recall the name of the repository, go to
/etc/apt/sources.list.d/ directory and remove the filename that matches the repository you want to remove. You will need to use
sudo for this.
After removing the repository in either of the above ways, remember to update:
$ sudo apt-get update
Tried with: Ubuntu 14.04