Using Debian package archive as a configuration tool


How often do you need to install your favorite Linux distribution in a single year either virtually or using real hardware? How frequently it happens that you just want to test new release of certain Linux distribution so you install it on different partition or simply virtually using your current system as a host. How often do you need to deploy a server which is a complete clone of the one you configured yesterday. The installation part of any Linux system today is a very straightforward process. Nonetheless, the hardest and the most tedious part comes with a fine tuning, customization and configuration of your system’s services as well as your own user environment. You can simply copy your custom system configuration files from one system to another but engaging in this concept this task can become quite disorganized, time consuming and most importantly error-prone.

In this article, we are going to take a different approach which involves a creation of a Debian package archive containing all required custom user and configuration files. First part of this article describes a rather simple way on how to create a Debian package archive containing all custom files followed by its installation. In the second part, we will look at the way on how to create our own very basic Debian Repository and use it to deploy a simple website including Apache webserver installation and configuration on a freshly installed Linux system.


In this section, we create and install simple Debian package. The package will accommodate some sample user data to serve as an example.

Creating a Debian Package

It took you a while to configure your desktop to have it the way it best suits your needs and convenience. In your custom environment, you may for example include some bash scripts, create several aliases using .bashrc file or changed default behavior of a vim text editor by altering .vimrc file. Furthermore, you may also have customized numerous system configuration files such as /etc/network/interfaces and so on. All this hard work can be saved within a Debian package and installed and removed from any system with a single dpkg command. As a first step we need to create a bare minimum skeleton for a Debian package. This is a fairly simple task as it only involves a single DEBIAN/control file. So let us start by creating a directory named “myenv”. This directory will hold all data for our own version 1.0 Debian package.

$ mkdir myenv

In the next step, we need to create a control file:

$ cd myenv
$ mkdir DEBIAN
$ vi DEBIAN/control

Read more

How to install Python3 Beautiful Soup environment on Debian Linux

Beautiful Soup is a Python package for parsing HTML and XML documents and it resides within a Debian package named python-bs4. However, python-bs4 package is a default package on Debian Linux system for Python 2 version. Therefore, if your intention is to use Python3 as a default environment you will need to also install Python3 and its corresponding version of BS4 python3-bs4. Let’s start by python3 installation:

# apt-get install -y vim python3

After a successful installation of python3 package make sure that python3 is set as default:

# update-alternatives --install /usr/bin/python python /usr/bin/python3.4 2
update-alternatives: using /usr/bin/python3.4 to provide /usr/bin/python (python) in auto mode

Confirm that python 3 is a default version:

# python --version
Python 3.4.2

All what remains is to install Beautiful Soup parsing HTML and XML package to match python version 3:

# apt-get install python3-bs4

All done. Test Beautiful Soup parsing HTML and XML with the following example script:

#!/usr/bin/env python3

from urllib.request import urlopen
from bs4 import BeautifulSoup

html = urlopen("")
bsObj = BeautifulSoup(;

print (bsObj.title)

Read more

Install Debian Linux from USB boot memory stick

There are more and more Laptops nowadays which do not have a CD/DVD-ROM facility build in but are able to boot from USB memory stick. This small guide provides all needs on how to create a bootable USB memory stick to install a Debian without a need for CD/DVD drive.

Before you continue make sure that you have backed up all your data from your USB memory stick. After completing this guide your USB memory stick will contain a new partition table and all your data will be lost.

This guide also assumes that you have a running linux system and USB memory stick with minimal size of 512MB which you will use for the process of creating Debian boot installation USB stick.

Find USB device name

Plug in your USB stick and find its device file name by:

fdisk -l

For the rest of this guide we are going to use /dev/sdb as our target.


Create FAT16 partition

Next we need to create FAT16 partition. For this we can use cfdisk with -z option. This command will completely remove all your data from your USB stick, so backup first !:

cfdisk -z /dev/sdb

and create a first primary partition with the minimal size of 260MB and leave the rest unpartitioned or create second partition with some other filesystem for normal use of your USB stick. The size of 260 MB will fit a current Debian stable boot.img.gz and and Debian netinst ISO image.

Read more

php virtual box web interface - localhost

phpVirtualBox installation on Debian Linux and Apache2 web server

phpVirtualBox allows you to manage locally or remotely your virtual machines running under VirtualBox via web-based interface. This config will describe an installation and basic configuration of phpVirtualBox on Debian Linux.

First, we need to install apache2 and php support:

# apt-get install libapache2-mod-php5 apache2 unzip wget

Next, we need to download phpVirtualBox. Please update your download link if necessary:

$ wget

Next, we will unzip and move the phpVirtualBoxcode into root directory of our apache2 webserver directory.

# unzip
# mv phpvirtualbox-4.3-2/ /var/www/html/vbox

Read more

How to extract files from Debian package archive DEB

Very useful tool to extract files from Debian package archive DEB (*.deb) is ar command. First, let’s download a sample debian package hello_2.10-1_amd64.deb:

$ wget

Now, that we have downloaded our sample Debian package we can use ar command to list its content. This can be achieved by t option:

$ ar t hello_2.10-1_amd64.deb 

Read more

Building Linux kernels the Debian way

This short article describes the quick and easy way on how to customize, build and install Linux kernel under Debian or Ubuntu Linux. First, we will install all prerequisites then download kernel source. Next step will be customization and as a last step we will create and install a Debian package with new Customized Linux kernel.


Let’s start with first step which is installation of all prerequisites:

# apt-get install bzip2  build-essential \ 
kernel-package libncurses5-dev

Kernel build and customization

Next step is to download kernel source code from Untar and cd inside the kernel’s directory tree:

$ tar xvjf linux-2.6.34.tar.bz2
$ cd linux-2.6.34

At this point we will do the most important part of creating new customized kernel and building a Debian package. This is all done with a single make-kpkg command.


Optional step is to apply kernel patches before running a following linux command:

make-kpkg --rootcmd fakeroot --config menuconfig --initrd --us --uc kernel_image
  • –us do not sign source
  • –uc do not sign changelog
  • –initrd perform any actions necessary for a kernel loaded using initrd
  • — rootcmd fakeroot command that provides a means of gaining super user access
  • –config menuconfig will use menuconfig as a configuration tool where default is oldconfig

Read more

How to list all files installed by the DEB package on Ubuntu/Debian Linux

The typical question after we install a new package on our system is that what are the actual files ware installed and what is their location. This may be even less obvious if the final executable name intended to start your program has slightly different name than the package its self. In the following example we are going to install a dummy package hello using apt-get command:

# apt-get install hello
(Reading database ... 7528 files and directories currently installed.)
Preparing to unpack .../hello_2.9-2+deb8u1_amd64.deb ...
Unpacking hello (2.9-2+deb8u1) ...
Setting up hello (2.9-2+deb8u1) ...

Read more

How to re-compile nginx webserver on Debian Linux

Let’s say you wish to do some changes to nginx source code in
order to add or remove some features before the actual nginx
package installation. In this config we will show how to recompile
nginx package on Debian linux.

First install package building tools:

# apt-get install dpkg-dev

Next, we need to install all nginx build dependencies:

# apt-get build-dep nginx

Read more