diff --git a/.gitignore b/.gitignore
index 0386e03..e3bd268 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,4 +26,5 @@ pgadmin4.log
 /build
 /mac-build
 /src-build
+/rpm-build
 /dist
diff --git a/Makefile b/Makefile
index 1d32581..988c6da 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@ SHELL = /bin/sh
 all: docs install-pip-requirements pip src
 
 # Include all clean sub-targets in clean
-clean: clean-dist clean-docs clean-pip clean-appbundle clean-src
+clean: clean-dist clean-docs clean-pip clean-appbundle clean-rpm clean-src
 
 #########################################################################
 # Python PIP package
@@ -38,6 +38,7 @@ PGADMIN_EGG = ${PGADMIN_SRC_DIR}.egg-info
 PGADMIN_BUILD = build
 PGADMIN_MACBUILD = mac-build
 PGADMIN_SRCBUILD = src-build
+PGADMIN_RPMBUILD = rpm-build
 PGADMIN_DIST = dist
 PGADMIN_MANIFEST = MANIFEST.in
 PGADMIN_INSTALL_CMD = pip install --use-wheel --find-links=${PGADMIN_DIST} ${PGADMIN_SRC_DIR}
@@ -113,6 +114,15 @@ clean-src:
 	rm -rf ${PGADMIN_SRCBUILD}
 	rm -rf ${PGADMIN_DIST}/pgadmin4*.tar.gz
 
+rpm:
+	./pkg/rpm/build.sh
+
+clean-rpm:
+	rm -rf ${PGADMIN_RPMBUILD}
+	rm -rf ${PGADMIN_DIST}/noarch
+	rm -rf ${PGADMIN_DIST}/x86_64
+
 clean-dist:
 	rm -rf ${PGADMIN_DIST}
+
 .PHONY: docs
diff --git a/docs/en_US/conf.py b/docs/en_US/conf.py
index 93ad4e9..ac7c9fc 100644
--- a/docs/en_US/conf.py
+++ b/docs/en_US/conf.py
@@ -17,6 +17,7 @@ import sys, os
 root = os.path.dirname(os.path.realpath(__file__))
 sys.path.insert(0, root + '/../../web/')
 import config
+import sphinx_rtd_theme
 
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
@@ -104,7 +105,7 @@ html_theme = 'sphinx_rtd_theme'
 #html_theme_options = {}
 
 # Add any paths that contain custom themes here, relative to this directory.
-#html_theme_path = []
+html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
 
 # The name for this set of Sphinx documents.  If None, it defaults to
 # "<project> v<release> documentation".
diff --git a/pkg/rpm/Makefile b/pkg/rpm/Makefile
new file mode 100644
index 0000000..fd0144a
--- /dev/null
+++ b/pkg/rpm/Makefile
@@ -0,0 +1,10 @@
+
+SPECFILE="pgadmin4.spec"
+
+rpm:
+	rpmbuild --define "_sourcedir $(SOURCEDIR)" \
+        --define "_specdir $(WD)" \
+        --define "_rpmdir $(DISTROOT)" \
+        --define "_builddir $(BUILDDIR)" \
+        --define "_buildrootdir $(BUILDROOT)" \
+        --define "dist $(DIST)" -bb $(SPECFILE)
diff --git a/pkg/rpm/README.txt b/pkg/rpm/README.txt
new file mode 100644
index 0000000..9bbd25e
--- /dev/null
+++ b/pkg/rpm/README.txt
@@ -0,0 +1,30 @@
+Installing pgAdmin
+==================
+
+This document describes how to build pgAdmin on Linux and generate the RPMs.
+
+Supported Versions:
+
+ - RHEL6 or above, Fedora 22 or above
+
+Required Packages:
+
+ - All the required packages are mentioned in the requirements file. They should be
+installed with yum/dnf. On RHEL, some python modules are available only through EPEL.
+
+1. Python devel
+  - Python 2.6 or above
+
+2. Sphinx (to build docs)
+
+3. QT devel
+  - Qt 4.6 or above, QT 5
+
+4. PostgreSQL installation
+  - PostgreSQL 9.1 or above 
+ 
+
+Building:
+
+To build, go to pgAdmin4 source root directory and execute "make rpm". This will
+create the RPMs for runtime, web and doc in $SRC/dist
diff --git a/pkg/rpm/build.sh b/pkg/rpm/build.sh
new file mode 100755
index 0000000..6b0ee89
--- /dev/null
+++ b/pkg/rpm/build.sh
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+#Script to create the pgAdmin4 RPMs.
+
+# Check whether lsb_release exists to find the OS information
+if [ ! -f /usr/bin/lsb_release ]
+then
+        echo
+        echo "ERROR: lsb_release command does not exist. Please install it with"
+        echo
+        echo "yum -y install redhat-lsb-core"
+        echo
+        echo "Exiting..."
+        echo
+        exit 1
+fi
+
+# Gather some information from the OS: OS name, version and arch:
+LSB_DISTRO_NAME=`lsb_release -i -s`
+LSB_DISTRO_VERSION=`lsb_release -r -s`
+DISTRO_ARCH=`uname -m`
+
+# We need the lowercase version of the distro name:
+LSB_DISTRO_NAME=`echo $LSB_DISTRO_NAME | awk '{print tolower($0)}'`
+
+if [ "$LSB_DISTRO_NAME" = "fedora" ]; then
+	export DIST=".f$LSB_DISTRO_VERSION"
+else
+	LSB_DISTRO_VERSION=`echo $LSB_DISTRO_VERSION | cut -d"." -f1`
+	export DIST=".rhel$LSB_DISTRO_VERSION"
+fi
+
+# Variables
+export WD=$(cd `dirname $0` && pwd)
+export SOURCEDIR=$WD/../..
+export RPMBUILDROOT=$SOURCEDIR/rpm-build
+export BUILDDIR=$RPMBUILDROOT/build
+export BUILDROOT=$RPMBUILDROOT/buildroot
+export DISTROOT=$SOURCEDIR/dist
+
+# Create the directories if not exist
+mkdir -p $BUILDDIR
+mkdir -p $BUILDROOT
+mkdir -p $DISTROOT
+
+# Find the pgAdmin4 app name and version from config.py
+APP_RELEASE=`grep "^APP_RELEASE" web/config.py | cut -d"=" -f2 | sed 's/ //g'`
+APP_REVISION=`grep "^APP_REVISION" web/config.py | cut -d"=" -f2 | sed 's/ //g'`
+APP_NAME=`grep "^APP_NAME" web/config.py | cut -d"=" -f2 | sed "s/'//g"`
+# We want app name in lower case with no spaces
+APP_NAME=`echo $APP_NAME | sed 's/ //g' | awk '{print tolower($0)}'`
+APP_LONG_VERSION=$APP_RELEASE.$APP_REVISION
+APP_SHORT_VERSION=`echo $APP_LONG_VERSION | cut -d . -f1,2`
+APP_SUFFIX=`grep "^APP_SUFFIX" web/config.py | cut -d"=" -f2 | sed 's/ //g' | sed "s/'//g"`
+if [ ! -z $APP_SUFFIX ]; then
+    APP_LONG_VERSION=$APP_LONG_VERSION-$APP_SUFFIX
+    APP_REVISION="${APP_REVISION}_$APP_SUFFIX" #hyphen not allowed in SPEC for version
+fi
+
+# Generate SPEC
+cd ./pkg/rpm
+
+sed -e "s/APP_REL/$APP_RELEASE/" \
+    -e "s/APP_REV/$APP_REVISION/" \
+    -e "s/APP_NAME/$APP_NAME/" \
+    -e "s/DISTRO_ARCH/$DISTRO_ARCH/" pgadmin4.spec.in > pgadmin4.spec
+
+# Build RPMs
+make rpm || exit 1
+
+# Clean up buildroot after successful build
+echo "Cleaning up..."
+#rm -rf $RPMBUILDROOT
+
diff --git a/pkg/rpm/pgadmin4.spec b/pkg/rpm/pgadmin4.spec
new file mode 100644
index 0000000..a8279d2
--- /dev/null
+++ b/pkg/rpm/pgadmin4.spec
@@ -0,0 +1,236 @@
+
+%define pgAdmin4_release 1
+%define pgAdmin4_revision 0_beta1
+
+%define name pgadmin4
+%define pgadmin4instdir /usr/%{name}-v%{pgAdmin4_release}
+%define pgadmin4_webinstdir %{name}-web-v%{pgAdmin4_release}
+
+Name:           %{name}
+Version:        %{pgAdmin4_release}.%{pgAdmin4_revision}
+Release:        1%{?dist}
+Summary:        pgAdmin 4 is a rewrite of the popular pgAdmin3 management tool for the PostgreSQL (http://www.postgresql.org) database.   
+
+Group:          Applications/Databases   
+License:        PostgreSQL License
+URL:            http://www.pgadmin.org
+#Source0:        ftp://ftp.postgresql.org/pub/pgadmin4/release/v%{version}/src/%{name}-%{version}.tar.gz
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+BuildArch:      x86_64
+
+BuildRequires:  mesa-libGL-devel
+BuildRequires:  gcc-c++
+Requires:       pgadmin4-web = %{version}
+%if 0%{?fedora}
+BuildRequires:	qt5-qtbase-devel >= 5.1
+BuildRequires:  qt5-qtwebkit-devel
+%define QMAKE   /usr/bin/qmake-qt5
+%else
+BuildRequires:  qt-devel >= 4.6
+BuildRequires:  qtwebkit-devel
+%define QMAKE   /usr/lib64/qt4/bin/qmake
+%endif
+
+%if 0%{?fedora}
+BuildRequires:  python3-devel
+Requires:       python >= 3.3
+%else
+BuildRequires:  python-devel
+Requires:       python >= 2.6
+%endif
+
+%if 0%{?fedora}
+Requires:       qt >= 5.1
+%else
+Requires:       qt >= 4.6
+%endif
+
+%description
+pgAdmin 4 is a rewrite of the popular pgAdmin3 management tool for the PostgreSQL (http://www.postgresql.org) database.
+pgAdmin 4 is being written as a web application in Python, using jQuery and
+Bootstrap for the client side processing and UI. On the server side, Flask is
+being utilised.
+
+Although developed using web technologies, we intend for pgAdmin 4 to be usable
+either on a web server using a browser, or standalone on a workstation. The
+runtime/ subdirectory contains a QT based runtime application intended to allow
+this - it is essentially a browser and Python interpretor in one package which
+will be capable of hosting the Python application and presenting it to the user
+as a desktop application.
+
+%package docs
+Summary:        Documentation for pgAdmin4
+Group:          Applications/Databases
+BuildArch:      noarch
+# These are required for -docs subpackage:
+%if 0%{?fedora}
+BuildRequires:  python3-sphinx
+BuildRequires:  python3-sphinx_rtd_theme
+%else
+BuildRequires:  python-sphinx
+BuildRequires:  python-sphinx_rtd_theme
+%endif
+
+%description docs
+This package contains documentation for various languages,
+which are in html format.
+
+%package        web
+Summary:        pgAdmin4 web package
+BuildArch:      noarch
+Requires:       %{name}-docs = %{version}
+%if 0%{?fedora}
+Requires:  python3-babel
+Requires:  python3-flask
+Requires:  python3-flask-sqlalchemy
+Requires:  python3-flask-wtf
+Requires:  python3-jinja2
+Requires:  python3-markupsafe
+Requires:  python3-sqlalchemy
+Requires:  python3-wtforms
+Requires:  python3-beautifulsoup4
+Requires:  python3-blinker
+Requires:  python3-html5lib
+Requires:  python3-itsdangerous
+Requires:  python3-psycopg2
+Requires:  python3-six
+Requires:  python3-crypto
+Requires:  python3-simplejson
+Requires:  python3-dateutil
+Requires:  python3-werkzeug
+Requires:  python3-sqlparse
+Requires:  python3-docutils
+Requires:  python3-extras
+Requires:  python3-fixtures
+Requires:  python3-linecache2
+Requires:  python3-pbr
+Requires:  python3-pygments
+Requires:  python3-mimeparse
+Requires:  python3-snowballstemmer
+Requires:  python3-testscenarios
+Requires:  python3-testtools
+Requires:  python3-traceback2
+Requires:  python3-unittest2
+Requires:  python3-wheel
+#Requires:  python3-pyrsistent
+#Requires:  python3-flask-babel
+#Requires:  python3-speaklater
+#Requires:  python3-passlib
+#Requires:  python3-flask-gravatar
+#Requires:  python3-flask-mail
+#Requires:  python3-flask-security
+#Requires:  python3-flask-login
+#Requires:  python3-flask-principal
+#Requires:  python3-django-htmlmin
+%else
+Requires:  python-babel
+Requires:  python-flask
+Requires:  python-flask-sqlalchemy
+Requires:  python-flask-wtf
+Requires:  python-jinja2
+Requires:  python-markupsafe
+Requires:  python-sqlalchemy
+Requires:  python-wtforms
+Requires:  python-beautifulsoup4
+Requires:  python-blinker
+Requires:  python-html5lib
+Requires:  python-itsdangerous
+Requires:  python-psycopg2
+Requires:  python-six
+Requires:  python-crypto
+Requires:  python-simplejson
+Requires:  python-dateutil
+Requires:  python-werkzeug
+Requires:  pytz
+Requires:  python-sqlparse
+Requires:  python-docutils
+Requires:  python-extras
+Requires:  python-fixtures
+Requires:  python-linecache2
+Requires:  python-pbr
+Requires:  python-pygments
+Requires:  python-mimeparse
+Requires:  python-testscenarios
+Requires:  python-testtools
+Requires:  python-traceback2
+Requires:  python-unittest2
+Requires:  python2-sphinx-theme-alabaster
+#Requires:  python2-snowballstemmer
+#Requires:  python-pyrsistent
+#Requires:  python-flask-babel
+#Requires:  python-speaklater
+#Requires:  python-passlib
+#Requires:  python-flask-gravatar
+#Requires:  python-flask-mail
+#Requires:  python-flask-security
+#Requires:  python-flask-login
+#Requires:  python-flask-principal
+#Requires:  python-django-htmlmin
+#Requires:  python-importlib
+%endif
+
+%if 0%{?fedora}
+%define PYTHON_SITELIB %{python3_sitelib}
+%else
+%define PYTHON_SITELIB %{python2_sitelib}
+%endif
+
+%description    web
+This package contains the required files to run pgAdmin4 as a web application
+
+%build
+cd %{_sourcedir}/runtime
+%{QMAKE} -o Makefile pgAdmin4.pro
+make
+cd ..
+LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 make -C docs/en_US -f Makefile.sphinx html
+#chrpath -d pgAdmin4
+
+%install
+rm -rf %{buildroot}
+cd %{_sourcedir}
+install -d -m 755 %{buildroot}/%{_docdir}/pgadmin4-docs-v%{pgAdmin4_release}
+cp -r docs/en_US/_build/html %{buildroot}/%{_docdir}/pgadmin4-docs-v%{pgAdmin4_release}
+
+cd runtime
+install -d -m 755 %{buildroot}%{pgadmin4instdir}/runtime
+cp pgAdmin4 %{buildroot}%{pgadmin4instdir}/runtime
+
+install -d -m 755 %{buildroot}%{PYTHON_SITELIB}/%{pgadmin4_webinstdir}
+cp -pR ../web/* %{buildroot}%{PYTHON_SITELIB}/%{pgadmin4_webinstdir}
+cd %{buildroot}%{PYTHON_SITELIB}/%{pgadmin4_webinstdir}
+rm -f pgadmin4.db config_local.* config*.pyc
+
+# Create config_local.py
+echo "SERVER_MODE = False" > config_local.py
+echo "MINIFY_HTML = False" >> config_local.py
+echo "HTML_HELP = '%{_docdir}/pgadmin4-doc-v1/html/'" >> config_local.py
+# Create the init so that pgadmin4-web is treated as module as we need to find the
+# version specfifc web path as they stay side-by-side
+touch __init__.py
+
+# Create config snippet for Apache
+install -d -m 755 ./etc/httpd/conf.d
+touch ./etc/httpd/conf.d/${name}-v%{pgAdmin4_release}
+
+%clean
+#rm -rf %{buildroot}
+
+%files
+%defattr(-,root,root,-)
+%{pgadmin4instdir}/runtime/pgAdmin4
+
+%files web
+%defattr(-,root,root,-)
+%{PYTHON_SITELIB}/%{pgadmin4_webinstdir}
+%doc
+
+%files docs
+%defattr(-,root,root)
+%{_docdir}/pgadmin4-docs-v%{pgAdmin4_release}
+
+%changelog
+* Fri Jun 03 2016 Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
+- Initial RPM for v1.0alpha1
+
diff --git a/pkg/rpm/pgadmin4.spec.in b/pkg/rpm/pgadmin4.spec.in
new file mode 100644
index 0000000..cdc151a
--- /dev/null
+++ b/pkg/rpm/pgadmin4.spec.in
@@ -0,0 +1,236 @@
+
+%define pgAdmin4_release APP_REL
+%define pgAdmin4_revision APP_REV
+
+%define name APP_NAME
+%define pgadmin4instdir /usr/%{name}-v%{pgAdmin4_release}
+%define pgadmin4_webinstdir %{name}-web-v%{pgAdmin4_release}
+
+Name:           %{name}
+Version:        %{pgAdmin4_release}.%{pgAdmin4_revision}
+Release:        1%{?dist}
+Summary:        pgAdmin 4 is a rewrite of the popular pgAdmin3 management tool for the PostgreSQL (http://www.postgresql.org) database.   
+
+Group:          Applications/Databases   
+License:        PostgreSQL License
+URL:            http://www.pgadmin.org
+#Source0:        ftp://ftp.postgresql.org/pub/pgadmin4/release/v%{version}/src/%{name}-%{version}.tar.gz
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+BuildArch:      DISTRO_ARCH
+
+BuildRequires:  mesa-libGL-devel
+BuildRequires:  gcc-c++
+Requires:       pgadmin4-web = %{version}
+%if 0%{?fedora}
+BuildRequires:	qt5-qtbase-devel >= 5.1
+BuildRequires:  qt5-qtwebkit-devel
+%define QMAKE   /usr/bin/qmake-qt5
+%else
+BuildRequires:  qt-devel >= 4.6
+BuildRequires:  qtwebkit-devel
+%define QMAKE   /usr/lib64/qt4/bin/qmake
+%endif
+
+%if 0%{?fedora}
+BuildRequires:  python3-devel
+Requires:       python >= 3.3
+%else
+BuildRequires:  python-devel
+Requires:       python >= 2.6
+%endif
+
+%if 0%{?fedora}
+Requires:       qt >= 5.1
+%else
+Requires:       qt >= 4.6
+%endif
+
+%description
+pgAdmin 4 is a rewrite of the popular pgAdmin3 management tool for the PostgreSQL (http://www.postgresql.org) database.
+pgAdmin 4 is being written as a web application in Python, using jQuery and
+Bootstrap for the client side processing and UI. On the server side, Flask is
+being utilised.
+
+Although developed using web technologies, we intend for pgAdmin 4 to be usable
+either on a web server using a browser, or standalone on a workstation. The
+runtime/ subdirectory contains a QT based runtime application intended to allow
+this - it is essentially a browser and Python interpretor in one package which
+will be capable of hosting the Python application and presenting it to the user
+as a desktop application.
+
+%package docs
+Summary:        Documentation for pgAdmin4
+Group:          Applications/Databases
+BuildArch:      noarch
+# These are required for -docs subpackage:
+%if 0%{?fedora}
+BuildRequires:  python3-sphinx
+BuildRequires:  python3-sphinx_rtd_theme
+%else
+BuildRequires:  python-sphinx
+BuildRequires:  python-sphinx_rtd_theme
+%endif
+
+%description docs
+This package contains documentation for various languages,
+which are in html format.
+
+%package        web
+Summary:        pgAdmin4 web package
+BuildArch:      noarch
+Requires:       %{name}-docs = %{version}
+%if 0%{?fedora}
+Requires:  python3-babel
+Requires:  python3-flask
+Requires:  python3-flask-sqlalchemy
+Requires:  python3-flask-wtf
+Requires:  python3-jinja2
+Requires:  python3-markupsafe
+Requires:  python3-sqlalchemy
+Requires:  python3-wtforms
+Requires:  python3-beautifulsoup4
+Requires:  python3-blinker
+Requires:  python3-html5lib
+Requires:  python3-itsdangerous
+Requires:  python3-psycopg2
+Requires:  python3-six
+Requires:  python3-crypto
+Requires:  python3-simplejson
+Requires:  python3-dateutil
+Requires:  python3-werkzeug
+Requires:  python3-sqlparse
+Requires:  python3-docutils
+Requires:  python3-extras
+Requires:  python3-fixtures
+Requires:  python3-linecache2
+Requires:  python3-pbr
+Requires:  python3-pygments
+Requires:  python3-mimeparse
+Requires:  python3-snowballstemmer
+Requires:  python3-testscenarios
+Requires:  python3-testtools
+Requires:  python3-traceback2
+Requires:  python3-unittest2
+Requires:  python3-wheel
+#Requires:  python3-pyrsistent
+#Requires:  python3-flask-babel
+#Requires:  python3-speaklater
+#Requires:  python3-passlib
+#Requires:  python3-flask-gravatar
+#Requires:  python3-flask-mail
+#Requires:  python3-flask-security
+#Requires:  python3-flask-login
+#Requires:  python3-flask-principal
+#Requires:  python3-django-htmlmin
+%else
+Requires:  python-babel
+Requires:  python-flask
+Requires:  python-flask-sqlalchemy
+Requires:  python-flask-wtf
+Requires:  python-jinja2
+Requires:  python-markupsafe
+Requires:  python-sqlalchemy
+Requires:  python-wtforms
+Requires:  python-beautifulsoup4
+Requires:  python-blinker
+Requires:  python-html5lib
+Requires:  python-itsdangerous
+Requires:  python-psycopg2
+Requires:  python-six
+Requires:  python-crypto
+Requires:  python-simplejson
+Requires:  python-dateutil
+Requires:  python-werkzeug
+Requires:  pytz
+Requires:  python-sqlparse
+Requires:  python-docutils
+Requires:  python-extras
+Requires:  python-fixtures
+Requires:  python-linecache2
+Requires:  python-pbr
+Requires:  python-pygments
+Requires:  python-mimeparse
+Requires:  python-testscenarios
+Requires:  python-testtools
+Requires:  python-traceback2
+Requires:  python-unittest2
+Requires:  python2-sphinx-theme-alabaster
+#Requires:  python2-snowballstemmer
+#Requires:  python-pyrsistent
+#Requires:  python-flask-babel
+#Requires:  python-speaklater
+#Requires:  python-passlib
+#Requires:  python-flask-gravatar
+#Requires:  python-flask-mail
+#Requires:  python-flask-security
+#Requires:  python-flask-login
+#Requires:  python-flask-principal
+#Requires:  python-django-htmlmin
+#Requires:  python-importlib
+%endif
+
+%if 0%{?fedora}
+%define PYTHON_SITELIB %{python3_sitelib}
+%else
+%define PYTHON_SITELIB %{python2_sitelib}
+%endif
+
+%description    web
+This package contains the required files to run pgAdmin4 as a web application
+
+%build
+cd %{_sourcedir}/runtime
+%{QMAKE} -o Makefile pgAdmin4.pro
+make
+cd ..
+LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 make -C docs/en_US -f Makefile.sphinx html
+#chrpath -d pgAdmin4
+
+%install
+rm -rf %{buildroot}
+cd %{_sourcedir}
+install -d -m 755 %{buildroot}/%{_docdir}/pgadmin4-docs-v%{pgAdmin4_release}
+cp -r docs/en_US/_build/html %{buildroot}/%{_docdir}/pgadmin4-docs-v%{pgAdmin4_release}
+
+cd runtime
+install -d -m 755 %{buildroot}%{pgadmin4instdir}/runtime
+cp pgAdmin4 %{buildroot}%{pgadmin4instdir}/runtime
+
+install -d -m 755 %{buildroot}%{PYTHON_SITELIB}/%{pgadmin4_webinstdir}
+cp -pR ../web/* %{buildroot}%{PYTHON_SITELIB}/%{pgadmin4_webinstdir}
+cd %{buildroot}%{PYTHON_SITELIB}/%{pgadmin4_webinstdir}
+rm -f pgadmin4.db config_local.* config*.pyc
+
+# Create config_local.py
+echo "SERVER_MODE = False" > config_local.py
+echo "MINIFY_HTML = False" >> config_local.py
+echo "HTML_HELP = '%{_docdir}/pgadmin4-doc-v1/html/'" >> config_local.py
+# Create the init so that pgadmin4-web is treated as module as we need to find the
+# version specfifc web path as they stay side-by-side
+touch __init__.py
+
+# Create config snippet for Apache
+install -d -m 755 ./etc/httpd/conf.d
+touch ./etc/httpd/conf.d/%{name}-v%{pgAdmin4_release}
+
+%clean
+#rm -rf %{buildroot}
+
+%files
+%defattr(-,root,root,-)
+%{pgadmin4instdir}/runtime/pgAdmin4
+
+%files web
+%defattr(-,root,root,-)
+%{PYTHON_SITELIB}/%{pgadmin4_webinstdir}
+%doc
+
+%files docs
+%defattr(-,root,root)
+%{_docdir}/pgadmin4-docs-v%{pgAdmin4_release}
+
+%changelog
+* Fri Jun 03 2016 Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
+- Initial RPM for v1.0alpha1
+
diff --git a/runtime/Server.cpp b/runtime/Server.cpp
index fd930f6..db10c56 100644
--- a/runtime/Server.cpp
+++ b/runtime/Server.cpp
@@ -22,6 +22,24 @@
 // App headers
 #include "Server.h"
 
+QString GetpgadminWebDirPath()
+{
+    QString pgadmin4_pkg_name = "pgadmin4-web-v" + PGA_APP_RELEASE;
+    //QString pgadmin4_mod_name = "pgadmin4-web-v" + PGA_APP_RELEASE + ".pgAdmin4";
+    qDebug() << "pgadmin4_pkg_name" << pgadmin4_pkg_name;
+    QString cmd = "python -c \"import pkgutil; print pkgutil.get_loader('" + pgadmin4_pkg_name + "').filename;\""; 
+    //  In case we are running in a release RPM, the pythonpath will be system path
+    QProcess process;
+    //process.start("python -c \"import pkgutil; print pkgutil.get_loader(pgadmin4_mod_name).filename;\"");
+    process.start(cmd);
+    //process.start("python -c \"from distutils.sysconfig import get_python_lib; print(get_python_lib())\"");
+    process.waitForFinished(-1);
+    QString webdir_path = process.readAllStandardOutput();
+    webdir_path = webdir_path.trimmed();
+    return webdir_path;
+}
+
+
 Server::Server(quint16 port)
 {
     // Appserver port
@@ -67,6 +85,17 @@ Server::Server(quint16 port)
     if (!python_path.contains(pymodules_path))
         python_path.append(pymodules_path);
 #endif
+#ifdef Q_OS_LINUX
+    QString pkg_path = GetpgadminWebDirPath();
+    QString get_pymodules_path = pkg_path + "/..";
+    QFileInfo fi(get_pymodules_path);
+    QString pymodules_path = fi.absoluteFilePath();
+
+    // Append the path, if it's not already there
+    if (!python_path.contains(pymodules_path))
+        python_path.append(pymodules_path);
+        settings.setValue("PythonPath", pymodules_path);
+#endif
 
     if (python_path.length() > 0)
     {
@@ -111,13 +140,23 @@ bool Server::Init()
 #ifdef Q_OS_MAC
     paths.append("../Resources/web/"); // Mac source tree (in a release app bundle)
 #endif
+#ifdef Q_OS_LINUX
+    QString  webapp_path = GetpgadminWebDirPath();
+    paths.append(webapp_path); // Linux (in a release RPM)
+#endif
     paths.append(settings.value("ApplicationPath").toString()); // System configured value
     paths.append(""); // Should be last!
 
     for (int i = 0; i < paths.size(); ++i)
     {
         QDir dir(QCoreApplication::applicationDirPath() + "/" + paths[i]);
-        m_appfile = dir.canonicalPath() + "/pgAdmin4.py";
+        QFileInfo info(paths[i]);
+        if (info.isRelative()) {
+             m_appfile = dir.absolutePath() + "/pgAdmin4.py";
+        }
+        else {
+             m_appfile = paths[i] + "/pgAdmin4.py";
+        }
 
         if (QFile::exists(m_appfile))
         {
diff --git a/runtime/pgAdmin4.h b/runtime/pgAdmin4.h
index 7730e23..71a7233 100644
--- a/runtime/pgAdmin4.h
+++ b/runtime/pgAdmin4.h
@@ -30,6 +30,9 @@
 // Application name
 const QString PGA_APP_NAME = QString("pgAdmin 4");
 
+// App Release
+const QString PGA_APP_RELEASE = QString("1");
+
 // Global function prototypes
 int main(int argc, char * argv[]);
 bool PingServer(QUrl url);
