====== How_to_obtain_Packages_using_APT ====== ===== APT (Advanced Packaging Tool) ===== ====About APT==== APT provides an effective way of installing packages and programs. Default settings are created and in some cases default users are created for managing the services and/or programs. APT handles all shared modules, dependencies and libraries of tools. When installing a program via APT - the default locations within Linux (Debian) should be consulted. The following directories are where files are stored after APT - and are mostly default: * /etc/* -> stores all scripts (/etc/init.d = Startup Scripts) * /var/* -> stores things such as temp, logs, www, mail, backups, libraries etc. * /usr/* -> stores bin files which can be executed using . * /home/* -> stores all user home files. ====General Use:==== To download Updates and All Package Information for Debian Sarge apt-get update To upgrade All Packages and Sources apt-get upgrade #and/or apt-get install To Install an Individual Package apt-get install package To Remove an Individual Package apt-get remove package To Show Information on a Particular Package apt-cache show package To Search for New Packages (apart from web search) apt-cache search package APT runs ontop of dpkg (front end) - a Package Manager To List Packages and perform more detailed operations: dpkg -l #or dpkg -l | grep package ====Problems with APT==== Even though APT is meant to provide an effective way to install packages etc., problems were experienced. Problems arose due to incorrect apt-get installing in the beginning and also due to suggests etc. with mail. Pine was initially installed. Postfix and Courier were installed then. Pine suddenly dropped off, or was uninstalled due to dependancies & incomplete knowledge of what was happening. Care MUST be taken with apt. What was done in this case to fix pine, was to download a .deb package from the pine homepage. It was installed via: dpkg -i package.deb Another related problem is the fact that Horde does not want to install via apt-get after Mailserver install and config. #edit: Dont know if pine is available via apt-get due to licencing issues ====Config for APT==== apt config is located at: /etc/apt 1. The following is required if using a proxy server to access the internet: vi /etc/apt/apt.conf (May have to write a new file) Acquire::http::Proxy "http://proxy:port"; 2. To obtain apt packages fast from the nearest mirror (should be done from initial set-up) sources.list can be edited. It is also determined whether to use "STABLE" or "TESTING" apt source packages. sources.list (Should be OK as is) deb http://ftp.ie.debian.org/debian/ stable main deb-src http://ftp.ie.debian.org/debian/ stable main Instead of Configuring Step 1. for using a Proxy server, an environment variable can also be set. This is useful if using links or a text based browser. >~$ export http_proxy="http://proxy:port" ==== Apt Pinning (installing stable and testing packages together)==== The following is taken from an excellent article on this: http://jaqque.sbih.org/kplug/apt-pinning.html Include both stable and testing sources to /etc/apt/sources.list vi /etc/apt/sources.list deb http://ftp.de.debian.org/debian/ stable main deb http://ftp.de.debian.org/debian/ testing main vi /etc/apt/preferences Package: * Pin: release a=stable Pin-Priority: 700 Package: * Pin: release a=testing Pin-Priority: 650 Package: * Pin: release a=unstable Pin-Priority: 600 Thats it. apt-get install package (works as normal taking stable first) apt-get -t testing install #or apt-get install /unstable ===== dpkg - Debian Package Manager ===== dpkg is a very useful tool for getting a bit more hands-on with debian packages. ==== Install a .deb package manually ==== dpkg -i package.deb #generally the .deb can be downloaded from debian.org ==== Find where a package installs itself ==== dpkg -L package ==== Remove / Uninstall a package ==== apt-get remove package #OR apt-get purge package #The latter removes and purges all config files. #Note after removing the one package, extra ones which were installed at the time will remain. To remove them also: apt autoremove ===== APT Guru Tricks ===== Taken from: http://maketecheasier.com/become-an-apt-guru/2009/02/24/ dpkg -S /etc/mysql/my.cnf #shows which package created a particular file. dpkg -L mysql-common #list all files associated with a particular package. aptitude hold (packagename) echo "(packagename) hold" | dpkg --set-selections #both these do the same thing, i.e. prevent a package from been updated.