Debian Package Guide¶
Author: Jason (jagerman)
This repository contains debian/ubuntu builds of the core loki tools (lokid, cli/rpc wallets, blockchain tools) for Debian and Ubuntu.
- Debian 9 ("stretch")
- Debian 10 ("buster")
- Debian unstable ("sid")
- Ubuntu 16.04 ("xenial")
- Ubuntu 18.04 ("bionic")
- Ubuntu 19.04 ("disco")
Start a new service node by running these four commands:
curl -s https://deb.imaginary.stream/public.gpg | sudo apt-key add - echo "deb https://deb.imaginary.stream $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/imaginary.stream.list apt update apt install loki-service-node
The services will run via systemd as
1: Initial Repository Setup¶
You only need to do this step the first time you want to set up the repository; when you've done it once, the repository will automatically update whenever you fetch new system updates.
To add the apt repository run the following command, replacing
<DISTRO> in the second line with the
appropriate value (see below).
The following command installed Jagermans public key used to sign the Binaries.
curl -s https://deb.imaginary.stream/public.gpg | sudo apt-key add -
The second command tells
apt where to find the packages and needs you to replace
<DISTRO> with your your distro.
To find your
<Distro> run the following command:
<Distro> can be found by using the following list:
- sid (Debian testing/unstable)
- stretch (Debian 9)
- buster (Debian 10)
- xenial (Ubuntu 16.04)
- bionic (Ubuntu 18.04)
- disco (Ubuntu 19.04)
echo "deb https://deb.imaginary.stream <DISTRO> main" | sudo tee /etc/apt/sources.list.d/imaginary.stream.list
Then resync your package repositories with:
sudo apt update
Now you can install one or more of the following packages as desired:
||Metapackage that does everything you need for a running service node.|
||The loki daemon (automatically pulled in by
||The loki storage server, required for a service node (automatically pulled in by
||The command-line wallet.|
||The rpc wallet (for script-based wallet interaction such as a pool would need).|
||the various loki-blockchain-* commands for advanced blockchain management.|
There are also a couple of
libloki-core* packages containing the shared library code, but these will
be installed automatically as needed.
There is also a
libloki-core-dev package containing the loki
headers, but it's highly unlikely that you will need that for common use.
Installing a Package¶
To install a package run the following command replacing
sudo apt install <package>
For example: To install
loki-service-node package run the following command:
sudo apt install loki-service-node
2. Loki Service Node Operation¶
Running a service node requires multiple packages (lokid and loki-storage-server) with synchronized configuration between them. There are two ways to approach this:
sudo apt install loki-service-node
This will detect your public IP (or allow you to enter it yourself) and automatically update the loki.conf configuration file with the necessary additional settings to run a service node.
sudo apt install lokid
sudo apt install loki-storage-server
Then edit the configuration in
If you want to change some of the lokid settings you can add the settings to
Restart both after configuration updates using:
systemctl restart loki-node loki-storage-server
Adding flags to config file.¶
Note that you can add any of lokid's command-line arguments as settings in this file rather than
needing to change the service file. For example, if you wanted to run lokid as
lokid --p2p-bind-ip 126.96.36.199 --p2p-bind-port=22222 --restricted-rpc then you would add:
p2p-bind-ip=188.8.131.52 p2p-bind-port=22222 restricted-rpc=1
/etc/loki/loki.conf and then restart lokid using:
sudo systemctl restart loki-node
3. Interacting with the running lokid¶
If you run the lokid binary with a command, it forwards this command to the running lokid. So, for example, to get the current lokid status you can run (note that sudo is not required!):
lokid status lokid print_sn_status
To prepare a service node registration run the following command:
The terminal will show the next steps to conduct to have your Service Node staked and thus receiving rewards.
To see the outputs of your node you can run the following command:
journalctl -u loki-node -af
This is useful to see if your node is syncing with the blockchain.
For a full list of supported commands run:
For interacting with a running testnet node, add
--testnet into the command, such as:
lokid --testnet status lokid --testnet print_sn_status lokid --testnet prepare_registration
When a new release is available upgrading it as simple as syncing with the repository:
sudo apt update
Then install any updates using:
sudo apt upgrade
Note that this will install both updated lokid packages and any available system updates (this is generally a good thing!).
During the upgrade, lokid (both mainnet and testnet) will be restarted if they are currently running to switch to the updated lokid.
If for some reason you want to install only updated loki package upgrades but not other system packages then instead of the
sudo apt upgrade you can use:
sudo apt install loki-storage-server lokid loki-wallet-cli
Installing a non-service-node lokid and cli wallet.¶
To install a non-service-node lokid and the cli wallet:
sudo apt install lokid loki-wallet-cli
Once installed the binaries will be in your path, so you can simply run
loki-wallet-cli as an
ordinary user to use the command-line wallet.
Non-service-node Loki operation¶
Installing the lokid package sets up a
loki-node systemd service that runs an ordinary loki node,
but not a service node. This node can be used, for example, for wallet synchronization. If you
don't want the node to run you can stop it after installation using:
sudo systemctl stop loki-node
If you want to disable it entirely (so that it doesn't start up automatically at boot) you can use:
sudo systemctl disable --now loki-node
If you later want to re-enable it you would use:
sudo systemctl enable --now loki-node
--nowif you want to reenable it but not actually try starting it.
For advanced users, lokid creates a
_loki user and stores all the files (blockchain, service node
key, etc.) owned by this user in
Running a Testnet Node¶
The lokid package also installs a second systemd service, loki-testnet-node, for easily running a testnet node (either at the same time or instead of the mainnet node). To enable and start this, simply run:
sudo systemctl enable --now loki-testnet-node
This will start it and configure systemd to automatically start it when the system boots.
loki-service-node package also updates the testnet.conf file to run as a (testnet) service
node; in order to actually run it you need to activate and start both the loki-testnet-node.service
(as above) and also the loki-testnet-storage-server.service:
sudo systemctl enable --now loki-testnet-node sudo systemctl enable --now loki-testnet-storage-server
Contact me via @jagerman42 (Telegram) or @jagerman#6841 (in the Loki Discord).