# Starting and stopping elasticsearch without root privileges in linux centOS

**URL:** <https://discuss.elastic.co/t/starting-and-stopping-elasticsearch-without-root-privileges-in-linux-centos/130442>\
**Category:** Elasticsearch\
**Created:** [May 3, 2018, 11:29am UTC](https://discuss.elastic.co/t/starting-and-stopping-elasticsearch-without-root-privileges-in-linux-centos/130442 "2018-05-03T11:29:28Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![yishain11](https://avatars.discourse-cdn.com/v4/letter/y/df705f/32.png) [@yishain11](https://discuss.elastic.co/u/yishain11)\
**Post date:** [May 3, 2018, 11:29am UTC](https://discuss.elastic.co/t/starting-and-stopping-elasticsearch-without-root-privileges-in-linux-centos/130442/1 "2018-05-03T11:29:29Z")

</div>

Hi.  
I want to install the ELK stack in a production machine that has CentOS on it. It dosen't have internet connection and I don't have root privileges .  
I can easly provid an install the ELK stack from manually deliver rpms.  
Starting and quitting is a different story. The manual for elasticsearch (and any other part of ELK) says that systemctl needs to be used, but centos dosen't allow for systemctl use it you are not the root user.  
Is there an elegant way to start and stop the ELK start programs when you are not the root user?

---

<div class="post-metadata">

**Author:** ![atira](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/atira/32/28699_2.png) [@atira](https://discuss.elastic.co/u/atira)\
**Post date:** [May 4, 2018, 10:59pm UTC](https://discuss.elastic.co/t/starting-and-stopping-elasticsearch-without-root-privileges-in-linux-centos/130442/2 "2018-05-04T22:59:29Z")

</div>

Download the tarball and run Elasticseach with the binary.

`{ES_install_root}/bin/elasticsearch -d`

If you want to save the PID to a file:

`{ES_install_root}/bin/elasticsearch -d -p {file_path}`

Not really a nice way to do it on a production environment, but it works.

If you can ask the sysadmin, ask him to give you sudo right to control the elasticsearch service.

---

<div class="post-metadata">

**Author:** ![yishain11](https://avatars.discourse-cdn.com/v4/letter/y/df705f/32.png) [@yishain11](https://discuss.elastic.co/u/yishain11)\
**Post date:** [May 6, 2018, 7:44am UTC](https://discuss.elastic.co/t/starting-and-stopping-elasticsearch-without-root-privileges-in-linux-centos/130442/3 "2018-05-06T07:44:54Z")

</div>

thanks, but starting the process is the easy part. Can you think of a way to stop elegantly without using systemctl?

---

<div class="post-metadata">

**Author:** ![atira](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/atira/32/28699_2.png) [@atira](https://discuss.elastic.co/u/atira)\
**Post date:** [May 6, 2018, 9:09am UTC](https://discuss.elastic.co/t/starting-and-stopping-elasticsearch-without-root-privileges-in-linux-centos/130442/4 "2018-05-06T09:09:20Z")

</div>

You start ES with systemctl but can't stop with it? If so, ask your sysadmin to give sudo right for the stop command too.  
If not, how do you start ES?

---

<div class="post-metadata">

**Author:** ![yishain11](https://avatars.discourse-cdn.com/v4/letter/y/df705f/32.png) [@yishain11](https://discuss.elastic.co/u/yishain11)\
**Post date:** [May 6, 2018, 10:29am UTC](https://discuss.elastic.co/t/starting-and-stopping-elasticsearch-without-root-privileges-in-linux-centos/130442/5 "2018-05-06T10:29:17Z")

</div>

I start by simply running ./elasticsearch (or kibana, or logstash) from bash script, without using systemctl.

---

<div class="post-metadata">

**Author:** ![atira](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/atira/32/28699_2.png) [@atira](https://discuss.elastic.co/u/atira)\
**Post date:** [May 6, 2018, 10:48am UTC](https://discuss.elastic.co/t/starting-and-stopping-elasticsearch-without-root-privileges-in-linux-centos/130442/6 "2018-05-06T10:48:31Z")

</div>

You can then just use kill to stop the process. You can also use a bash script if it's more convenient.  
Make ES create a pid file when starting.

> [@atira](#):
>
> {ES\_install\_root}/bin/elasticsearch -d -p {file\_path}

Then just kill the process.

```auto
kill $(cat {file_path})

```

---

<div class="post-metadata">

**Author:** ![yishain11](https://avatars.discourse-cdn.com/v4/letter/y/df705f/32.png) [@yishain11](https://discuss.elastic.co/u/yishain11)\
**Post date:** [May 6, 2018, 11:16am UTC](https://discuss.elastic.co/t/starting-and-stopping-elasticsearch-without-root-privileges-in-linux-centos/130442/7 "2018-05-06T11:16:46Z")

</div>

I thought about it, but doesn't this method make an abropt exit from elastic, and will cause errors?  
How exiting with 'kill' effects elastic processes?  
Is it equivalent to what happens when I use systemctl stop elastic/kibana/logstash?

---

<div class="post-metadata">

**Author:** ![atira](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/atira/32/28699_2.png) [@atira](https://discuss.elastic.co/u/atira)\
**Post date:** [May 6, 2018, 11:25am UTC](https://discuss.elastic.co/t/starting-and-stopping-elasticsearch-without-root-privileges-in-linux-centos/130442/8 "2018-05-06T11:25:03Z")

</div>

The word `kill` does sound dramatic, but without options it just tells the process to quit normally. It won't do any harm.

`kill -KILL` would terminate the process instantly, leaving no chance for it to do a safe shutdown. Avoid it unless the process isn't reacting to anything, which is typical eg. after an out of memory exception.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 3, 2018, 11:25am UTC](https://discuss.elastic.co/t/starting-and-stopping-elasticsearch-without-root-privileges-in-linux-centos/130442/9 "2018-06-03T11:25:04Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
