On Debian-based systems, the package manager uses .deb containers to handle the installation of packages. Many people make a connection between .deb and .exe since both are easy formats that usually lead to the installation of a program, but this is not the case. Deb files are more like an advanced .tar, and they don't even need to be used for installing programs. In this tutorial I will show you how to make and build a debian package. Make a new directory, let's say for instance, mydeb. Then, in the mydeb directory make a folder named DEBIAN. Now we can begin.
There are a few essential things to put into DEBIAN. You need to have a control file called control, a pre-installation script called preinst, and a pre-removal file called prerm. The control file uses a special syntax to define dependencies, make a description, and note the authors. Here is a sample control file:
Package: mydeb
Version: 1.0.0-0ubuntu1
Architecture: amd64
Maintainer: You <You@email>
Installed-Size: 154
Depends:
Section: accessories
Priority: optional
Description: A sample debian package.
Package is the name of the package, in this case it's mydeb. The version is the version of the file with any special revision names included. Architecture is what type of CPU it can run on. Depends is the most important, which lists dependencies. The operations > < and >= <= can be used to specify higher or lower version numbers for dependencies. The section is what type of application it is. Priority is whether or not the package is a necessity. In this case it's not. Description is a long description of what the package can do. This can be multiple lines.
Now that the control file is out of the way, make two scripts called preinst and postinst. These are bash scripts (text files with #!/bin/bash at the top) that list the commands to install and remove the parts of the program that were included on install. ldconfig should be called in either file.
The fun part
The fun and arguably the most important step is specifying the directories where files will be installed. Leave the DEBIAN folder and make one called home. Then, make one that is exactly equal to your home folder. Make a sample text file here. When the .deb is installed that text file will be placed in your home folder. This is used to spread resources across the files system, for instance the icon goes in /usr/share/pixmaps. You actually have to create those directories inside of the parent directory.
Now you should have two directories in the parent directory, DEBIAN and home. Now we can package these with the dpkg command. Enter the terminal and use the command
dpkg -b 'PATH_TO_PARENT_FOLDER' myDeb.deb
This should create a file in your home folder called myDeb.deb. Now you can install the package with gdebi, the software center, or dpkg.
A note for application developers: ldd lists the dependencies of an executable file for the Depends: part of a command file.
External: http://www.linuxfordevices.com/c/a/Linux-For-Devices-Articles/How-to-make-deb-packages/
Showing posts with label Debian. Show all posts
Showing posts with label Debian. Show all posts
Sunday, April 29, 2012
Sunday, November 6, 2011
Debian 6 - Squeeze
Ubuntu is one of, if not the, most popular Linux distribution; but it didn't just rise from the abyss. Ubuntu is actually a fork of another distribution called Debian, which takes to calling itself the "Universal Operating System". The reason for the fork was to create a familiar environment that is just updated more frequently than Debian was, and it seems to have stuck. Ubuntu is not the only fork of Debian, other distributions such as Linux Mint and Gnewsense are based off of Debian.
I was fearful of trying Debian at first, since I hadn't yet stepped out of the "user friendly distributions". When I first installed it a few months ago my fears were confirmed, and nothing seemed to be going my way. First of all, network drivers for my wireless card (Ralink) were not installed during the installation like other distributions have done. At first I blamed Debian for being a poor distribution, but it turns out it was done for a reason: my drivers were proprietary, but I did not yet know that. Next I ran into issues with composting, since Gnome 2 doesn't have a composting manager by default.
With all the trouble I was having with Debian I retreated back to Ubuntu, discouraged by everything that went wrong. 3 months past, and I was more eager than before to move away from Ubuntu. I searched around for what the root of my network problem could be until I found that it was caused by a proprietary driver not installed by default. I tracked down the exact driver I needed here, downloaded it from a computer with internet, and installed it on Debian with the command "sudo dpkg -i (filepath to the .deb). Now that I had internet, I was a happy camper since I would be able to search around on how to fix problems on the OS that was causing them.
After some work on it, I had it finetuned exactly to my liking, and all was good... until I managed to break it to the point that reinstalling would be the easiest thing to do. After a reinstallation I lost interest in Debian since I would have to reinstall all of the software I had lost and reset all of the keyboard shortcuts, settings, etc.
Overall I found Debian 6 to be an amazing Operating System once you get everything on it working. One of the greatest tricks is editing '/etc/apt/sources.list' to add, change, or remove repositories. The repositories for Debian 6 were somewhat outdated, even to the point where it still used Gnome 2, so adding a few new ones for more recent software is a good idea.
My recommendation to anyone considering trying Debian would be to not go with the stable release, but unstable or even the experimental one.
Subscribe to:
Posts (Atom)