Difference between revisions of "The apt-get Package Management Tool"
Line 15: | Line 15: | ||
apt-get install <packagename> will upgrade only that single package | apt-get install <packagename> will upgrade only that single package | ||
+ | |||
+ | == remove software with apt-get == | ||
+ | |||
+ | When you use the command apt-get remove <package> it removes that package from the system. | ||
+ | apt-get remove package | ||
+ | This will remove the core software application but "sometimes" may leave behind some settings files, much like Windows Uninstall leaves files behind on Microsoft Windows - yet not nearly as bad. | ||
+ | apt-get remove --purge package | ||
+ | apt-get clean | ||
+ | Can be used to clean things up better. | ||
== repositories == | == repositories == |
Revision as of 12:32, 26 February 2014
The apt-get command is a powerful command-line tool for performing such functions as installation of new software packages, upgrade of existing software packages, updating of the package list index, and even upgrading the entire linux distribution system on a computer.
The apt-get command is part of APT, or Advanced Packaging Tool. APT was originally designed as a front-end for dpkg to work with Debian's .deb packages. There is no single "apt" program; apt is a collection of tools. Two such programs are apt-get and apt-cache. This document focuses on apt-get.
Some common distributions that use apt-get:
- Debian
- Ubuntu / KUbuntu
Contents
install software using apt-get
The command to install a package
apt-get install package
apt-get install --only-upgrade <packagename> will not install any new packages
apt-get install <packagename> will upgrade only that single package
remove software with apt-get
When you use the command apt-get remove <package> it removes that package from the system.
apt-get remove package
This will remove the core software application but "sometimes" may leave behind some settings files, much like Windows Uninstall leaves files behind on Microsoft Windows - yet not nearly as bad.
apt-get remove --purge package apt-get clean
Can be used to clean things up better.
repositories
Apt stores a list of repositories or software channels in the file.
/etc/apt/sources.list
These are places where software can be obtained from using apt-get. The main repositories are stored in this file, not additional repositories use add with the add-apt-repository command. Do not manually edit sources.list or, if you feel you must, make a backup first before editing.
For example, user wanted to install the tv-maxe app on Ubuntu which is not in the typical Ubuntu repositories. So user added a repository.
add-apt-repository ppa:venerix/pkg apt-get update
The second command, 'apt-get update' downloads the package lists from the repositories and "updates" them to get information on the newest versions of packages and their dependencies. Since user added a new repository, the command is ran to update the latest package list from that new repository. A new repository is also known as a 'PPA'.
The new repositories user added do not get added to the sources.list file, but instead they go into separate files under
/etc/apt/sources.list.d
And you can use the add-apt-repository command to remove them
apt-add-repository --remove ppa:venerix/pkg
This does not remove the program that was installed, in this case tv-maxe. Now user will not be able to easily update tv-maxe via the 'apt-get install <packagename> will upgrade only that single package.' - since the repository is gone. If user wishes to keep tv-maxe easily updated with new releases, user will have to keep the repository. You can also manually delete the .list files from the /etc/apt/sources.list.d directory. To manually remove the repository venerix/pkg for which tv-maxe was obtained:
rm /etc/apt/sources.list.d/venerix-pkg-precise.list apt-get update
apt-get update
The command apt-get update downloads the package lists from the repositories and "updates" them to get information on the newest versions of packages and their dependencies. It will do this for all repositories and PPAs.
apt-get update
Run this command after changing /etc/apt/sources.list or /etc/apt/preferences - or if you remove any repository from sources.list.d via 'apt-add-repository --remove' command line or manually deleting with the rm command.
Also, run the 'apt-get update' command periodically to make sure your source list is up-to-date. This is the equivalent of "Reload" in Synaptic or "Fetch updates" in Adept.