Monday, October 03, 2005
linux: how to use 'apt'
First of all, I do not use any distribution, I use a plain debian, setting up only basic packages (without any xserver/graphical environment) and then installing them one by one. The debian core I am using is Linux => Debian GNU/Linux
Here are some tips I found usefull when installing linux.
how to use .deb packages:
I try to use .deb packages as much as I can because package management makes life pretty much easy for installing/updating/deleting softwares.
Unfortunately there is not that many .deb packages existing. One way is to get .rpm files (form seekrpm.com for instance) and transform them with the 'alien' software through: "alien -d myrpmfile.rpm"
but for this we need to install 'alien' package first
There are several ways to manage debian packages: 'dpkg' & 'apt' for command line ('apt' is newer and based on 'dpkg') and 'synaptic' for gui management. In fact 'synaptic' is just a graphical interface running 'apt' in background.
Therefore here we will focus mainly on 'apt' and sometimes if needed on 'dpkg'.
First, 'apt' needs to know where to find debian packages. To do that, it reads /etc/apt/sources.list file.
To add an address for apt to find more packages, you have to modify this file (through sudo vi /etc/apt/sources.list).
Type in on a line the address of your packages.
Each address should be written as follow: 'deb uri version main contrib non-free' if you want to access 'main' 'contrib' and 'non-free' packages.
see 'man sources.list' for more details
To see if a package (and versions of this package) is available, run 'apt-cache policy packagename'
If it is available and not already installed, then as root run 'apt-get install packagename'
For example, to install a graphical environment on debian, run as root 'apt-get install xfree86-server gnome x-window-system-core'. This will install xfree86-server, gnome & x-window-system-core packages. Then you should be able to launch gnome through 'startx'.
If you do not find a debian package for your software, modify /etc/apt/sources.list if you know where to find the package, or create it from an .rpm through 'alien'.
If you want to install .deb files stored locally on your computer - let say in /deb_packages/debs/ folder - do as follow:
- edit your /etc/apt/sources.list file by adding 'deb file:// /deb_packages/debs/' then save and exit
- put your .deb files in /deb_packages/debs/ ('mv myformerlocation /deb_packages/debs/)
- run 'apt-ftparchive packages /deb_packages/ | gzip > /deb_packages/debs/Packages.gz -- this creates a Packages.gz file necessary for 'apt' to find your packages -- it requires gzip package to be installed on your computer
- run 'apt-ftparchive release /deb_packages/ > /deb_packages/debs/Release -- this creates a Release file containing useful -- but non mandatory -- information for 'apt'
- run as root 'apt-get update' -- this will read your sources specified in /etc/apt/sources.list and update 'apt' database
then install your package as usual by running 'apt-get install mypackage' as root
refer to man apt-get, man apt-cache, man apt-ftparchive, man sources.list pages for more information
Here are some tips I found usefull when installing linux.
how to use .deb packages:
I try to use .deb packages as much as I can because package management makes life pretty much easy for installing/updating/deleting softwares.
Unfortunately there is not that many .deb packages existing. One way is to get .rpm files (form seekrpm.com for instance) and transform them with the 'alien' software through: "alien -d myrpmfile.rpm"
but for this we need to install 'alien' package first
There are several ways to manage debian packages: 'dpkg' & 'apt' for command line ('apt' is newer and based on 'dpkg') and 'synaptic' for gui management. In fact 'synaptic' is just a graphical interface running 'apt' in background.
Therefore here we will focus mainly on 'apt' and sometimes if needed on 'dpkg'.
First, 'apt' needs to know where to find debian packages. To do that, it reads /etc/apt/sources.list file.
To add an address for apt to find more packages, you have to modify this file (through sudo vi /etc/apt/sources.list).
Type in on a line the address of your packages.
Each address should be written as follow: 'deb uri version main contrib non-free' if you want to access 'main' 'contrib' and 'non-free' packages.
see 'man sources.list' for more details
To see if a package (and versions of this package) is available, run 'apt-cache policy packagename'
If it is available and not already installed, then as root run 'apt-get install packagename'
For example, to install a graphical environment on debian, run as root 'apt-get install xfree86-server gnome x-window-system-core'. This will install xfree86-server, gnome & x-window-system-core packages. Then you should be able to launch gnome through 'startx'.
If you do not find a debian package for your software, modify /etc/apt/sources.list if you know where to find the package, or create it from an .rpm through 'alien'.
If you want to install .deb files stored locally on your computer - let say in /deb_packages/debs/ folder - do as follow:
- edit your /etc/apt/sources.list file by adding 'deb file:// /deb_packages/debs/' then save and exit
- put your .deb files in /deb_packages/debs/ ('mv myformerlocation /deb_packages/debs/)
- run 'apt-ftparchive packages /deb_packages/ | gzip > /deb_packages/debs/Packages.gz -- this creates a Packages.gz file necessary for 'apt' to find your packages -- it requires gzip package to be installed on your computer
- run 'apt-ftparchive release /deb_packages/ > /deb_packages/debs/Release -- this creates a Release file containing useful -- but non mandatory -- information for 'apt'
- run as root 'apt-get update' -- this will read your sources specified in /etc/apt/sources.list and update 'apt' database
then install your package as usual by running 'apt-get install mypackage' as root
refer to man apt-get, man apt-cache, man apt-ftparchive, man sources.list pages for more information