Creating an empty debian package for Debian/Ubuntu that just installs certain packages you need can be very useful when you install a fresh OS. For instance, if you need Apache2, PHP5, MySQL5, and phpmyadmin on fresh-installed Ubuntu machine, you can install all of them at once by creating an empty package that depends on those packages.
Step 1. You will need root privilege
sudo su
Step 2. Create a folder that will contains content of the package
mkdir myserver
Step 3. Create a DEBIAN folder that stores meta data for the package
mkdir -p myserver/DEBIAN
Step 4. Edit a control file inside DEBIAN folder
emacs -nw myserver/DEBIAN/control
Step 5. Fill in the following content in control file
Package: myserver Priority: optional Section: misc Maintainer: My Name Architecture: all Version: 1.0 Depends: apache2, libapache2-mod-php5, mysql-server-5.0, phpmyadmin Description: This Package is My Server Package My Server Package
* There must be a space in front of “My Server Package” at the end of paragraph and also there must be an empty line after that line.
Step 6. build the package
dpkg -b myserver myserver_1.0.deb
Step 7. try to install the package – this should not continue if you do not already have other dependency packages
dpkg -i myserver_1.0.deb
Now the package is ready but using dpkg to install this package will fail since it does not meet the dependency. Next step is to create a repository when this package can be downloaded and install via apt-get/aptitude. apt-get/aptitude will try to resolve the unmet dependency by installing all the dependency packages.