diff --git a/.gitignore b/.gitignore
index 562fee6..31245c3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,3 +26,4 @@ pgadmin4.log
 /build
 /mac-build
 /dist
+/deb-build
diff --git a/Makefile b/Makefile
index 3f4e5fc..5e8eac6 100644
--- a/Makefile
+++ b/Makefile
@@ -34,6 +34,7 @@ PIP_CHECK_CMD = which pip &> /dev/null && pip show pip | grep Metadata-Version 2
 PGADMIN_SRC_DIR = pgadmin4
 PGADMIN_EGG = ${PGADMIN_SRC_DIR}.egg-info
 PGADMIN_BUILD = build
+PGADMIN_DEBBUILD = deb-build
 PGADMIN_MACBUILD = mac-build
 PGADMIN_DIST = dist
 PGADMIN_MANIFEST = MANIFEST.in
@@ -104,4 +105,11 @@ clean-appbundle:
 	rm -rf ${PGADMIN_MACBUILD}
 	rm -rf ${PGADMIN_DIST}/pgadmin4*.dmg*
 
+deb:
+	./pkg/deb/build.sh
+
+clean-deb:
+	rm -rf ${PGADMIN_DEBBUILD}
+	rm -rf ${PGADMIN_DIST}/pgadmin4*.deb*
+
 .PHONY: docs
diff --git a/pkg/deb/Makefile b/pkg/deb/Makefile
new file mode 100644
index 0000000..c3319ac
--- /dev/null
+++ b/pkg/deb/Makefile
@@ -0,0 +1,53 @@
+prep:
+	# Update spec file, patches, etc, before running spectool:
+	# git pull
+
+allclean:
+	git clean -df
+
+build-docs: prep
+	$(MAKE) -C $(TOPDIR)/docs/en_US -f Makefile.sphinx html
+
+build-runtime: prep
+	(cd $(TOPDIR)/runtime && $(QMAKE) pgAdmin4.pro)
+	# -lpython2.7 flag creates issue for ubuntu so moved to LIBS section
+	(cd $(TOPDIR)/runtime && sed --in-place '/LFLAGS / s/-lpython2.7//g' Makefile)
+	(cd $(TOPDIR)/runtime && sed --in-place '/^LIBS /s/.*/& -lpython2.7/' Makefile)
+	$(MAKE) -C $(TOPDIR)/runtime
+
+build-gen-common:
+	(cd $(DEBBUILDROOT) && dpkg-buildpackage -us -uc -b )
+
+	#Copy docs to stagging
+	cp -r $(TOPDIR)/docs/en_US/_build/html $(DEBBUILDROOT)/debian/$(DOCS_PACKAGE_NAME)/usr/share/doc/$(DOCS_PACKAGE_NAME)
+
+	#Copy web to stagging
+	mkdir -p $(DEBBUILDROOT)/debian/$(WEB_PACKAGE_NAME)/$(PYTHON_SITE_PACKAGE)/$(WEB_PACKAGE_NAME)
+	cp -r $(DEBBUILDROOT)/web/* $(DEBBUILDROOT)/debian/$(WEB_PACKAGE_NAME)/$(PYTHON_SITE_PACKAGE)/$(WEB_PACKAGE_NAME)
+	@echo "SERVER_MODE = False" > $(DEBBUILDROOT)/debian/$(WEB_PACKAGE_NAME)/$(PYTHON_SITE_PACKAGE)/$(WEB_PACKAGE_NAME)/config_local.py
+	@echo "HELP_PATH = '/usr/share/doc/$(DOCS_PACKAGE_NAME)/html/'" >> $(DEBBUILDROOT)/debian/$(WEB_PACKAGE_NAME)/$(PYTHON_SITE_PACKAGE)/$(WEB_PACKAGE_NAME)/config_local.py
+	@echo "MINIFY_HTML = False" >> $(DEBBUILDROOT)/debian/$(WEB_PACKAGE_NAME)/$(PYTHON_SITE_PACKAGE)/$(WEB_PACKAGE_NAME)/config_local.py
+
+	#Copy runtime to stagging
+	mkdir -p $(DEBBUILDROOT)/debian/$(RUNTIME_PACKAGE_NAME)/usr/$(RUNTIME_PACKAGE_NAME)
+	cp $(TOPDIR)/runtime/pgAdmin4 $(DEBBUILDROOT)/debian/$(RUNTIME_PACKAGE_NAME)/usr/$(RUNTIME_PACKAGE_NAME)
+
+	(cd $(DEBBUILDROOT) && dpkg-deb --build debian/$(DOCS_PACKAGE_NAME))
+	mv $(DEBBUILDROOT)/debian/$(DOCS_PACKAGE_NAME).deb $(TOPDIR)/dist/$(DOCS_PACKAGE_INSTALLER_NAME).deb
+
+	(cd $(DEBBUILDROOT) && dpkg-deb --build debian/$(WEB_PACKAGE_NAME))
+	mv $(DEBBUILDROOT)/debian/$(WEB_PACKAGE_NAME).deb $(TOPDIR)/dist/$(WEB_PACKAGE_INSTALLER_NAME).deb
+
+	(cd $(DEBBUILDROOT) && dpkg-deb --build debian/$(RUNTIME_PACKAGE_NAME))
+	mv $(DEBBUILDROOT)/debian/$(RUNTIME_PACKAGE_NAME).deb $(TOPDIR)/dist/$(RUNTIME_PACKAGE_INSTALLER_NAME).deb
+
+	echo "***************************************"
+	echo " Installer location - $(TOPDIR)/dist"
+	echo "***************************************"
+	echo "$(RUNTIME_PACKAGE_NAME).deb (Runtime) File is generated"
+	echo "$(WEB_PACKAGE_NAME).deb (Web) File is generated"
+	echo "$(DOCS_PACKAGE_NAME).deb (Docs) File is generated"
+
+
+deb: build-docs build-runtime build-gen-common
+
diff --git a/pkg/deb/build.sh b/pkg/deb/build.sh
new file mode 100755
index 0000000..68a71ed
--- /dev/null
+++ b/pkg/deb/build.sh
@@ -0,0 +1,77 @@
+#!/bin/sh
+
+export QMAKE=/usr/lib/x86_64-linux-gnu/qt5/bin/qmake
+
+if ! [ -e "$QMAKE" ]; then
+	echo "ERROR: QMAKE - $QMAKE does not exits";
+	exit 1;
+fi
+
+#Script to create the pgAdmin4 .deb
+export WD=$(cd `dirname $0` && pwd)
+export TOPDIR=$WD/../..
+export DEBBUILDROOT=$TOPDIR/deb-build
+
+# Find the pgAdmin4 app name and version from config.py
+export APP_RELEASE=`grep "^APP_RELEASE" $TOPDIR/web/config.py | cut -d"=" -f2 | sed 's/ //g'`
+export APP_REVISION=`grep "^APP_REVISION" $TOPDIR/web/config.py | cut -d"=" -f2 | sed 's/ //g'`
+APP_NAME=`grep "^APP_NAME" $TOPDIR/web/config.py | cut -d"=" -f2 | sed "s/'//g"`
+# We want app name in lower case with no spaces
+export APP_NAME=`echo $APP_NAME | sed 's/ //g' | awk '{print tolower($0)}'`
+export APP_LONG_VERSION=$APP_RELEASE.$APP_REVISION
+export APP_VERSION=`echo $APP_LONG_VERSION | cut -d . -f1,2`
+export APP_SUFFIX=`grep "^APP_SUFFIX" $TOPDIR/web/config.py | cut -d"=" -f2 | sed 's/ //g' | sed "s/'//g"`
+export APP_LONG_VERSION=$APP_LONG_VERSION-$APP_SUFFIX
+
+#Runtime, web and docs there modules would be created under debian packages
+export RUNTIME_PACKAGE_NAME=$APP_NAME-runtime-v$APP_RELEASE
+export RUNTIME_PACKAGE_INSTALLER_NAME=$APP_NAME-runtime-v$APP_LONG_VERSION
+export WEB_PACKAGE_NAME=$APP_NAME-web-v$APP_RELEASE
+export WEB_PACKAGE_INSTALLER_NAME=$APP_NAME-web-v$APP_LONG_VERSION
+export DOCS_PACKAGE_NAME=$APP_NAME-docs-v$APP_RELEASE
+export DOCS_PACKAGE_INSTALLER_NAME=$APP_NAME-docs-v$APP_LONG_VERSION
+
+export PYTHON_SITE_PACKAGE=`python -c "import site; print site.getsitepackages()[1]"`
+
+# Create the directories if not exist
+mkdir -p $DEBBUILDROOT/debian || exit 1
+mkdir -p $TOPDIR/dist
+
+cd ./pkg/deb
+
+#Creating on the fly control file for debian
+cp changelog $DEBBUILDROOT/debian/
+cp rules $DEBBUILDROOT/debian/
+cp control $DEBBUILDROOT/debian/
+
+# Create control file, updates runtime,web,doc,appname and version
+sed -i "s/RUNTIME_PACKAGE_NAME/$RUNTIME_PACKAGE_NAME/g" $DEBBUILDROOT/debian/control
+sed -i "s/WEB_PACKAGE_NAME/$WEB_PACKAGE_NAME/g" $DEBBUILDROOT/debian/control
+sed -i "s/DOCS_PACKAGE_NAME/$DOCS_PACKAGE_NAME/g" $DEBBUILDROOT/debian/control
+sed -i "s/APP_NAME/$APP_NAME/g" $DEBBUILDROOT/debian/control
+sed -i "s/APP_VERSION/$APP_VERSION/g" $DEBBUILDROOT/debian/control
+
+# Create changelog file
+sed -i "s/DATETIME/`date +"%a, %d %b %Y %H:%M:%S +0200"`/g" $DEBBUILDROOT/debian/changelog
+sed -i "s/APPNAME/$APP_NAME/g" $DEBBUILDROOT/debian/changelog
+sed -i "s/APPVERSION/$APP_LONG_VERSION/g" $DEBBUILDROOT/debian/changelog
+
+# Create web folder config_local file
+cp -r $TOPDIR/web $DEBBUILDROOT/web
+find $DEBBUILDROOT/web -name "*.pyc" -exec rm -rf {} \; 2> /dev/null
+find $DEBBUILDROOT/web -name "pgAdmin4.db" rm -rf {} \; 2> /dev/null
+find $DEBBUILDROOT/web -name "config_local.py" rm -rf {} \; 2> /dev/null
+
+echo "SERVER_MODE = False" > $DEBBUILDROOT/web/config_local.py
+echo "HELP_PATH = '/usr/share/doc/$WEB_PACKAGE_NAME/html'" >> $DEBBUILDROOT/web/config_local.py
+echo "MINIFY_HTML = False" >> $DEBBUILDROOT/web/config_local.py
+
+
+# Build debian
+make deb || exit 1
+
+echo "Cleaning up..."
+rm -rf $TOPDIR/pgadmin4*.deb $TOPDIR/pgadmin4*.changes
+rm -rf $DEBBUILDROOT
+# Clean up buildroot after successful build
+
diff --git a/pkg/deb/changelog b/pkg/deb/changelog
new file mode 100644
index 0000000..2102b41
--- /dev/null
+++ b/pkg/deb/changelog
@@ -0,0 +1,2 @@
+APPNAME (APPVERSION) experiemental; urgency=low
+ -- pgamin4 hackers <pgadmin-hackers@postgresql.org> DATETIME
diff --git a/pkg/deb/control b/pkg/deb/control
new file mode 100644
index 0000000..b81b490
--- /dev/null
+++ b/pkg/deb/control
@@ -0,0 +1,73 @@
+Source: APP_NAME
+Section: misc
+Priority: optional
+Maintainer: pgamin4 hackers <pgadmin-hackers@postgresql.org>
+Build-Depends: debhelper, dpkg-dev,aptitude,devscripts,build-essential,qt-sdk,python-dev,libqt5webkit5-dev
+Standards-Version: APP_VERSION
+
+Package: APP_NAME
+Architecture: all
+Description: graphical administration tool for PostgreSQL
+ pgAdmin 4 is a database design and management application for use with
+ PostgreSQL. The application can be used to manage PostgreSQL 7.3 and above
+ running on any platform.
+ .
+ pgAdmin 4 is designed to answer the needs of all users, from writing
+ simple SQL queries to developing complex databases. The graphical
+ interface supports all PostgreSQL features and makes administration
+ easy. The application also includes a syntax highlighting SQL editor, a
+ server-side code editor, an SQL/batch/shell job scheduling agent,
+ support for the Slony-I replication engine and much more. Server
+ connection may be made using TCP/IP or Unix Domain Sockets (on *nix
+ platforms), and may be SSL encrypted for security. No additional
+ drivers are required to communicate with the database server.
+ .
+ Homepage: http://www.pgadmin.org/
+
+Package: WEB_PACKAGE_NAME
+Architecture: all
+#Depends: python-sphinx-theme-alabaster, python-pycrypto, python-beautifulsoup4, python-django-htmlmin, python-flask-gravatar, python-flask-mail, python-linecache2, python-pygments, python-pytz, python-simplejson, python-snowballstemmer, python-sphinx-rtd-theme, python-traceback2
+Depends: DOCS_PACKAGE_NAME, python-blinker, python-extras, python-fixtures, python-flask,python-babel,python-flask-login,python-flask-principal,python-flask-sqlalchemy,python-wtforms,python-html5lib, python-importlib, python-itsdangerous, python-jinja2, python-markupsafe, python-passlib, python-pbr, python-psycopg2, python-dateutil, python-mimeparse, python-six, python-speaklater, python-sphinx, python-sqlalchemy, python-testscenarios, python-testtools, python-unittest2, python-werkzeug, python-sqlparse, python-docutils
+Description: graphical administration tool for PostgreSQL - documentation
+ pgAdmin 4 is a database design and management application for use with
+ PostgreSQL. The application can be used to manage PostgreSQL 7.3 and above
+ running on any platform.
+ .
+ pgAdmin 4 is designed to answer the needs of all users, from writing
+ simple SQL queries to developing complex databases. The graphical
+ interface supports all PostgreSQL features and makes administration
+ easy. The application also includes a syntax highlighting SQL editor, a
+ server-side code editor, an SQL/batch/shell job scheduling agent,
+ support for the Slony-I replication engine and much more. Server
+ connection may be made using TCP/IP or Unix Domain Sockets (on *nix
+ platforms), and may be SSL encrypted for security. No additional
+ drivers are required to communicate with the database server.
+ .
+ Homepage: http://www.pgadmin.org/
+
+Package: RUNTIME_PACKAGE_NAME
+#Depends: WEB_PACKAGE_NAME (= ${Source-Version}), ${shlibs:Depends}
+Depends: WEB_PACKAGE_NAME
+Architecture: all
+#Enhances: pgadmin4(= ${Source-Version})
+#Conflicts: pgadmin4 (<< 1.0.2-1)
+#Replaces: pgadmin4 (<< 1.0.2-1)
+Description: graphical administration tool for PostgreSQL - documentation
+ pgAdmin III is a database design and management application for use with
+ PostgreSQL.
+ .
+ This package contains the documentation for pgAdmin III in English language.
+ This package is mandatory to get the pgAdmin III help system to run smoothly.
+ .
+ Homepage: http://www.pgadmin.org/
+
+Package: DOCS_PACKAGE_NAME
+Architecture: all
+Description: graphical administration tool for PostgreSQL - documentation
+ pgAdmin III is a database design and management application for use with
+ PostgreSQL.
+ .
+ This package contains the documentation for pgAdmin III in English language.
+ This package is mandatory to get the pgAdmin III help system to run smoothly.
+ .
+ Homepage: http://www.pgadmin.org/
diff --git a/pkg/deb/rules b/pkg/deb/rules
new file mode 100755
index 0000000..9b1ba78
--- /dev/null
+++ b/pkg/deb/rules
@@ -0,0 +1,97 @@
+#!/usr/bin/make -f
+
+PACKAGE_NAME_RUNTIME=pgadmin4-runtime
+PACKAGE_NAME_WEB=pgadmin4-web
+BINARY_NAME_RUNTIME=pgAdmin4
+SRC_DIR=$(CURDIR)/../../runtime
+
+configure:
+	#qmake ~pareshmore/svn/pgadmin4/runtime/pgAdmin4.pro
+
+build:
+	#$(MAKE) -C $(SRC_DIR)
+
+
+clean:
+	#dh_testdir
+	#dh_testroot
+	#dh_clean
+	#rm -rf $(CURDIR)/$(BINARY_NAME)
+	#$(MAKE) -C $(SRC_DIR) clean
+	#rm *.deb
+
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+
+binary-indep: build install
+	dh_testdir
+	dh_testroot
+	dh_installchangelogs
+	dh_installdocs
+	dh_installexamples
+	dh_installman
+	dh_link
+	dh_compress
+	dh_fixperms
+	dh_installdeb
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+# binary-arch/binary-indep
+# in another 'make' thread.
+spec-binary-indep:
+	dh_testdir
+	dh_testroot
+	dh_installchangelogs
+	dh_installdocs
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+
+
+# Must not depend on anything. This is to be called by
+# binary-arch/binary-indep
+# in another 'make' thread.
+spec-binary-arch:
+	dh_testdir
+	dh_testroot
+	dh_installchangelogs
+	dh_installdocs
+	dh_installexamples
+	dh_installmenu
+	dh_installman
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+        #make -f debian/rules $(doPgA3Wx)-clean
+
+# Build architecture independant packages using the common target.
+binary-indep: build install
+	$(MAKE) -f debian/rules DH_OPTIONS=-i spec-binary-indep
+
+# Build architecture dependant packages using the common target.
+binary-arch: build install
+	$(MAKE) -f debian/rules DH_OPTIONS=-a spec-binary-arch
+
+binary: binary-indep binary-arch
+.PHONY: build clean orig binary-indep binary-arch binary install
+
