How to Install Haraka on Debian Latest

Haraka is a scalable SMTP server built on Node.js. It handles both inbound and outbound email traffic and can be used as a standalone MTA or as a backend server to other mail servers. In this tutorial, we will guide you through the steps of installing Haraka on Debian latest, also known as Debian 10.

Prerequisites

Step 1 - Install Node.js

Haraka is built on Node.js, so we need to install Node.js on our server first. The latest stable release of Node.js is recommended.

  1. Connect to your server via SSH:
ssh username@server_ip
  1. Update the package list:
sudo apt update
  1. Install Node.js:
sudo apt install nodejs
  1. To verify the installation, run the following command:
nodejs --version

The output should be the version number of Node.js.

Step 2 - Install Haraka

  1. Create a new directory for Haraka:
sudo mkdir /opt/haraka
  1. Clone the Haraka repository:
sudo git clone https://github.com/haraka/Haraka /opt/haraka
  1. Change the ownership of the Haraka directory to the user you will be running Haraka as:
sudo chown -R username:username /opt/haraka

Replace "username" with the name of the user you will be running Haraka as.

  1. Switch to the Haraka directory:
cd /opt/haraka
  1. Install the Haraka dependencies:
sudo npm install

Step 3 - Configure Haraka

  1. Copy the sample configuration file:
sudo cp config/plugin.sample config/plugins
  1. Edit the configuration file:
sudo nano config/plugins

Uncomment the following lines by removing the leading '#' symbol:

rcpt_to.in_host_list=1
queue/smtp_forward:relay_host=your.mail.server.com
rcpt_to.in_host_list=0

Replace "your.mail.server.com" with the IP address or hostname of your mail server.

  1. Save and close the configuration file.

Step 4 - Start Haraka

  1. Switch to the Haraka directory:
cd /opt/haraka
  1. Start Haraka:
sudo npm start
  1. Confirm that Haraka is running by checking the logs:
sudo tail -f /opt/haraka/logs/haraka.log

If everything is set up correctly, you should see Haraka startup messages in the logs.

Conclusion

In this tutorial, you learned how to install and configure Haraka on Debian latest. You can now use Haraka to handle your email traffic, either as a standalone MTA or as a backend server to other mail servers.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!