<p>Unless you want to test multiple versions of the <code>lightningd</code> binary, there is no need to check the source code out multiple times, since the binaries can be shared among multiple instances.</p>

<p>Assuming you are in the root directory of the source code, and you've executed <code>./configure</code> and <code>make</code>, you can start multiple instances like this:</p>



<pre><code>$ lightningd/lightningd --log-level=debug \
                        --lightning-dir=/path/to/lightning-dir1 \
                        --addr=0.0.0.0:1111 &amp;
</code></pre>



<pre><code>$ lightningd/lightningd --log-level=debug \
                        --lightning-dir=/path/to/lightning-dir2 \
                        --addr=0.0.0.0:2222 &amp;
</code></pre>



<pre><code>$ lightningd/lightningd --log-level=debug \
                        --lightning-dir=/path/to/lightning-dir3
                        --addr=0.0.0.0:3333 &amp;
</code></pre>

<p>Each of these commands will start a new node with its own directory and with its own port.</p>

<p>Notice that you'll also need to tell <code>lightning-cli</code> where to find the various instances you're trying to talk to. For example the following will run the <code>help</code> command on the second instance:</p>



<pre><code>$ lightning-cli --lightning-dir=/path/to/lightning-dir2 help
</code></pre>

<p>I usually will set up a couple of aliases for each instance that I run:</p>



<pre><code>alias lcli1="lightning-cli --lightning-dir=/path/to/lightning-dir1"
alias lcli2="lightning-cli --lightning-dir=/path/to/lightning-dir2"
alias lcli3="lightning-cli --lightning-dir=/path/to/lightning-dir3"
</code></pre>

<p>Then you can just use <code>lcli1 help</code> to talk to the first instance.</p>

<p>If you'd like to run multiple versions, the procedure is identical, with the key difference that you need to compile and run these in the source code directory of the corresponding version that you are trying to run.</p>

CC BY-SA 4.0
2019-08-22T09:38:32.750Z
2019-08-22T09:38:32.750Z
cdecker
<p>I have followed the steps to install a C-lightning node on my Ubuntu machine.  I wanted to know if I could install configure and make a second node on the same machine where both could run in tandem?</p>

CC BY-SA 4.0
2019-08-20T23:29:19.117Z
I am well aware that I would need to use a seperate lightning directory and port for the second node, but when I try to clone the github, it just clones the 2nd instance inside the folder of the first instance and only one lightningd can be active at a time.  When I try to activate the second node, it just says "We seem to be missing some gossip messages" in the second terminal.
Next Layer
CC BY-SA 4.0
2019-08-22T09:28:28.903Z
Are you trying to run two separate versions of `lightningd`? If not you will not need to check the source out again, and you can run all instances with the same binary (but with different ports and different `--lightning-dir` parameters as you correctly pointed out).
cdecker
<bitcoind><core-lightning>
How do I install a second independent C-lightning node on the same machine as one with an already operational node?
Next Layer
# How do I install a second independent C-lightning node on the same machine as one with an already operational node?

(Asked by: username_0 on 2019-08-20)

I have followed the steps to install a C-lightning node on my Ubuntu machine. I wanted to know if I could install configure and make a second node on the same machine where both could run in tandem?

**Tags:** bitcoind, core-lightning

> **Comments:**
> **username_0**: I am well aware that I would need to use a seperate lightning directory and port for the second node, but when I try to clone the github, it just clones the 2nd instance inside the folder of the first instance and only one lightningd can be active at a time.  When I try to activate the second node, it just says "We seem to be missing some gossip messages" in the second terminal.  
> **username_1**: Are you trying to run two separate versions of `lightningd`? If not you will not need to check the source out again, and you can run all instances with the same binary (but with different ports and different `--lightning-dir` parameters as you correctly pointed out).  

---

## 1 answers

### Answer by username_1 on 2019-08-22. Score: 2

Unless you want to test multiple versions of the `lightningd` binary, there is no need to check the source code out multiple times, since the binaries can be shared among multiple instances.

Assuming you are in the root directory of the source code, and you've executed `./configure` and `make`, you can start multiple instances like this:

```
$ lightningd/lightningd --log-level=debug \
                        --lightning-dir=/path/to/lightning-dir1 \
                        --addr=0.0.0.0:1111 &

```

```
$ lightningd/lightningd --log-level=debug \
                        --lightning-dir=/path/to/lightning-dir2 \
                        --addr=0.0.0.0:2222 &

```

```
$ lightningd/lightningd --log-level=debug \
                        --lightning-dir=/path/to/lightning-dir3
                        --addr=0.0.0.0:3333 &

```

Each of these commands will start a new node with its own directory and with its own port.

Notice that you'll also need to tell `lightning-cli` where to find the various instances you're trying to talk to. For example the following will run the `help` command on the second instance:

```
$ lightning-cli --lightning-dir=/path/to/lightning-dir2 help

```

I usually will set up a couple of aliases for each instance that I run:

```
alias lcli1="lightning-cli --lightning-dir=/path/to/lightning-dir1"
alias lcli2="lightning-cli --lightning-dir=/path/to/lightning-dir2"
alias lcli3="lightning-cli --lightning-dir=/path/to/lightning-dir3"

```

Then you can just use `lcli1 help` to talk to the first instance.

If you'd like to run multiple versions, the procedure is identical, with the key difference that you need to compile and run these in the source code directory of the corresponding version that you are trying to run.


---

