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?
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
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.