# Discourse setup assumes netcat is installed

**URL:** https://meta.discourse.org/t/discourse-setup-assumes-netcat-is-installed/128893
**Category:** Self-hosting
**Created:** [September 18, 2019, 12:06pm UTC](https://meta.discourse.org/t/discourse-setup-assumes-netcat-is-installed/128893 "2019-09-18T12:06:50Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![andorenan](https://avatars.discourse-cdn.com/v4/letter/a/db5fbb/32.png) [@andorenan](https://meta.discourse.org/u/andorenan)
#### Post date: [September 18, 2019, 12:06pm UTC](https://meta.discourse.org/t/discourse-setup-assumes-netcat-is-installed/128893/1 "2019-09-18T12:06:51Z")

</div>

I’ve just managed to setup my first discourse instance with success, though I had some struggles along the way. I run Debian Stretch and was following the [Docker install guide](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md).

During the setup the script [checks](https://github.com/discourse/discourse_docker/blob/master/discourse-setup#L36) to see if the domain name you filled in actually ends up on that machine. It does so by using `nc` (netcat). I found out that this was my issue, I didn’t have netcat installed, a simple install fixed this.

I do however think this is a bug in the installer script, a simple function to check if `nc` is installed should remedy this, or maybe you can even give the user the freedom to skip the check altogether which would fix the issue as well.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [September 18, 2019, 4:03pm UTC](https://meta.discourse.org/t/discourse-setup-assumes-netcat-is-installed/128893/2 "2019-09-18T16:03:14Z")

</div>

> [@andorenan](#):
>
> I do however think this is a bug in the installer script, a simple function to check if `nc` is installed should remedy this, or maybe you can even give the user the freedom to skip the check altogether which would fix the issue as well.

This has come up before, though `netcat discourse-setup` fails to find it.

The check merely issues a warning, which you are free to ignore, so I don’t consider this a bug.

> <https://github.com/discourse/discourse_docker/blob/master/discourse-setup#L60-L61>

I’ve considered having `discourse-setup` installing `nc`, but having `discourse-setup` install something that might never be needed seems like something to avoid.

Perhaps the thing to do if `nc` is missing is to skip the test and suggest that if the test is desired to install `nc` yourself, perhaps even offering `apt install nc`.

---

<div class="post-metadata">

### Author: ![andorenan](https://avatars.discourse-cdn.com/v4/letter/a/db5fbb/32.png) [@andorenan](https://meta.discourse.org/u/andorenan)
#### Post date: [September 19, 2019, 8:03am UTC](https://meta.discourse.org/t/discourse-setup-assumes-netcat-is-installed/128893/3 "2019-09-19T08:03:21Z")

</div>

I have to respectfully disagree, this really smells like bug material right here. Yes you’re printing a warning message which can be ignored but for someone installing discourse for the first time you want to make it as easy as possible to do, which means not having to dig into the source and finding out that you need to install `netcat` to make this work without errors. Any error will confuse the user/sysadmin which will make them spend time figuring out why it doesn’t work and `git blame`-ing the person who wrote it. 😛

This can be easily sidestepped with a simple check before you run the IP check, like so:

1. Check if `netcat` is installed
2. Continue if it is
3. If it’s not print a warning message and give the user a yes/no option to continue without the check or to abort so they can install `netcat` (or even offer to `apt`/`yum`/`pacman` install it for them).

Another option that would work on more systems (though not all) then currently would be to use the `/dev/tcp` stack. More info on how to do this can be found [here](https://laconicwolf.com/2017/08/13/netcat-alternative-devtcp/). This would fix it for Debian, and works under Ubuntu, I haven’t tried it on other distros.

---

<div class="post-metadata">

### Author: ![andorenan](https://avatars.discourse-cdn.com/v4/letter/a/db5fbb/32.png) [@andorenan](https://meta.discourse.org/u/andorenan)
#### Post date: [September 19, 2019, 9:53am UTC](https://meta.discourse.org/t/discourse-setup-assumes-netcat-is-installed/128893/4 "2019-09-19T09:53:43Z")

</div>

@pfaffman I made a first stab at this and created a [pull request](https://github.com/discourse/discourse_docker/pull/448) for this. 🎉

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [October 24, 2019, 9:52am UTC](https://meta.discourse.org/t/discourse-setup-assumes-netcat-is-installed/128893/5 "2019-10-24T09:52:58Z")

</div>

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