diff --git a/pom.xml b/pom.xml
index 5c60b80c8e4..c6b08b93bfe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -612,6 +612,186 @@
+
+ org.codehaus.mojo
+ rpm-maven-plugin
+ 2.1-alpha-2
+
+ 2013, Elasticsearch
+ Elasticsearch
+ Application/Internet
+ Elasticsearch
+ /usr
+ src/changelog
+
+ _unpackaged_files_terminate_build 0
+ _binaries_in_noarch_packages_terminate_build 0
+
+ 644
+ 755
+ root
+ root
+
+
+ /etc/elasticsearch/
+ true
+
+
+ /etc/elasticsearch/
+ true
+
+
+
+
+
+ /etc/sysconfig/
+ true
+
+
+
+
+
+ /etc/rc.d/init.d/
+ 755
+ true
+
+
+
+
+
+ /etc/systemd/system/
+ 755
+ true
+
+
+
+
+
+ /etc/tmpfiles.d/
+ true
+
+
+
+
+
+ /var/run/elasticsearch/
+ 755
+ elasticsearch
+ elasticsearch
+
+
+ /var/lib/elasticsearch/
+ 755
+ elasticsearch
+ elasticsearch
+
+
+ /var/log/elasticsearch/
+ 755
+ elasticsearch
+ elasticsearch
+
+
+ /usr/share/elasticsearch/bin/
+ 755
+
+
+
+
+
+ /usr/share/elasticsearch/lib
+
+
+
+
+
+
+ /usr/share/elasticsearch/lib/sigar
+
+
+
+
+
+ /usr/share/elasticsearch/
+
+
+
+
+
+
+ src/rpm/scripts/preinstall
+ utf-8
+
+
+ src/rpm/scripts/postinstall
+ utf-8
+
+
+ src/rpm/scripts/preremove
+ utf-8
+
+
+ src/rpm/scripts/postremove
+ utf-8
+
+
+
diff --git a/src/rpm/init.d/elasticsearch b/src/rpm/init.d/elasticsearch
new file mode 100644
index 00000000000..d798450d7f2
--- /dev/null
+++ b/src/rpm/init.d/elasticsearch
@@ -0,0 +1,136 @@
+#!/bin/sh
+#
+# elasticsearch
+#
+# chkconfig: 2345 80 20
+# description: Starts and stops a single elasticsearch instance on this system
+#
+
+### BEGIN INIT INFO
+# Provides: Elasticsearch
+# Required-Start: $network
+# Required-Stop: $network
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: This service manages the elasticsearch daemon
+# Description: Elasticsearch is a very scalable, schema-free and high-performance search solution supporting multi-tenancy and near realtime search.
+### END INIT INFO
+
+#
+# init.d / servicectl compatibility (openSUSE)
+#
+if [ -f /etc/rc.status ]; then
+ . /etc/rc.status
+ rc_reset
+fi
+
+#
+# Source function library.
+#
+if [ -f /etc/rc.d/init.d/functions ]; then
+ . /etc/rc.d/init.d/functions
+fi
+
+exec="/usr/share/elasticsearch/bin/elasticsearch"
+prog="elasticsearch"
+pidfile=/var/run/elasticsearch/${prog}.pid
+
+[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
+
+export ES_HEAP_SIZE
+export ES_HEAP_NEWSIZE
+export ES_DIRECT_SIZE
+export ES_JAVA_OPTS
+
+lockfile=/var/lock/subsys/$prog
+
+start() {
+ [ -x $exec ] || exit 5
+ [ -f $CONF_FILE ] || exit 6
+ if [ -n "$MAX_LOCKED_MEMORY" -a -z "$ES_HEAP_SIZE" ]; then
+ echo "MAX_LOCKED_MEMORY is set - ES_HEAP_SIZE must also be set"
+ return 7
+ fi
+ if [ -n "$MAX_OPEN_FILES" ]; then
+ ulimit -n $MAX_OPEN_FILES
+ fi
+ if [ -n "$MAX_LOCKED_MEMORY" ]; then
+ ulimit -l $MAX_LOCKED_MEMORY
+ fi
+ if [ -n "$WORK_DIR" ]; then
+ mkdir -p "$WORK_DIR"
+ chown "$ES_USER":"$ES_GROUP" "$WORK_DIR"
+ fi
+ echo -n $"Starting $prog: "
+ # if not running, start it up here, usually something like "daemon $exec"
+ daemon --user $USER --pidfile $pidfile $exec -p $pidfile -Des.default.path.home=$ES_HOME -Des.default.path.logs=$LOG_DIR -Des.default.path.data=$DATA_DIR -Des.default.path.work=$WORK_DIR -Des.default.path.conf=$CONF_DIR
+ retval=$?
+ echo
+ [ $retval -eq 0 ] && touch $lockfile
+ return $retval
+}
+
+stop() {
+ echo -n $"Stopping $prog: "
+ # stop it here, often "killproc $prog"
+ killproc -p $pidfile $prog
+ retval=$?
+ echo
+ [ $retval -eq 0 ] && rm -f $lockfile
+ return $retval
+}
+
+restart() {
+ stop
+ start
+}
+
+reload() {
+ restart
+}
+
+force_reload() {
+ restart
+}
+
+rh_status() {
+ # run checks to determine if the service is running or use generic status
+ status -p $pidfile $prog
+}
+
+rh_status_q() {
+ rh_status >/dev/null 2>&1
+}
+
+
+case "$1" in
+ start)
+ rh_status_q && exit 0
+ $1
+ ;;
+ stop)
+ rh_status_q || exit 0
+ $1
+ ;;
+ restart)
+ $1
+ ;;
+ reload)
+ rh_status_q || exit 7
+ $1
+ ;;
+ force-reload)
+ force_reload
+ ;;
+ status)
+ rh_status
+ ;;
+ condrestart|try-restart)
+ rh_status_q || exit 0
+ restart
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
+ exit 2
+esac
+exit $?
diff --git a/src/rpm/scripts/postinstall b/src/rpm/scripts/postinstall
new file mode 100644
index 00000000000..5069201d7f2
--- /dev/null
+++ b/src/rpm/scripts/postinstall
@@ -0,0 +1,17 @@
+hasBeenEnabledOnStart=false
+
+if [ $1 -eq 1 ] ; then
+ # Initial installation
+ if [ -x /bin/systemctl ] ; then
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+ /bin/systemctl enable elasticsearch.service
+ /bin/systemctl start elasticsearch.service
+ hasBeenEnabledOnStart=true
+ fi
+
+ if [ -x /sbin/chkconfig -a "$hasBeenEnabledOnStart" == "false" ] ; then
+ /sbin/chkconfig --add elasticsearch
+ /etc/init.d/elasticsearch start
+ fi
+
+fi
diff --git a/src/rpm/scripts/postremove b/src/rpm/scripts/postremove
new file mode 100644
index 00000000000..251b779887d
--- /dev/null
+++ b/src/rpm/scripts/postremove
@@ -0,0 +1,13 @@
+echo "Removing elasticsearch user and group if existing"
+
+getent passwd elasticsearch > /dev/null
+if [ "$?" == "1" ] ; then
+ userdel elasticsearch
+fi
+
+getent group elasticsearch >/dev/null
+if [ "$?" == "1" ] ; then
+ groupdel elasticsearch
+fi
+
+exit
diff --git a/src/rpm/scripts/preinstall b/src/rpm/scripts/preinstall
new file mode 100644
index 00000000000..70670ed8036
--- /dev/null
+++ b/src/rpm/scripts/preinstall
@@ -0,0 +1,4 @@
+getent group elasticsearch >/dev/null || groupadd -r elasticsearch
+getent passwd elasticsearch >/dev/null || \
+ useradd -r -g elasticsearch -d /usr/lib/elasticsearch -s /sbin/nologin \
+ -c "elasticsearch user" elasticsearch
diff --git a/src/rpm/scripts/preremove b/src/rpm/scripts/preremove
new file mode 100644
index 00000000000..7e012d69b7c
--- /dev/null
+++ b/src/rpm/scripts/preremove
@@ -0,0 +1,16 @@
+if [ $1 -eq 0 ] ; then
+ # Package removal, not upgrade
+ if [ -x /bin/systemctl ] ; then
+ /bin/systemctl --no-reload disable elasticsearch.service > /dev/null 2>&1 || :
+ /bin/systemctl stop elasticsearch.service > /dev/null 2>&1 || :
+ fi
+
+ if [ -x /sbin/chkconfig ] ; then
+ if [ -x /etc/init.d/elasticsearch ] ; then
+ /etc/init.d/elasticsearch stop
+ fi
+ /sbin/chkconfig --del elasticsearch 2> /dev/null
+ fi
+fi
+
+exit 0
diff --git a/src/rpm/sysconfig/elasticsearch b/src/rpm/sysconfig/elasticsearch
new file mode 100644
index 00000000000..64867f1a245
--- /dev/null
+++ b/src/rpm/sysconfig/elasticsearch
@@ -0,0 +1,40 @@
+# Directory where the ElasticSearch binary distribution resides
+ES_HOME=/usr/share/elasticsearch
+
+# Heap Size (defaults to 256m min, 1g max)
+#ES_HEAP_SIZE=2g
+
+# Heap new generation
+#ES_HEAP_NEWSIZE=
+
+# max direct memory
+#ES_DIRECT_SIZE=
+
+# Additional Java OPTS
+#ES_JAVA_OPTS=
+
+# Maximum number of open files
+MAX_OPEN_FILES=65535
+
+# Maximum amount of locked memory
+#MAX_LOCKED_MEMORY=
+
+# ElasticSearch log directory
+LOG_DIR=/var/log/elasticsearch
+
+# ElasticSearch data directory
+DATA_DIR=/var/lib/elasticsearch
+
+# ElasticSearch work directory
+WORK_DIR=/tmp/elasticsearch
+
+# ElasticSearch conf directory
+CONF_DIR=/etc/elasticsearch
+
+# ElasticSearch configuration file (elasticsearch.yml)
+CONF_FILE=/etc/elasticsearch/elasticsearch.yml
+
+# User to run as, change this to a specific elasticsearch user if possible
+# Also make sure, this user can write into the log directories in case you change them
+# This setting only works for the init script, but has to be configured separately for systemd startup
+USER=elasticsearch
diff --git a/src/rpm/systemd/elasticsearch.conf b/src/rpm/systemd/elasticsearch.conf
new file mode 100644
index 00000000000..9db225e74a7
--- /dev/null
+++ b/src/rpm/systemd/elasticsearch.conf
@@ -0,0 +1 @@
+d /run/elasticsearch 0755 elasticsearch elasticsearch - -
diff --git a/src/rpm/systemd/elasticsearch.service b/src/rpm/systemd/elasticsearch.service
new file mode 100644
index 00000000000..c68c5054391
--- /dev/null
+++ b/src/rpm/systemd/elasticsearch.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Starts and stops a single elasticsearch instance on this system
+Documentation=http://www.elasticsearch.org
+
+[Service]
+Type=forking
+EnvironmentFile=/etc/sysconfig/elasticsearch
+User=elasticsearch
+Group=elasticsearch
+PIDFile=/var/run/elasticsearch/elasticsearch.pid
+ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p /var/run/elasticsearch/elasticsearch.pid -Des.default.config=$CONF_FILE -Des.default.path.home=$ES_HOME -Des.default.path.logs=$LOG_DIR -Des.default.path.data=$DATA_DIR -Des.default.path.work=$WORK_DIR -Des.default.path.conf=$CONF_DIR
+
+[Install]
+WantedBy=multi-user.target