Working of .Deb Files , Compare with .exe files in Windows

Jatin Davey daveyjatin at gmail.com
Wed Dec 16 10:40:03 UTC 2009


Andrew Farris wrote:
> On Wed, 2009-12-16 at 07:57 +0530, Jatin Davey wrote:
>   
>> Hi all
>>
>> I am new to ubuntu. When i download any apps on the internet to be 
>> installed on ubuntu i get to download .deb packages. I know that these 
>> are the files that have the required application. I want to know the 
>> following:
>>     
>
> First of all, if you're installing programs, it's usually best to use
> the software repositories (through USC or Synaptic). If what you want
> isn't in there, you can also try to find a PPA (package repository) and
> subscrie to it, provided you trust the package source (just google for
> <application_name> PPA). Launchpad hosts lots of PPAs, and in my
> experience they're perfectly safe, despite all the warnings. If you
> absolutely can't get the software eitger of those ways, then a .deb is
> the next best thing.
>
>   
>> 1. What are the contents of any .deb pacakage in general ?
>>     
>
> .deb files are basically just an archive (they can actually be opened
> with the standard archive manager). They typically contain 2 archives
> (both gzipped), a data file, and a control archive. 
>
> The control archive contains what's called a 'control file' that
> basically has all the essential info about the package, such as it's
> name, what service it provides, it's category, any programs it conflicts
> with/depends on, the maintainer, etc... and scripts that can be run as
> the program is installed/removed. I've also seen MD5 checksum files in
> the control archives before.
>
> The data archive contains all the program data (i.e. sources, binaries,
> libraries, art, etc...) which is all arranged in a false directory
> structure that mimics where everything is intended to be when the
> install is done. I.e. if the program is going to store some data under
> the shared folder, and have it's binary in the standard executable path,
> then it may contain a directory structure something like this:
>         (within data.tar.gz)
>                 ./usr/bin/executable
>                 ./usr/share/library.so
>                 .usr/share/icon.png
>                 etc...
>                 
> There are tools that help with making these so you don't actually have
> to archive everything yourself. Here's a link to a simple guide on how
> to create .deb formatted packages... it's an interesting read if you
> want to learn how the package is structured/built, even if you don't
> plan on doing so yourself:
> http://www.linuxfordevices.com/c/a/Linux-For-Devices-Articles/How-to-make-deb-packages/
>
>   
>> 2. What happens when it is installed ? (Where are the files installed , 
>> Directories)
>>     
>
> As would indicate from my last point above, the data file is basically
> copied verbatim to the root directory (which is why you need root access
> to install software). I believe it fails if there's conflicts with
> preexisting data where it's trying to copy, but I'm not sure about that.
>
> Either way, after that the package installer writes a little note in the
> package database that you have a new application, and records the
> locations of all the files you installed, and i believe it copies any
> uninstaller scripts present to another place (dunno where). If you want
> to view what files a particular package installed, you can go to
> Synaptic, search for your package, then Right-Click > Properties >
> Installed Files. Gdebi (the graphical package installer) will provide a
> list for you when you when you attempt to install a .deb file by itself,
> under the 'Included Files' tab.
>
>   
>> 3. Any application under linux is launched using a script which is 
>> similar to an exe file in windows , based on this i want to know whether 
>> an application can be installed anywhere and in any directory and it can 
>> be launched from there without having to set environment variables.
>>     
>
> this depends on your definition of 'script'... it also depends on where
> you launch from. most every program I've ever seen on linux installs at
> least a link to /usr/bin/ so you can launch anything from the terminal.
> in fact, the .desktop launchers that are in the menus, and on your
> panel, are actually just little text files that specify a terminal
> command to run, along with an icon and other conveniences. Even so,
> many/most programs are just directly-executed binaries.
>
> As for running programs from any directory...it all depends on the
> program. if the program is looking for files in explicitly named places
> (such as /usr/lib/) that it placed there, but you installed it to a
> non-standard place, then chances are it won't work. The bets thing to do
> though is to try it. sometimes it will work just fine, sometimes you can
> get it to work with a little fiddling, sometimes it won't work at all. 
> If you're feeling adventurous, and the program is not a compiled binary,
> you can sometimes simply modify the program to look in a different
> location for files it's missing, but that's a little more difficult.
>
> Anyway, I hope that helps...sorry for the long reply.
>
>   
Excellent Explanation. I get a good idea about the linux filesystem 
hierarchy. Thanks Andrew. And Dont be sorry for a long reply. If things 
are to be understood with long replies then it is for the good.

Thanks
Jatin




More information about the ubuntu-users mailing list