# Discourse-setup using netcat with illegal option combination?

**URL:** https://meta.discourse.org/t/discourse-setup-using-netcat-with-illegal-option-combination/276762
**Category:** Self-hosting
**Created:** [August 26, 2023, 12:54pm UTC](https://meta.discourse.org/t/discourse-setup-using-netcat-with-illegal-option-combination/276762 "2023-08-26T12:54:10Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![steinhh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/steinhh/32/242776_2.png) [@steinhh](https://meta.discourse.org/u/steinhh)
#### Post date: [August 26, 2023, 12:54pm UTC](https://meta.discourse.org/t/discourse-setup-using-netcat-with-illegal-option-combination/276762/1 "2023-08-26T12:54:10Z")

</div>

Using the standard [discourse/docs/INSTALL-cloud.md at main · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/main/docs/INSTALL-cloud.md) installation procedure on Centos 7, but:

The network connectivity on ports 80 & 443 is tested with nc thus:

```plaintext
    echo -e "HTTP/1.1 200 OK\n\n $VERIFY" | nc -w 4 -l -p $PORT >/dev/null 2>&1 &
    if curl --proto =http -s $HOST:$PORT --connect-timeout 3 | grep $VERIFY >/dev/null 2>&1; then
:

```

But nc fails with

```plaintext
nc: cannot use -p and -l

```

making the setup script report unavailability on those ports.

man nc says:

```plaintext
     -l Listen for an incoming connection rather than initiating a connection to a remote host. Cannot be used together with any of the options -psxz. Additionally, any timeouts specified
             with the -w option are ignored.

```

It may be an nc version problem, I see [NC](https://www.commandlinux.com/man-page/man1/nc.1.html) does _not_ say that there’s any conflict with the two. My netcat can listen, but only using

```plaintext
nc -w 4 -l <IP address> <port number>

```

Can’t get netcat to tell me its version number 😕

---

<div class="post-metadata">

### Author: ![steinhh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/steinhh/32/242776_2.png) [@steinhh](https://meta.discourse.org/u/steinhh)
#### Post date: [August 26, 2023, 1:30pm UTC](https://meta.discourse.org/t/discourse-setup-using-netcat-with-illegal-option-combination/276762/2 "2023-08-26T13:30:07Z")

</div>

Ok, so… there’s netcat-traditional and netcat-openbsd, and centos comes with the first, whereas discourse-setup needs the latter. Trying to find a way to get netcat-openbsd on centos, not a straightforward thing it appears…

---

<div class="post-metadata">

### Author: ![steinhh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/steinhh/32/242776_2.png) [@steinhh](https://meta.discourse.org/u/steinhh)
#### Post date: [August 26, 2023, 1:44pm UTC](https://meta.discourse.org/t/discourse-setup-using-netcat-with-illegal-option-combination/276762/3 "2023-08-26T13:44:46Z")

</div>

Long story short:  
`yum remove netcat`  
`yum install nmap-ncat`

---

<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: [August 26, 2023, 6:00pm UTC](https://meta.discourse.org/t/discourse-setup-using-netcat-with-illegal-option-combination/276762/4 "2023-08-26T18:00:28Z")

</div>

That’s part of why Ubuntu is recommended.

But how annoying is it that there are two netcats? And your default netcat seems especially hard to use.

Good working figuring that one out!

---

<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: [September 25, 2023, 6:01pm UTC](https://meta.discourse.org/t/discourse-setup-using-netcat-with-illegal-option-combination/276762/5 "2023-09-25T18:01:03Z")

</div>

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