How to create your own Debian/Ubuntu packages

Step-1 Create the following directories for your package: 

ashu@server:~$ mkdir -p mypackage/DEBIAN

ashu@server:~$ mkdir -p /mypackage/usr/bin

Step-2 Create a control file for your package:

ashu@server:~$ vi mypackage/DEBIAN/control

Package: mypackage
Priority: optional
Section: devel Installed-Size: 100 
Maintainer: John Hancock .
Architecture: i386 
Version: 1.0 
Depends: libc6 (>= 2.1) 
Description: This is just a test package.

1- Installed-Size specifies package size in kilobytes. If you want to have a multiline description, use a space at the beginning of each next line. 

2- In architecture field you must inform in which kind of architecture this package will be installed. It can be i386, amd64 and all. In my case, I am using 64 bits.

Step- 3 Cretae a simple script...

ashu@server:~$ vi 

echo "This is just a example about how to create a package"

:wq! (Save & Quit)

Step- 4 Place your files in the directory mypackage preserving all paths relative to root file system: i. e. if a file is supposed to be in '/usr/bin/' after installation it should be located in 'mypackage/usr/bin/' before creating the package. 

 ashu@server:~$ cp /home/ashu/pkgdeb /home/ashu/mypackage/usr/bin/

Step- 5 Set the permission to this file:

ashu@server:~$ chmod 777 /home/ashu/mypackage/usr/bin/

Now your package contains the file which will be installed in /usr/bin/.

Step- 6 Now let's create the package... 

ashu@server:~$ dpkg -b mypackage mypackage.deb

Step- 7 Now your package is ready to be installed which can be done this way: 

 ashu@server:~$ dpkg -i mypackage.deb

More Info...Click

I hope you like it.
So Enjoy............................!
Click Back..                                Click Home..