Listmonk is a powerful, self-hosted newsletter and mailing list manager that offers a range of features and is packed into a single binary. In this article, we will walk you through the process of installing Listmonk on Rocky Linux 8. By following these step-by-step instructions, you’ll be able to set up Listmonk and leverage its capabilities to effectively manage your mailing lists. So, let’s get started!
Prerequisites
Before we dive into the installation process, let’s make sure that you have everything you need. Ensure that you have:
- A system with Rocky Linux 8 installed and running.
- Root access to the system.
- Docker installed and running. If you haven’t installed Docker yet, you can refer to our guide on installing Docker on Rocky Linux 8.
Now that we have all the prerequisites in place, we can proceed with the installation and configuration of Listmonk.
Step 1: Install Nginx
To begin, we need to install Nginx, a popular web server and reverse proxy. Execute the following commands to install Nginx:
yum install nginx -y
Once Nginx is installed, enable and start the service:
systemctl enable nginx systemctl start nginx
To verify that Nginx is running properly, check its status:
systemctl status nginx
Step 2: Install Let’s Encrypt SSL Certificate
Securing your Listmonk installation with an SSL certificate is essential for maintaining the privacy and integrity of your data. We will use Let’s Encrypt, a free and open certificate authority, to issue an SSL certificate. Follow these steps to install the certificate:
Install EPEL repository and mod_ssl package
Before we can install the SSL certificate, we need to install the EPEL repository and the mod_ssl package. Use the following command:
dnf install epel-release mod_ssl -y
Install certbot client
Next, we need to install the certbot client, which is used to create Let’s Encrypt certificates. Run the following command:
dnf install python3-certbot-nginx -y
Issue the SSL certificate
Now, it’s time to issue the SSL certificate. Replace dev.domainhere.info and dev@dev.domainhere.info with your domain name and email address:
certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email dev@dev.domainhere.info -d dev.domainhere.info
It’s worth noting that Let’s Encrypt certificates are valid for 90 days, and the renewal process is automated, so you don’t have to worry about renewing it manually.
Restart Nginx
To apply the changes, restart Nginx:
systemctl restart nginx
Step 3: Configuring Nginx Server Blocks
In this step, we will configure Nginx server blocks to route traffic to the Listmonk application. Follow these instructions:
Edit nginx.conf
Open the nginx.conf file for editing:
nano /etc/nginx/nginx.conf
Replace the contents of nginx.conf with the following configuration:
# For more information on configuration, see: # * Official English Documentation: http://nginx.org/en/docs/ # * Official Russian Documentation: http://nginx.org/ru/docs/user nginx; worker_processes auto; error_log /var/log/nginx/error.log; pid /run/nginx.pid; # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. include /usr/share/nginx/modules/*.conf; events { worker_connections 1024; } http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; # Load modular configuration files from the /etc/nginx/conf.d directory. # See http://nginx.org/en/docs/ngx_core_module.html#include # for more information. include /etc/nginx/conf.d/*.conf; }
Save and exit the file by pressing Ctrl+O and then Ctrl+X.
Create a new Nginx configuration file
Create a new Nginx configuration file for your Listmonk domain:
vi /etc/nginx/conf.d/dev.conf
Add the following configuration to the dev.conf file:
upstream app { server 192.169.7.180:9000; } server { listen 80 default_server; server_name dev.domainhere.info; return 301 https://$server_name$request_uri; } server { listen 443 ssl; # managed by Certbot # The host name to respond to server_name dev.domainhere.info; ssl_certificate /etc/letsencrypt/live/dev.domainhere.info/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/dev.domainhere.info/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot location / { proxy_pass http://app; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; proxy_set_header X-Real-Port $server_port; proxy_set_header X-Real-Scheme $scheme; } }
Save and exit the file by pressing Esc, typing :wq!, and then pressing Enter.
Configure SELinux (optional)
If you have SELinux enabled on your system, run the following command to allow Nginx to make network connections:
setsebool -P httpd_can_network_connect 1
Restart Nginx
To apply the changes, restart Nginx:
systemctl restart nginx
Step 4: Enable Port 9000
To enable connections through port 9000, execute the following commands:
firewall-cmd --zone=public --permanent --add-port9000/tcp firewall-cmd --reload
With the firewall configured, Listmonk will be able to communicate through port 9000.
Step 5: Install Listmonk with Docker
Now comes the exciting part—installing Listmonk using Docker. Docker provides a simple and efficient way to set up and manage Listmonk. Follow these steps:
Update installation details on docker-compose.yml
Update the installation details in the docker-compose.yml file. Execute the following command:
docker run --name listmonk -d --publish 9000:9000 listmonk/listmonk:latest
Create Listmonk directory and run installation script
Create a new directory called listmonk and navigate into it:
mkdir listmonk && cd listmonk
Then, run the Listmonk installation script:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/knadh/listmonk/master/install-prod.sh)"
The installation process may take a few minutes to complete.
Step 6: Accessing Listmonk
Congratulations! You have successfully installed Listmonk on Rocky Linux 8. Now, it’s time to access the Listmonk interface and start managing your mailing lists.
To access Listmonk, open your web browser and enter the IP address or domain name associated with your Listmonk installation. For example:
https://dev.domainhere.info
Replace dev.domainhere.info with your actual IP address or domain name.
Conclusion
In this comprehensive guide, we have walked you through the process of installing Listmonk with Docker on Rocky Linux 8. By following these steps, you have set up a powerful and feature-rich newsletter and mailing list manager that will help you effectively manage your email campaigns.
If you need reliable and scalable cloud hosting solutions for your Listmonk installation, consider Shape.host. They offer Cloud VPS services with exceptional performance and 24/7 customer support.
Now that you have Listmonk up and running, it’s time to unleash the power of email marketing and grow your subscriber base. Happy emailing!