Come hang with us on Discord and chat directly with the team!Discordtop-bar-close-icon

2024-09-17

How to Install Listmonk on Ubuntu Server

tutorials
img

Listmonk is an open-source solution for managing email newsletters, designed to streamline the creation and management of email campaigns. This guide will walk you through the installation process on the latest Ubuntu Server.

Prerequisites

Before starting, ensure you have:

  • Ubuntu Server Latest with sudo privileges
  • A registered domain with DNS access
  • MySQL or MariaDB database management system

Step 1 — Installing Required Packages

First, update the Ubuntu package index:

sudo apt-get update

Then, install the necessary packages:

sudo apt-get install -y git curl libmariadb-dev mariadb-client mariadb-server

Step 2 — Installing Go

Since Listmonk is developed in Go, install the Go programming language:

Download the Go binary:

curl -O https://storage.googleapis.com/golang/go1.17.2.linux-amd64.tar.gz

Extract it to the /usr/local directory:

sudo tar -xf go1.17.2.linux-amd64.tar.gz -C /usr/local

Update the PATH environment variable:

echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc

Step 3 — Setting Up MySQL/MariaDB

Install the database server:

sudo apt-get install -y mariadb-server

Start and enable the database service:

sudo systemctl start mariadb
sudo systemctl enable mariadb

Secure the installation with:

sudo mysql_secure_installation

Create a database and user for Listmonk:

sudo mysql -u root -p

Enter these MySQL commands:

CREATE DATABASE listmonk CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER listmonk@localhost IDENTIFIED BY 'new_password_here';
GRANT ALL PRIVILEGES ON listmonk.* TO listmonk@localhost WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;

Step 4 — Installing Listmonk

Create a new directory and clone the repository:

mkdir ~/listmonk && cd ~/listmonk
git clone https://github.com/knadh/listmonk.git .

Compile the executable:

go build

Step 5 — Configuring Listmonk

Create and edit config.yml:

nano ~/listmonk/config.yml

Insert the configuration:

database:
dialect: mysql
conn: listmonk:new_password_here@/listmonk?parseTime=true&multiStatements=true&sql_mode=...
...

Replace placeholders with your specific settings, such as database connection and SMTP information.

Step 6 — Running Listmonk

Start the Listmonk server:

./listmonk serve

Access Listmonk via http://your-server-ip:9000 in your browser.