Quick Reference: apt-get

apt-get is the command-line tool for handling packages for Debian Linux which is use to:

  • Install/manage individual packages
  • Upgrade packages
  • Apply security patch(s)
  • Keep Debian system up to date
  • Download source .deb files
  • Has many GUI and other utilities as front-ends

Here is quick cheat sheet you will find handy while using apt-get at shell prompt:

Syntax Description Example(s)
apt-get install {package} Install the new package. If package is installed then try to upgrade to latest version apt-get install zip
apt-get install lsof samba mysql-client
apt-get install {package} -f Install the new package and fix any broken dependencies. “-f” equates to “–fix-broken” apt-get install -f zip
apt-get install -f lsof samba mysql-client
apt-get remove {package} Remove/Delete an installed package except configuration files apt-get remove zip
apt-get –purge remove {package} Remove/Delete everything including configuration files apt-get –purge remove mysql-server
apt-get update
apt-get upgrade
Resynchronize the package index files and Upgrade the Debian Linux system including security update (Internet access required) apt-get update
apt-get upgrade
apt-get update
apt-get dist-upgrade
Usually use to upgrade to Debian distribution. For example Woody to Sarge upgrade. ‘dist-upgrade’ in addition to performing the function of upgrade, also intelligently handles changing dependencies with new versions of packages; apt-get has a “smart” conflict resolution system, and it will attempt to upgrade the most important packages at the expense of less important ones if necessary. apt-get update
apt-get dist-upgrade

{package} – Replace with actual package name

The full man page for apt-get can be found here: http://ss64.com/bash/apt-get.html

Linux: apt-get install Error: “Media Change: Please insert the disc labelled ..”

So when we see the error in Ubuntu / Debian, basically the installer is looking for the cd as its first source of binaries:

Do you want to continue [Y/n]?
Media Change: Please insert the disc labelled
‘Debian GNU/Linux 5.0.4 _Lenny_ – Official i386 DVD Binary-1 20100131-19:16’
in the drive /cdrom/ and press enter

^C

We need to edit the /etc/apt/sources.list and comment out the line beginning with “deb cdrom …”

Using vi:

linux:~# vi /etc/apt/sources.list

Press i to insert a “#” char at the beginning of the line, then ESC, and “:wq” <RETURN> to write the file. Et voila 🙂

#############################################################
################### OFFICIAL DEBIAN CDROM ###################
#############################################################

#deb cdrom:[Debian GNU/Linux 5.0.4 _Lenny_ – Official i386 DVD Binary-1 20100131-19:16]/ lenny contrib main

#############################################################
################### OFFICIAL DEBIAN REPOS ###################
#############################################################

###### Debian Main Repos
deb http://ftp.uk.debian.org/debian/ lenny main contrib non-free

Exit mobile version
%%footer%%