# Install Opensearch as a service without using docker or Kubernetes like Elasticsearch?

**URL:** <https://forum.opensearch.org/t/install-opensearch-as-a-service-without-using-docker-or-kubernetes-like-elasticsearch/8321>\
**Category:** OpenSearch\
**Tags:** configure, install\
**Created:** [January 17, 2022, 5:46pm UTC](https://forum.opensearch.org/t/install-opensearch-as-a-service-without-using-docker-or-kubernetes-like-elasticsearch/8321 "2022-01-17T17:46:27Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![avnishs](https://avatars.discourse-cdn.com/v4/letter/a/9d8465/32.png) [@avnishs](https://forum.opensearch.org/u/avnishs)\
**Post date:** [January 17, 2022, 5:46pm UTC](https://forum.opensearch.org/t/install-opensearch-as-a-service-without-using-docker-or-kubernetes-like-elasticsearch/8321/1 "2022-01-17T17:46:27Z")

</div>

How do I install OpenSearch and OpenSearch dashboard as service/RPM on Linux without using docker or K8s like Elasticsearch can be done?  
Thanks in advance.

---

<div class="post-metadata">

**Author:** ![BlackMetalz](https://avatars.discourse-cdn.com/v4/letter/b/d6d6ee/32.png) [@BlackMetalz](https://forum.opensearch.org/u/BlackMetalz)\
**Post date:** [January 18, 2022, 9:07am UTC](https://forum.opensearch.org/t/install-opensearch-as-a-service-without-using-docker-or-kubernetes-like-elasticsearch/8321/2 "2022-01-18T09:07:25Z")

</div>

Here you go.

Path for service:

```auto
/etc/systemd/system/opensearch.service

```

Content of it:

```auto
[Unit]
Description=Opensearch
Documentation=https://opensearch.org/docs/latest
Requires=network.target remote-fs.target
After=network.target remote-fs.target
ConditionPathExists=/data/opensearch-1.2.3
ConditionPathExists=/data/opensearch/data
[Service]
User=opensearch
Group=opensearch
WorkingDirectory=/data/opensearch-1.2.3
ExecStart=/data/opensearch-1.2.3/bin/opensearch

# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65535

# Specifies the maximum number of processes
LimitNPROC=4096

# Specifies the maximum size of virtual memory
LimitAS=infinity

# Specifies the maximum file size
LimitFSIZE=infinity

# Disable timeout logic and wait until process is stopped
TimeoutStopSec=0

# SIGTERM signal is used to stop the Java process
KillSignal=SIGTERM

# Send the signal only to the JVM rather than its control group
KillMode=process

# Java process is never killed
SendSIGKILL=no

# When a JVM receives a SIGTERM signal it exits with code 143
SuccessExitStatus=143

# Allow a slow startup before the systemd notifier module kicks in to extend the timeout
TimeoutStartSec=75

[Install]
WantedBy=multi-user.target

```

Status of Service:

```auto
root@sys-test-48-54:/data/opensearch-1.2.3# service opensearch status
* opensearch.service - Opensearch
   Loaded: loaded (/etc/systemd/system/opensearch.service; disabled; vendor preset: enabled)
   Active: active (running) since Tue 2022-01-18 16:01:40 +07; 2min 14s ago
     Docs: https://opensearch.org/docs/latest
 Main PID: 22630 (java)
    Tasks: 144 (limit: 4915)
   CGroup: /system.slice/opensearch.service
           `-22630 /data/opensearch-1.2.3/jdk/bin/java -Xshare:auto -Dopensearch.networkaddress.cache.ttl=60 -Dopensearch.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna

Jan 18 16:03:22 sys-test-48-54 opensearch[22630]: [2022-01-18T16:03:22,226][WARN][o.o.c.r.a.AllocationService] [opensearch-48-54] [si-context-1232][0] marking unavailable shards as stale: [M_pvF53NR_ORlcMwzqNCYQ]
Jan 18 16:03:22 sys-test-48-54 opensearch[22630]: [2022-01-18T16:03:22,227][WARN][o.o.c.r.a.AllocationService] [opensearch-48-54] [si-youtube-2021-09][1] marking unavailable shards as stale: [dIqWTxi4T0yD7JICavIJHQ]
Jan 18 16:03:22 sys-test-48-54 opensearch[22630]: [2022-01-18T16:03:22,227][WARN][o.o.c.r.a.AllocationService] [opensearch-48-54] [si-youtube-comment-2021-08][1] marking unavailable shards as stale: [v7utcGIUQ0yRo0qcfnEwMg]
Jan 18 16:03:22 sys-test-48-54 opensearch[22630]: [2022-01-18T16:03:22,227][WARN][o.o.c.r.a.AllocationService] [opensearch-48-54] [security-auditlog-2022.01.09][0] marking unavailable shards as stale: [YrJGLw0XR0OWnK84KzkQFQ]
Jan 18 16:03:22 sys-test-48-54 opensearch[22630]: [2022-01-18T16:03:22,228][WARN][o.o.c.r.a.AllocationService] [opensearch-48-54] [security-auditlog-2021.12.27][0] marking unavailable shards as stale: [kdwq-PXDSDCfgLy-1DaaHA]
Jan 18 16:03:27 sys-test-48-54 opensearch[22630]: [2022-01-18T16:03:27,640][INFO][o.o.i.i.ManagedIndexCoordinator] [opensearch-48-54] Performing move cluster state metadata.
Jan 18 16:03:39 sys-test-48-54 opensearch[22630]: [2022-01-18T16:03:39,080][WARN][o.o.c.r.a.AllocationService] [opensearch-48-54] [si-news-2021-12][1] marking unavailable shards as stale: [9Frpc2hwQIW3MT_n3sBOMw]
Jan 18 16:03:39 sys-test-48-54 opensearch[22630]: [2022-01-18T16:03:39,081][WARN][o.o.c.r.a.AllocationService] [opensearch-48-54] [si-news-2021-11][1] marking unavailable shards as stale: [cWauA_G1Tc219s_-ZfkZVg]
Jan 18 16:03:39 sys-test-48-54 opensearch[22630]: [2022-01-18T16:03:39,082][WARN][o.o.c.r.a.AllocationService] [opensearch-48-54] [si-news-2021-09][1] marking unavailable shards as stale: [V7Sc8MjmRAeMBntOst8SGg]
Jan 18 16:03:50 sys-test-48-54 opensearch[22630]: [2022-01-18T16:03:50,689][INFO][o.o.c.r.a.a.BalancedShardsAllocator] [opensearch-48-54] Cannot move any shard in the cluster as there is no node on which shards can be allocated. Skipping

```

It is running with port 9200 + 9300

```auto
root@sys-test-48-54:/data/opensearch-1.2.3# netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name    
tcp6 0 0 :::9200 :::* LISTEN 22630/java          
tcp6 0 0 :::9300 :::* LISTEN 22630/java          

```

Note: You have to create user opensearch with it’s group.

```auto
/data/opensearch-1.2.3

```

is the location where I untar binary file for OpenSearch.

I only spend about 10 minutes to make it works so I bet it is not really optimized 😹  
Most of it I copy open distro from

```auto
# Specifies the maximum file descr....

```

until the end.

Also, don’t forget to run this command after creating service file

```auto
systemctl daemon-reload

```

---

<div class="post-metadata">

**Author:** ![avnishs](https://avatars.discourse-cdn.com/v4/letter/a/9d8465/32.png) [@avnishs](https://forum.opensearch.org/u/avnishs)\
**Post date:** [January 18, 2022, 9:19am UTC](https://forum.opensearch.org/t/install-opensearch-as-a-service-without-using-docker-or-kubernetes-like-elasticsearch/8321/3 "2022-01-18T09:19:28Z")

</div>

@BlackMetalz That’s really helpful man!!! So I can use OpenSearch Dashboard using a similar service file named opensearch-dashboard.service?

---

<div class="post-metadata">

**Author:** ![BlackMetalz](https://avatars.discourse-cdn.com/v4/letter/b/d6d6ee/32.png) [@BlackMetalz](https://forum.opensearch.org/u/BlackMetalz)\
**Post date:** [January 18, 2022, 9:22am UTC](https://forum.opensearch.org/t/install-opensearch-as-a-service-without-using-docker-or-kubernetes-like-elasticsearch/8321/4 "2022-01-18T09:22:51Z")

</div>

Yeah. I’m pretty sure they are the same xD. You can check the kibana service of opendistro for example

---

<div class="post-metadata">

**Author:** ![avnishs](https://avatars.discourse-cdn.com/v4/letter/a/9d8465/32.png) [@avnishs](https://forum.opensearch.org/u/avnishs)\
**Post date:** [January 18, 2022, 9:23am UTC](https://forum.opensearch.org/t/install-opensearch-as-a-service-without-using-docker-or-kubernetes-like-elasticsearch/8321/5 "2022-01-18T09:23:47Z")

</div>

Great man!!! Thanks a lot

---

<div class="post-metadata">

**Author:** ![qmonitoring](https://avatars.discourse-cdn.com/v4/letter/q/7c8e57/32.png) [@qmonitoring](https://forum.opensearch.org/u/qmonitoring)\
**Post date:** [January 27, 2022, 3:31pm UTC](https://forum.opensearch.org/t/install-opensearch-as-a-service-without-using-docker-or-kubernetes-like-elasticsearch/8321/6 "2022-01-27T15:31:17Z")

</div>

@avnishs could you please provide feedback regarding possibility to start OpenSearch as a service?  
The config proposed by BlackMetalz did not work for me.  
Installation path from the [documentation](https://opensearch.org/docs/latest/opensearch/install/tar/)  
CentOS Linux release 8.5.2111

Also I tried different variations (for example this one from the [official repository](https://github.com/opensearch-project/OpenSearch/blob/34550c5b17124ddc59458ef774f6b43a086522e3/distribution/packages/src/common/systemd/opensearch.service))

---

<div class="post-metadata">

**Author:** ![BlackMetalz](https://avatars.discourse-cdn.com/v4/letter/b/d6d6ee/32.png) [@BlackMetalz](https://forum.opensearch.org/u/BlackMetalz)\
**Post date:** [January 27, 2022, 5:04pm UTC](https://forum.opensearch.org/t/install-opensearch-as-a-service-without-using-docker-or-kubernetes-like-elasticsearch/8321/7 "2022-01-27T17:04:28Z")

</div>

Lol. I used Ubuntu, not Centos so I guess it will be little different 😅

---

<div class="post-metadata">

**Author:** ![avnishs](https://avatars.discourse-cdn.com/v4/letter/a/9d8465/32.png) [@avnishs](https://forum.opensearch.org/u/avnishs)\
**Post date:** [January 28, 2022, 4:52am UTC](https://forum.opensearch.org/t/install-opensearch-as-a-service-without-using-docker-or-kubernetes-like-elasticsearch/8321/8 "2022-01-28T04:52:37Z")

</div>

Didn’t work for me too! but then I simply executed the bin files in the background using 🙂 `bin_exec_command > /dev/null 2>&1 &`  
or if you want to log the startup output in a file then:  
`bin_exec_command > filename.log 2>&1 &`

---

<div class="post-metadata">

**Author:** ![qmonitoring](https://avatars.discourse-cdn.com/v4/letter/q/7c8e57/32.png) [@qmonitoring](https://forum.opensearch.org/u/qmonitoring)\
**Post date:** [January 31, 2022, 5:19am UTC](https://forum.opensearch.org/t/install-opensearch-as-a-service-without-using-docker-or-kubernetes-like-elasticsearch/8321/9 "2022-01-31T05:19:20Z")

</div>

avnishs, thank you for your reply. If I can’t find the way to start OpenSearch as service, I will use the approach you suggested.

---

<div class="post-metadata">

**Author:** ![qmonitoring](https://avatars.discourse-cdn.com/v4/letter/q/7c8e57/32.png) [@qmonitoring](https://forum.opensearch.org/u/qmonitoring)\
**Post date:** [January 31, 2022, 5:21am UTC](https://forum.opensearch.org/t/install-opensearch-as-a-service-without-using-docker-or-kubernetes-like-elasticsearch/8321/10 "2022-01-31T05:21:09Z")

</div>

BlackMetalz, thank you for your reply. Are you sure that it is really principal in this case?)

> **[systemd](https://en.wikipedia.org/wiki/Systemd)**
>
> systemd is a software suite that provides an array of system components for Linux operating systems. Its main aim is to unify service configuration and behavior across Linux distributions; Its primary component is a "system and service manager"—an init system used to bootstrap user space and manage user processes. It also provides replacements for various daemons and utilities, including device management, login management, network connection management, and event logging. The name systemd Sin...

---

<div class="post-metadata">

**Author:** ![BlackMetalz](https://avatars.discourse-cdn.com/v4/letter/b/d6d6ee/32.png) [@BlackMetalz](https://forum.opensearch.org/u/BlackMetalz)\
**Post date:** [February 5, 2022, 4:31pm UTC](https://forum.opensearch.org/t/install-opensearch-as-a-service-without-using-docker-or-kubernetes-like-elasticsearch/8321/11 "2022-02-05T16:31:35Z")

</div>

Yes. 😃  
( I don’t know why this post must have 20 characters requirement )

---

<div class="post-metadata">

**Author:** ![qmonitoring](https://avatars.discourse-cdn.com/v4/letter/q/7c8e57/32.png) [@qmonitoring](https://forum.opensearch.org/u/qmonitoring)\
**Post date:** [May 11, 2022, 6:00pm UTC](https://forum.opensearch.org/t/install-opensearch-as-a-service-without-using-docker-or-kubernetes-like-elasticsearch/8321/12 "2022-05-11T18:00:41Z")

</div>

I managed to start the OpenSearch as a service on CentOS 8 using the following workaround:

```auto
ExecStart=/bin/sh -c '/etc/opensearch/bin/opensearch'

```
