Install listmonk on Debian
Table of Contents
import PasswordCodeBlock from ‘../../src/components/PasswordCodeBlock’; import CodeBlock from ‘@theme/CodeBlock’;
User and group #
Create the user and the group for listmonk
:
adduser --system --group --shell="/sbin/nologin" --home="/var/lib/listmonk" listmonk
PostgreSQL #
Install Postgre:
apt install postgresql
Setup the DB:
sudo -u postgres psql
CREATE DATABASE listmonk;
<PasswordCodeBlock language=“sql” numSymbols={0} tokens={[ {name: “SECURE_PASSWORD”}]} >
{CREATE USER listmonk WITH ENCRYPTED PASSWORD 'SECURE_PASSWORD';
}
GRANT ALL PRIVILEGES ON DATABASE listmonk TO listmonk;
Binary #
Download the latest binary from Github:
wget 'https://github.com/knadh/listmonk/releases/download/v3.0.0/listmonk_3.0.0_checksums.txt'
wget 'https://github.com/knadh/listmonk/releases/download/v3.0.0/listmonk_3.0.0_linux_amd64.tar.gz'
Check the checksum:
sha256sum -c listmonk_3.0.0_checksums.txt
Extract the binary from the downloaded archive:
tar -xvf listmonk_3.0.0_linux_amd64.tar.gz
Install the binary:
sudo install -v listmonk /usr/local/bin/
Config #
Create a directory to store the config file:
mkdir /etc/listmonk
listmonk --new-config
listmonk --install
Move the config file and fill in the credentials:
mv config.toml /etc/listmonk/
chown -R listmonk:listmonk /etc/listmonk/
Systemd #
Create the service:
nano /usr/lib/systemd/system/listmonk.service
[Unit]
Description=listmonk
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/usr/local/bin/listmonk
[Service]
User=listmonk
Group=listmonk
Restart=always
RestartSec=10
ExecStart=listmonk --config /etc/listmonk/config.toml
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable --now listmonk.service