Originally Posted by
NeonBible
I am just trying to understand how applications are installed under Linux.
Linux applications are installed from *.deb files, called debian packages.
A .deb file is the equivalent of setup.exe on windows.
The .deb file contains the program's description, it's dependencies, version, name, maintainer, author, etc, as well as installation scripts, post-installation scripts, and post removal scripts (and the program and its data, of course).
.deb files are installed by the progam dpkg.
To install for example "codeblocks.deb", you go to the console to the same directory as codeblocks.deb, and type:
dpkg -i codeblocks.deb
now the thing is that codeblocks.deb might depend on g++, wxwidgets, and other .debs. This is called dependencies.
Now if you have a large program, it might have a lot of dependencies, and worse, you might not know them all, and to find them out, install them in the right order etc. is very complex (it's called the dpkg-hell...).
That's why apt was written.
apt reads the .deb for you, gets all the dependencies (and the dependencies dependencies and so on...) and installs them for you. That's why apt is called a dpkg frontend.
apt gets it's information from a server REPOSITORY.
A repository is just a (very large) collection of .debs, plus a list of all these debs.
Now, apt must find repositories. it doesn't now where they are.
So there is a config file for apt: /etc/apt/sources.list
which lists all the repositories your apt searches.
You can add and remove repositories by adding / removing them from sources.list.
You'll find many more repositories on the internet than just the ubuntu and the debian ones. For example google distributes it's linux software via their own repository.
Now the way apt installs applications is, it downloads all the package lists from all repositories in sources.list.
then it searches all the package lists for the file you want to install, when it finds it, it downloads that file's dependency list from the server and resolves dependencies. it generates a list of everything it has to install, informs you if you have a conflict, eg. must remove another package to install your program, and informs you about the size your program will fill on the disk. You confirm with -y or abort with n
Then apt downloads all the .debs and passes them in the right order to dpkg.
Because the .debs must be transmitted over internet, they are compressed. You can just uncompress a .deb, and you will see that a .deb is basically only a (special) kind of .zip archive.
Progams that are on the repositories when through a process:
first they were sourcecode
then they were compiled for a specific system, eg. IntrepidIbex on i386 or amd64.
Compiling the sourcecode, using various tools, gives you the binaries.
Then these binaries are relieved of any debug info, copied to a package directory.
then an installation scrips gets written, an info file containing author, dependencies, description gets added to the package directory etc.
then the package directory gets compressed, and gets the file extension .deb
Then you can install it.
Or you can install directly from source, without makeing a .deb.
You have the sourcecode, and most of the times type:
Code:
./configure
make
make install
and if everything went well, you're done.
Of course, ./configure make and make install will need a compiler, build dependencies and various other programs, which you might not have on your system, thus the procedure resulting in errors...
PS: APT doesn't check the repositories for package lists just because you install something.
You need to tell apt that manually by typing:
If you add a new repository for the first time, it's especially important, because if you don't run apt-get update, you will have the repository in your sources.list, but apt will not find anything, because you did not update the package list...
to search all repositories for example for g++, type:
Code:
apt-cache search g++
to install g++
Code:
apt-get install g++
to get the source of g++
to get the build-dependencies for g++
Code:
apt-get build-dep g++
to uninstall g++
If you have problems installing some dependencies, type:
Code:
apt-get -f install PACKAGE_NAME
If APT bothers you about some packages that are no longer requires, run:
Code:
sudo apt-get autoremove
Note: The way that dpkg/apt handeles a package, you need to remove the package once it is partially installed (for example when an installation fails because power goes out).
If you run
it will clear all downloaded installer files.
If you don't want to always have to confirm an install with y[es], run:
Code:
apt-get -y install PACKAGE_NAME
Bookmarks