www.Hilands.com :: Computer Information Dump

Content:: apt

Advanced Packaging Tool (apt)

Configuring apt
Even with a basic installation of a Debian operating system apt should be fully functional! Some of the fancy apt tools like aptitude may not be available.

The main configuration file for apt is the sources.list which contain information on the locations where apt will search for packages. # nano /etc/apt/sources.list
# deb cdrom:[Debian GNU/Linux 5.0.3 _Lenny_ - Official i386 NETINST Binary-1 20090906-12:06]/ lenny main_
deb http://ftp.us.debian.org/debian/lenny main
deb-src http://ftp.us.debian.org/debian/ lenny main

deb http://security.debian.org/ lenny/updates main
deb-src http://security.debian.org/ lenny/updates main

deb http://volatile.debian.org/debian-volatile lenny/volatile main
deb-src http://volatile.debian.org/debian-volatile lenny/volatile main

The sources.list should be auto generated upon installation.



How to populate the sources.list
You can get a list of the mirrors from http://www.debian.org/mirror/list
Lets start examine the mirror. Digging down into the files we can find the main distributions and version folder dists/lenny.
http://ftp.us.debian.org/debian/dists/lenny/
In here we will find "contrib/", "main/", and "non-free". We will mainly stick to the main distribution files
going into the main folder you will find folders labeled for the computer system architecture. Most of us will be using the i386 for our standard every day computing systems.
http://ftp.us.debian.org/debian/dists/lenny/main/binary-i386/
Inside this folder we'll find Packages.bz2 and Packages.gz. These two files will contain the list of packages available. If we point our apt sources.list to this location apt can read the packages file to locate the files in the distribution we are looking at.

Editing the sources file we can add the following :
deb http://ftp.us.debian.org/debian/ lenny main
This will tell apt to use the us ftp mirror and go into the lenny and main sections digging us into http://ftp.us.debian.org/debian//debian/dists/lenny/main



The netselect-apt program
The netselect-apt tool is used to find the fastest mirror near you. This will automatically populate the sources list. We can install netselect-apt with apt-get # apt-get install netselect-apt we can run the netselect-apt by typing # netselect-apt stable netselect will get its list from http://www.debian.org/mirror/mirrors_full



Basic apt commands
After changing the sources.list file apt needs to know to check the file for updates. We can do with with the following command.
# apt-get update
To view or find packages we can install
# apt-cache search <package name>
Uninstall package and installation
# apt-get remove <package name>
Get rid of package, installation and installation files.
# apt-get --purge remove <package name>
If packages are installed properly make sure they are removed and reinstalled.
e.g. the file won't install the configuration after an uninstall
# dpkg --purge <package name>
# apt-get --reinstall install <package name>
Upgrade the files listed in apt.
# apt-get upgrade
Upgrade a distribution
# apt-get dist-upgrade
Upgrade reference : http://www.debian.org/releases/lenny/i386/release-notes/ch-upgrading.en.html



Using apt
Finding a the right package can be hard, reading error messages and figuring out what packages need to be installed. You can search the repository with apt search features. After updating a list of packages will be stored on your local machine in the cache. # apt-cache search <package name>
one of my favorite programs is less. Its similar to the more program which many are familiar with even windows users. Running a command and piping the output through more will allow you to see the output one page at a time. Less is similar to the more program but when you pipe the output through less you will be able to scroll up and down with the arrow keys go to the begining and end of the output with < and > keys. To exit less you can hit the q key.
To find the less program with apt-cache search we can pipe the output through grep # apt-cache search less | grep "less -"
You should see a short list and in the list
less - Pager program similar to more
to install less we run # apt-get install less
Now we can pipe the output of our apt-cache search through less # apt-cache search <package name> | less




Where apt files are stored
Location of deb packages :
/var/cache/apt/archives
The files in the archives should all be debian packages. To retrieve a list of packages in the archive you can run # ls /var/cache/apt/archives




References
http://www.debian.org/doc/manuals/apt-howto/
w3c xhtml 1.0 validation   w3c css validation

Resume Link to a pdf fileLink to a new window :: Donate