Jan 062014
 

An interesting and detailed howto on apt, first posted on linux mint community tutorials

Intro by Wikipedia:

The Advanced Packaging Tool, or APT, is a free user interface that works with core libraries to handle the installation and removal of software on the Debian GNU/Linux distribution and its variants. APT simplifies the process of managing software on Unix-like computer systems by automating the retrieval, configuration and installation of software packages.

When you launch Software Manager or Update Manager or Synaptic Package Manager, you’re using APT via different GUIs. But you can control APT even via command lines in an easy and quick way.



– WHAT YOU NEED TO KNOW –

To understand this tutorial you must know:
  • how to open a terminal;
  • your root password;
  • what is a repository;
  • how to connect your computer to the internet.
Every first “sudo” command will be followed by a password request. Remember that when you type a password in terminal, you see nothing on screen.
All command lines are wrote in “classical syntax”; they work in Mint, Ubuntu, Debian and other distros supporting APT. A lot of commands have this structure:

sudo apt-get myspecificcommand

In Mint you can use just “apt”, without “sudo” and “-get” [thanks remoulder]:

apt myspecificcommand

Of course, for security reasons, system will still ask you the root password.

– TO ADD A REPO –

If you need a software that is not in the official list, you must add its repository to your software sources. To know the repository data, browse the software site.
Let’s make an example with Ubuntu-Tweak [a kind of “Swiss Tool”, partially compatible with Mint]. It’s not listed in the software manager.
Browsing official site, you find the repository id is ppa:tualatrix/ppa. To add it to your sources, open a terminal and write this string.

sudo add-apt-repository ppa:tualatrix/ppa

Your system will contact the repo and import all the needed data. So, the command line to add a repo is

sudo add-apt-repository ppa:your-repo/ppa

– TO UPDATE SOFTWARE LIST –

This one is used to resynchronize the package index files from their sources.

sudo apt-get update

System will contact all repos to update the local index of available software. An update should always be performed before an “upgrade“. Please be aware that the overall progress meter will be incorrect as the size of the package files cannot be known in advance.

– TO UPGRADE ALL YOUR SOFTWARE –

This one is used to install the newest versions of all packages currently installed on your system.

sudo apt-get upgrade

upgrade is used to install the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list. Packages currently installed with new versions available are retrieved and upgraded; under no circumstances are currently installed packages removed, or packages not already installed retrieved and installed. New versions of currently installed packages that cannot be upgraded without changing the install status of another package will be left at their current version. An update must be performed first so that apt-get knows that new versions of packages are available.

– TO FIND THE REAL NAME OF A SOFTWARE –

When you don’t know the complete name of a software listed in your local index you can use this command [even without “sudo”].

apt-cache search mysoftware

– TO INSTALL A SOFTWARE –

This one is easy to understand.

sudo apt-get install mysoftware

Do you need to install more than one software? Yes, you can.

sudo apt-get install mysoftware-1 mysoftware-2 mysoftware-3

All packages required by the package(s) specified for installation will also be retrieved and installed.

– TO UNINSTALL A SOFTWARE –

Basic command is

sudo apt-get remove mysoftware

It is identical to “install” except that packages are unistalled instead.

– TO PURGE A SOFTWARE –

sudo apt-get purge mysoftware         

It is identical to “remove” except that packages are removed and purged (any configuration files are deleted too).

– SPRING CLEANING –

clean” clears out the local repository of retrieved package files. It removes everything but the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/.
autoclean” clears out the local repository of retrieved package files. The difference is that it only removes package files that can no longer be downloaded, and are largely useless. This allows a cache to be maintained over a long period without it growing out of control.
autoremove” is used to remove packages that were automatically installed to satisfy dependencies for some package and that are no more needed.
You can concatenate commands with “&&“.

sudo apt-get autoclean && sudo apt-get autoremove

– TO CALL A COW –

apt-get moo

– MAIN REFERENCE –

man apt-get


Popular Posts:

Flattr this!

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

*