Monday, March 1, 2010

Debian 15

We will now go into how to add, remove, and maintain programs. The package system supports multiple package sources (CDs, DVDs, File System, HTTP, FTP). Applications like apt-get and aptitude automatically resolves dependencies. They also maintain a package repository database of all installed packages.
Applications to manage programs include dpkg*, apt-* and aptitude. Apt-get is a front-end to dpkg, and it is not interactive. On the other hand, aptitude is interactive.

You can list the packages installed on the system through dpkg:
dpkg -l

Typically, the output of dpkg -l is piped into grep to selectively show lines of interest.

To list the package a file came from, use:
dpkg -S filename

To see a package's status:
dpkg -s openssh-client

To display a list of files included in the package:
dpkg -L openssh-client

To install a package:
dpkg -i package1.deb [package2.deb...]

To uninstall a package:
dpkg -r package1 package2

In this example, we will install tofrodos, which converts a text file to and fro DOS format. In DOS systems, each line terminates with a CR/LF, but in Unix, lines terminate with LF. todos can replace all LF with CR/LF.

First, browse to debian.org. Click on Debian Packages, then search for "tofrodos". Download the tofrodos .deb package for your arthitecture.

Now, browse to the folder containing the file in a terminal, and use dpkg -i tofrodos... to install the package.

After installing, you can check if it's successfully installed through:
dpkg -l | grep tofrodos
dpkg -s tofrodos

A typical file name would look like:

The package name is tofrodos.
The version is 1.7.8.debian.1-1 (Major, Minor, Patch Release/Build)
The platform is i386
Package suffix is .deb

To use tofrodos to convert from *nix to DOS:
todos test.txt

After doing so, verify the file through:
file test.txt

To uninstall tofrodos, use:
dpkg -r tofrodos

The apt-get is a front-end to dpkg. It provides all features of dpkg, and also maintains a configuration file which contains package sources. The sources of apt-get is stored in /etc/apt/sources.list.

Package sources are arranged in the following categories:
1) Main - Free programs included with the production build of Debian
2) Contrib - Free programs that rely upon Non-Free programs
3) Non-free - Non-Free programs only

Free in this case represents not only the cost of the program, but also the availability of the source code (e.g. open-source).

By default, configuration settings of a program isn't removed when it is uninstalled through apt-get or aptitude. To clear those configurations (in /etc), use:
apt-get purge

To add a CDs/DVDs source, use:
apt-cdrom add

To install tofrodos using apt, use:
apt-get install tofrodos

To uninstall a package, use:
apt-get remove tofrodos

In Aptitude, you can search for packages through '/'. Aptitude tallies tasks (install/remove), then execute them sequentially. Aptitude trees are rearranged in the following manner:
-Node (Installed/Not-Installed etc.)
--Package Group (Administrative, Communication, etc.)
---Branch of Package (Main, Contrib, Non-Free)

Use the tasks node in Aptitude to install common classes of software, e.g. (Desktop Environment, Laptop, Server, etc).

Use + and - to add and remove packages from queue. Next, press 'g' to see the queue, and 'g' again to execute. Bolded packages are installed.

No comments :

Post a Comment