Monday, 4 March 2013

apt-get... -how to

4. How to use apt-get

apt-get's commands are very easy and intuitive.
Its commands follow this structure:
    # apt-get [options] command
    
    # apt-get [options] install package [package ...]
The command line may be a variation of the following basic types:
apt-get update
Updates apt-get's local database with server's pkglist's files.

the database files go here:

/var/lib/apt/lists/

What would happen if I deleted all of those files? Could I then run

Code:
sudo apt-get update
What would happen if I deleted all of those files?  Could I then run

Code:
sudo apt-get update
replace them with fresh ones?

Does this command also update the database in /var/lib/dpkg/available and /var/lib/dpkg/status? 
replace them with fresh ones? 
yes

 Does this command also update the database in /var/lib/dpkg/available and /var/lib/dpkg/status?

No. /var/lib/dpkg/status is modified by dpkg if you change the state of a package, i.e. install it, remove it, mark it for some action, ...

/var/lib/dpkg/available "is mostly useless if you don't use dselect but an APT-based frontend: APT has its own system to keep track of available packages" as dpkg's manpage says.
apt-get check
verifies system's integrity using apt
apt-get install some-package
installs some new package, automatically resolving and downloading dependent packages
apt-get upgrade
checks for outdated packages in the system and automatically upgrades them
apt-get dist-upgrade
same as apt-get upgrade, but installs all base packages and tries to upgrade everything, installing new packages if needed
apt-get remove some-package
removes the some-package package and all other packages that depends on it
apt-get clean
removes the downloaded packages from the cache directory (/var/cache/apt/archives/), freeing some disk space at your system ;-)


Commandline method


Or, you could just type a line or two of commands and get the job done as follows: (The example shows ppa:kubuntu-ppa , but substitute the PPA you desire and don't type exactly as shown) 

apt-add-repository ppa:kubuntu-ppa
apt-get update
apt-get upgrade 

The above 3 lines assume you did a su to root account. If you run the command as a normal user but with sudo root privileges, prefix all the three commands with sudo.

Additional Unofficial Repositories


There is a Kubuntu team PPA which contains several repositories maintained by Kubuntu developers and community members to support testing. They are:
  • Kubuntu Updates - Updates for Kubuntu releases which are due to go to Ubuntu Updates. Mostly KDE point releases. These are expected to be reasonably safe to use, but are here for testing. These are intended to eventually go to the official Ubuntu repositories. 

  • Backports - Backports of new versions of KDE and major KDE apps for Kubuntu which are either too large a change or not yet tested enough to go to Ubuntu Backports. These are only final releases of major new versions of KDE and related packages. Generally these can be expected to work, but will often be less mature or less tested than versions in the official repositories for a release. 

  • Beta Backports - Backports of beta versions of KDE and major KDE apps. This PPA is only for enthusiasts who want an early look at upcoming releases and are willing to deal with significant breakage and regression. 

  • Experimental - Testing ground for unfinished Kubuntu packages. This PPA is not suitable for routine use. Only install specific packages from this PPA to support specific testing. Do not be surprised if something breaks your system.

No comments: