# Installing Velocity MTA

{% hint style="info" %}
Installation can occur on any Ubuntu Linux server with an AMD64-compatible or ARM64 CPU.&#x20;
{% endhint %}

{% hint style="danger" %}
&#x20;Installation must be run as **root**. `sudo` is unsupported.
{% endhint %}

{% hint style="success" %}
**Velocity MTA can run on an unlimited number of remote servers.**

Velocity MTA can run on unlimited remote servers that all point back to one emaildelivery.com ESP platform installation.
{% endhint %}

{% hint style="success" %}
**Velocity MTA can run on the same server as the ESP platform.**

However, Velocity MTA needs to run on a different *ip address* than the ESP platform.\
Find more information on the explanation behind this limitation [here](https://docs.emaildelivery.com/docs/resolving-port-conflicts-with-a-second-ip).
{% endhint %}

#### Download and unpack the installation archive:

**Intel/AMD:**

```bash
curl -LO https://github.com/emaildelivery/edcom-ce/releases/latest/download/velocity-install-amd64.tgz
tar -xzvf velocity-install-amd64.tgz
cd velocity-install
```

**ARM/AArch64:**

```bash
curl -LO https://github.com/emaildelivery/edcom-ce/releases/latest/download/velocity-install-arm64.tgz
tar -xzvf velocity-install-arm64.tgz
cd velocity-install
```

{% hint style="warning" %}
**For Velocity MTA to start, all three configuration files must exist.**
{% endhint %}

If any of these files are missing, Velocity MTA will crash with ugly error messages:

* conf/ipaddresses
* conf/receiving\_domains
* conf/mta.conf

**Create the mta.conf file:**

```
cp conf/mta.defaults.conf conf/mta.conf 
```

There are only three settings in mta.conf:

* Platform URL
* Management IP
* MTA Password

{% hint style="info" %}
**Platform URL**

This is the URL to your ESP platform installation, entered exactly as it is in your web browser. <https://esp.yourdomain.com> if you've enabled SSL or <http://esp.yourdomain.com> if you haven't reached that step yet in your ESP configuration.&#x20;
{% endhint %}

{% hint style="info" %}
**Management IP**

This is the IP you used to connect to this server with SSH. The "Primary" or "Main" IP.&#x20;
{% endhint %}

{% hint style="warning" %}
The Management IP is NOT the IP of your ESP platform; it's the IP of the server you're on right now, where you're configuring the MTA.
{% endhint %}

{% hint style="success" %}
**The Management IP can&#x20;*****also*****&#x20;be used as a sending IP.**

The Management IP is not "reserved", it can be used for sending email with the MTA. However, when running on the same server as the ESP platform, the Velocity MTA Management IP cannot be the ESP platform's IP address, as explained [elsewhere](https://docs.emaildelivery.com/docs/resolving-port-conflicts-with-a-second-ip) in our documentation.
{% endhint %}

{% hint style="info" %}
**MTA Password**

This password must match the password you enter in the ESP platform Velocity MTA Server configuration.&#x20;
{% endhint %}

**Create the ipaddresses file:**

Add a list of sending IP addresses in `conf/ipaddresses`

These are the IP addresses you'll use to send email from on the MTA.&#x20;

The format for the `conf/ipaddresses` file is dead simple, one IP address per line.

<figure><img src="https://2024949584-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHNgw7cfnOYHQr0B6GDXr%2Fuploads%2FojDVX29s5W8aOt2C5Yrq%2FScreenshot%202023-10-20%20at%203.43.46%E2%80%AFAM.png?alt=media&#x26;token=7a34c805-327e-48d8-9511-77e73128ddd2" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Your Management IP can be your only sending IP in conf/ipaddresses, or you can request multiple IP addresses from your server provider. &#x20;
{% endhint %}

{% hint style="warning" %}
**Make sure extra IPs are configured&#x20;*****on*****&#x20;your server, not just provisioned&#x20;*****to*****&#x20;your server.**

When your server hosting provider provisions you more IPs, they don't automatically "just work" on your server. Someone has to enable them in Linux once they've been assigned. ChatGPT can tell you exactly what to do here, or you can try opening a ticket with your hosting provider and see if they will do it for you, if all else fails there's fiverr. Don't ask us, we'll just ask ChatGPT and tell you what that dude said.&#x20;
{% endhint %}

{% hint style="info" %}
**conf/receiving\_domains**

Receiving domains will accept feedback loop complaints, bounces, or email replies and store each message as a text file in the velocity-install/mail/new directory. This is known as Maildir format.&#x20;
{% endhint %}

{% hint style="danger" %}
All domains not in the conf/receiving\_domains file will have email delivery attempts refused, otherwise your disk will fill up with malware, spam, and exploit attempts.&#x20;
{% endhint %}

**Create the receiving\_domains file:**

Create a list of domains to accept incoming email for spam complaints, bounces, and other replies in `conf/receiving_domains`

The format for the `conf/receiving_domains` file is dead simple, one domain per line, including subdomain if applicable.

<figure><img src="https://2024949584-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHNgw7cfnOYHQr0B6GDXr%2Fuploads%2FoQC6HBHy3PXpfJLymzB3%2FScreenshot%202023-10-20%20at%204.22.23%E2%80%AFAM.png?alt=media&#x26;token=03acc1f5-1de2-4137-adf8-aa78eae6bbf7" alt=""><figcaption></figcaption></figure>

#### Docker Compose is a prerequisite

{% hint style="warning" %}
This optional next step will uninstall any older Docker versions.
{% endhint %}

{% hint style="danger" %}
This step is unnecessary if you're running Velocity MTA on the same server as the ESP, where Docker has already been installed.&#x20;
{% endhint %}

A Docker install script for Ubuntu is included for convenience:

```
./install_docker_on_ubuntu.sh
```

Load the Velocity MTA Docker Images:

```
./load_images.sh
```

Finally, start Velocity MTA:

```
./restart.sh
```

Verify Velocity MTA started properly:

```
docker logs edcom-velocity
```

Check the log file:

```
cat logs/velocity.log 
```

{% hint style="success" %}
Velocity MTA is running!&#x20;

You'll need to add your new Velocity MTA server to your ESP Platform to start sending email.
{% endhint %}
