# How to Install a Core Lightning node on a testnet network with Linux Ubuntu and use Tor
###### tags: `workshops_mln`
This is a tutorial to install Blockstream's implementation of the lightning network initially called c-lightning and currently renamed to Core Lightning (CLN)
**Table of Contents**
[TOC]
## Author
Twitter for corrections, comments or suggestions: [@bitao36](https://twitter.com/bitao36)
This tutorial was prepared for the [Mastering Lightning Socratic Seminar](https://libreriadesatoshi.com/) through [@libreriadesatoshi](https://twitter.com/libdesatoshi).
## Requirements :information_source:
:::info
* Have a Debian-based Linux distribution installed, preferably Ubuntu.
*Have a Bitcoin Core node installed
*Have Tor installed
:::
In order to run a lightning core node on testnet, you must have Bitcoin Core installed and running.
## Install dependencies to compile lightningd
```gherkin=
$sudo apt-get update
$sudo apt-get install -y \
autoconf automake build-essential git libtool libgmp-dev libsqlite3-dev \
python3 python3-mako python3-pip net-tools zlib1g-dev libsodium-dev gettext
$pip3 install --upgrade pip
```
If you want to use the cln-grpc plugin or build plugins with Rust you must install Rust with this line:
`$sudo apt-get install -y load rustfmt`
In case you are interested in developing, you must install these additional dependencies:
```gherkin=
$sudo apt-get install -y valgrind libpq-dev shellcheck cppcheck \
libsecp256k1-dev jq
```
## Compile and install lightningd
We clone the repository where the c-lightning source code is:
```gherkin=
$git clone https://github.com/ElementsProject/lightning.git
$cd lightning
```
We are looking for the latest stable version:
`$git tag`
At the time of updating this tutorial it is v24.05 so let's go to that release:
`$git checkout v24.05`
Now if we compile and run lightning:
```gherkin=
$pip3 install mako
$./configure
$make -j$(nproc)
$sudo make install
```
Before running lightningd we must create the .lightning directory and within that directory we will create the config file
`$sudo nano ~./lightning/config`
And we add the following lines:
```gherkin=
network=testnet
log-level=debug
log-file=lightningd.log
addr=0.0.0.0:9735
```
Before launching lightningd, bitcoind must already be running.
Now if we launch lightningd as a daemon:
`$lightningd --daemon`
And we get data from the node:
`$lightning-cli getinfo`
Congratulations, you now have a lightning core node running.
With this command you can stop lightningd
`$lightning-cli stop `
Now to create the service we go to the following route:
`$cd /etc/systemd/system`
And we run this command to get the configuration file directly from the bitcoin repository
`$sudo wget https://raw.githubusercontent.com/ElementsProject/lightning/master/contrib/init/lightningd.service`
Now we have to modify the routes where the ExecStart parameter is
`$sudo nano lightningd.service`
```
ExecStart=/usr/local/bin/lightningd --daemon /home/admon/.lightning/config --pid-file=/run/lightningd/lightningd.pid
```
press Ctrl+x , then press 's' and enter to save the changes.
We execute this command to start the service when the computer restarts:
`$sudo systemctl enable lightningd.service`
And with this command we execute it:
`$sudo systemctl start lightningd.service `
To see the status of the service we execute:
`$sudo systemctl status lightningd.service `

If we want to stop it we use:
`$sudo systemctl stop lightningd.service `
If you have come this far, congratulations, you have a node running with Bitcoin core and core lightning, now you have your own bank and for the first time in history you will be able to have monetary sovereignty :-)