2020-09-03 19:53:22 +02:00
---
layout: default
title: Basic installation
nav_order: 2
---
2021-07-07 10:53:53 +01:00
# Basic installation
2020-09-03 19:53:22 +02:00
Download this repo and install the dependencies:
```sh
2020-10-02 14:53:55 -03:00
git clone https://github.com/lnbits/lnbits.git
cd lnbits/
2021-05-22 20:35:37 -03:00
# ensure you have virtualenv installed, on debian/ubuntu 'apt install python3-venv' should work
2020-10-02 14:53:55 -03:00
python3 -m venv venv
./venv/bin/pip install -r requirements.txt
cp .env.example .env
2021-03-19 12:27:41 +01:00
mkdir data
2020-10-02 14:53:55 -03:00
./venv/bin/quart assets
./venv/bin/quart migrate
2020-10-04 23:06:28 -03:00
./venv/bin/hypercorn -k trio --bind 0.0.0.0:5000 'lnbits.app:create_app()'
2020-09-03 19:53:22 +02:00
```
2021-06-21 04:33:29 +02:00
Now you can visit your LNbits at http://localhost:5000/.
2020-09-03 19:53:22 +02:00
2020-10-02 14:53:55 -03:00
Now modify the `.env` file with any settings you prefer and add a proper [funding source ](./wallets.md ) by modifying the value of `LNBITS_BACKEND_WALLET_CLASS` and providing the extra information and credentials related to the chosen funding source.
2020-09-03 19:53:22 +02:00
2021-06-21 04:33:29 +02:00
Then you can restart it and it will be using the new settings.
2020-09-03 19:53:22 +02:00
2020-10-15 23:12:32 -03:00
You might also need to install additional packages or perform additional setup steps, depending on the chosen backend. See [the short guide ](./wallets.md ) on each different funding source.
2021-03-19 12:27:41 +01:00
2021-07-07 10:53:53 +01:00
# Additional guides
### LNbits running on Umbrel behind Tor
If you want to run LNbits on your Umbrel but want it to be reached through clearnet, _Uxellodunum_ made an extensive [guide ](https://community.getumbrel.com/t/guide-lnbits-without-tor/604 ) on how to do it.
### Docker installation
2021-03-19 12:27:41 +01:00
To install using docker you first need to build the docker image as:
2021-07-07 10:53:53 +01:00
2021-03-19 12:27:41 +01:00
```
git clone https://github.com/lnbits/lnbits.git
2021-06-21 04:33:29 +02:00
cd lnbits/ # ${PWD} referred as < lnbits_repo >
2021-03-19 12:27:41 +01:00
docker build -t lnbits .
```
You can launch the docker in a different directory, but make sure to copy `.env.example` from lnbits there
2021-07-07 10:53:53 +01:00
2021-03-19 12:27:41 +01:00
```
cp < lnbits_repo > /.env.example .env
```
2021-07-07 10:53:53 +01:00
2021-03-19 12:27:41 +01:00
and change the configuration in `.env` as required.
Then create the data directory for the user ID 1000, which is the user that runs the lnbits within the docker container.
2021-07-07 10:53:53 +01:00
2021-03-19 12:27:41 +01:00
```
mkdir data
sudo chown 1000:1000 ./data/
```
Then the image can be run as:
2021-07-07 10:53:53 +01:00
2021-03-19 12:27:41 +01:00
```
docker run --detach --publish 5000:5000 --name lnbits --volume ${PWD}/.env:/app/.env --volume ${PWD}/data/:/app/data lnbits
2021-06-19 03:41:30 +02:00
```
2021-07-07 10:53:53 +01:00
2021-06-21 04:33:29 +02:00
Finally you can access your lnbits on your machine at port 5000.