Install Listmonk on Ubuntu 22.04
Table of contents
Launch an Ubuntu Instance and SSH Login to the Terminal
Install Docker :
Reference: https://docs.docker.com/engine/install/ubuntu/
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
# Add the repository to Apt sources:
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
# Install the Docker packages.
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Test Docker:
sudo docker run hello-world
Install Listmonk:
Reference: https://listmonk.app/docs/installation/
mkdir listmonk && cd listmonk
sh -c "$(curl -fsSL https://raw.githubusercontent.com/knadh/listmonk/master/install-prod.sh)"
Output:
Listmonk is now up and running. Visit http://localhost:9000 in your browser.
Default Username listmonk
and password listmonk
.
Nginx Conf:
server {
server_name *.sanjaysikdar.dev;
server_tokens off;
client_max_body_size 100M;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
add_header 'Access-Control-Allow-Origin' 'https://sanjaysikdar.dev';
proxy_redirect off;
proxy_pass http://localhost:9000;
}
}
Shell Script:
#!/bin/bash
select opt in Restart CheckStatus UpdateListMonk Quit
do
case $opt in
Restart)
sudo nginx -t && sudo systemctl restart nginx
echo "Nginx has been restarted."
exit 0
;;
CheckStatus)
sudo systemctl status nginx
echo "Shell by Sanjay Sikdar"
exit 0
;;
UpdateListMonk)
cd /var/listmonk
docker-compose down
docker-compose pull && docker-compose run --rm app ./listmonk --upgrade
docker-compose up -d app db
exit 0
;;
Quit)
echo "Exited!"
exit 0
;;
*)
echo "invalid option"
;;
esac
done