# Certificates and Keys Question while Installing

**URL:** <https://hub.mender.io/t/certificates-and-keys-question-while-installing/722>\
**Category:** General Discussions\
**Created:** [June 17, 2019, 2:28pm UTC](https://hub.mender.io/t/certificates-and-keys-question-while-installing/722 "2019-06-17T14:28:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ozan.aydin](https://avatars.discourse-cdn.com/v4/letter/o/a88e57/32.png) [@ozan.aydin](https://hub.mender.io/u/ozan.aydin)\
**Post date:** [June 17, 2019, 2:28pm UTC](https://hub.mender.io/t/certificates-and-keys-question-while-installing/722/1 "2019-06-17T14:28:21Z")

</div>

As an absolute beginner, I am following the documentation while installing the open source mender server. One of the instructions include:  
“CERT\_API\_CN=[mender.example.com](http://mender.example.com) CERT\_STORAGE\_CN=[s3.example.com](http://s3.example.com) …/keygen”.  
Once I run this command with the proper DNS, I get the error:  
mkdir: cannot create directory ‘api-gateway’: File exists  
mkdir: cannot create directory ‘storage-proxy’: File exists  
There are Nginx files inside these directories, so I’m confused here, what should I do?

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [June 17, 2019, 2:51pm UTC](https://hub.mender.io/t/certificates-and-keys-question-while-installing/722/2 "2019-06-17T14:51:34Z")

</div>

Are you in the `production` directory when you try running this scripts? Because you should not have any nginx files inside these directories as they are at the top.

Did a test run and I see no problems,

```auto
integration/production ((HEAD detached at 2.0.0))
$ CERT_API_CN=mender.example.com CERT_STORAGE_CN=s3.example.com ../keygen
Generating an EC private key
writing new private key to 'private.key'
-----
Generating an EC private key
writing new private key to 'private.key'
-----
.........................................................++++
..............................++++
writing RSA key
......................................................................................++++
...................................................................++++
writing RSA key
All Mender Server keys and certificates have been generated in directory /home/mirzak/project/northern.tech/src/integration/production/keys-generated.
Please include them in your docker compose and device builds.
For more information please see https://docs.mender.io/Administration/Certificates-and-keys.

```

---

<div class="post-metadata">

**Author:** ![ozan.aydin](https://avatars.discourse-cdn.com/v4/letter/o/a88e57/32.png) [@ozan.aydin](https://hub.mender.io/u/ozan.aydin)\
**Post date:** [June 18, 2019, 8:04am UTC](https://hub.mender.io/t/certificates-and-keys-question-while-installing/722/3 "2019-06-18T08:04:24Z")

</div>

Thank you so much for the response. Turns out I was not on production directory like you said. If you don’ mind me asking, this setup also requires me to have a DNS for the Mender API Gateway. I’m kind of confused about this, what exactly should I provide for that part? Sorry if this is a sidetrack but any response will be appreciated!

---

<div class="post-metadata">

**Author:** ![drewmoseley](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/drewmoseley/32/47_2.png) [@drewmoseley](https://hub.mender.io/u/drewmoseley)\
**Post date:** [June 18, 2019, 2:26pm UTC](https://hub.mender.io/t/certificates-and-keys-question-while-installing/722/4 "2019-06-18T14:26:55Z")

</div>

The Mender API gateway is the primary access point for all Mender clients. In the setup above this is the _[mender.example.com](http://mender.example.com)_ entry. The certificate validation requires a domain name and not an IP address, thus the DNS requirement.
