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
- A server running Debian 10.
- A non-root user with sudo privileges.
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.
- Connect to your server via SSH:
ssh username@server_ip
- Update the package list:
sudo apt update
- Install Node.js:
sudo apt install nodejs
- To verify the installation, run the following command:
nodejs --version
The output should be the version number of Node.js.
Step 2 - Install Haraka
- Create a new directory for Haraka:
sudo mkdir /opt/haraka
- Clone the Haraka repository:
sudo git clone https://github.com/haraka/Haraka /opt/haraka
- 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.
- Switch to the Haraka directory:
cd /opt/haraka
- Install the Haraka dependencies:
sudo npm install
Step 3 - Configure Haraka
- Copy the sample configuration file:
sudo cp config/plugin.sample config/plugins
- 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.
- Save and close the configuration file.
Step 4 - Start Haraka
- Switch to the Haraka directory:
cd /opt/haraka
- Start Haraka:
sudo npm start
- 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.