> For the complete documentation index, see [llms.txt](https://guide.moontrader.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guide.moontrader.com/en-moontrader-docs/getting-started/installing-core-and-client/cloud-installation/installation-on-linux.md).

# Installation on Linux

This page covers installing the MoonTrader core on a Linux cloud server. The core runs on the server around the clock, and the client on your computer connects to it over the network. The example uses AWS EC2 with Ubuntu 24.04; the terminal steps work on any VPS with Ubuntu 20.04 or later.

{% hint style="info" %}
Before you start, prepare:

* a MoonTrader license and its **Activation code**: [Getting a license](https://guide.moontrader.com/en-moontrader-docs/getting-started/working-with-moontrader.com/getting-a-license.md)
* a Binance API key of the "System generated" type (HMAC): [Getting Binance API keys](https://guide.moontrader.com/en-moontrader-docs/getting-started/working-with-exchanges/getting-api-keys-for-trading/getting-api-keys-for-binance.md)
* the MoonTrader client on your computer: [Installation on Windows](https://guide.moontrader.com/en-moontrader-docs/getting-started/installing-core-and-client/local-installation/installation-on-windows.md)
  {% endhint %}

## Creating a server (AWS EC2)

1. Open the AWS console, go to "EC2", and click "Launch instance".

   <figure><img src="https://2194691319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMuOulAKIicy77MPPDXF%2Fuploads%2FdhXfZKKDhxEaDSHWenIL%2FLaunch%20Instance.png?alt=media&amp;token=6aa1bed6-fb9d-491d-a7d2-6d0be555e166" alt=""><figcaption></figcaption></figure>
2. In the "Name" field, enter a server name.

   <figure><img src="https://2194691319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMuOulAKIicy77MPPDXF%2Fuploads%2FdrXZ9HrI1SQFCyipHHvE%2FVPS%20Name.png?alt=media&amp;token=eaa0a928-054c-430f-b96d-c7d0da4dbfa4" alt=""><figcaption></figcaption></figure>
3. In "Application and OS Images", select "Ubuntu" and the "Ubuntu Server 24.04 LTS" image.
4. In the "Architecture" list, select the architecture. It determines which core build you download:

   * "64-bit (Arm)": the "Linux (arm64)" build;
   * "64-bit (x86)": the "Linux (x64)" build.

   <figure><img src="https://2194691319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMuOulAKIicy77MPPDXF%2Fuploads%2FZFuRVFfUsO1Q4PgJdd3l%2FApplication%20and%20OS%20Images.png?alt=media&amp;token=f973ab6d-25c1-461d-8e45-7bbe7b718f3d" alt=""><figcaption></figcaption></figure>
5. In the "Instance type" list, select the server type. The example uses `t4g.small` (Arm, 2 vCPU, 2 GiB).

   <figure><img src="https://2194691319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMuOulAKIicy77MPPDXF%2Fuploads%2FfAmTQyNOtdiUHeAAzpOv%2FInstance%20type.png?alt=media&amp;token=b60d5684-9916-4bba-9572-907ed8571d89" alt=""><figcaption></figcaption></figure>
6. In "Key pair (login)", select your key or click "Create new key pair".

   ⚠️ Save the `.pem` key file. Without it, you cannot connect over SSH from your computer.

   <figure><img src="https://2194691319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMuOulAKIicy77MPPDXF%2Fuploads%2FbLF4rlHsAtTuquS7Ah58%2FKey%20pair%20(login).png?alt=media&amp;token=1d98077c-068a-4331-934b-bf8c845abe7e" alt=""><figcaption></figcaption></figure>
7. In "Network settings", select a security group. Its inbound rules must open these ports:

   * 22/TCP: SSH connection to the server;
   * 4242/UDP: client connection to the core.

   <figure><img src="https://2194691319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMuOulAKIicy77MPPDXF%2Fuploads%2FgtPmOVZ14o3zp7Wgedye%2FNetwork%20settings.png?alt=media&amp;token=57f8f3a5-2ba5-4e45-bc94-3ed2001ddf2d" alt=""><figcaption></figcaption></figure>
8. Review the "Summary" block and click "Launch instance".

   <figure><img src="https://2194691319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMuOulAKIicy77MPPDXF%2Fuploads%2FMedRlRamVnF3SjKhydbH%2FSummary%20%26%20Launch%20Instance.png?alt=media&amp;token=3b5319db-b236-49c0-877c-8b6ce7a6eb8d" alt=""><figcaption></figcaption></figure>
9. Open the server page and copy the "Public IPv4 address". You will need it to connect the client and for the Binance IP whitelist.

   <figure><img src="https://2194691319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMuOulAKIicy77MPPDXF%2Fuploads%2FN8Vm2VIefTAWcbPfU79f%2FCopy%20Public%20IPv4%20address.png?alt=media&amp;token=7f557ec4-6a99-422d-bda1-65cfba74924b" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
On AWS, the public IP changes after the server is stopped and started (Stop/Start). It stays the same after a reboot. If the IP changes, update it in the client profile and in the Binance IP whitelist.
{% endhint %}

## Connecting to the server

Connect in one of two ways:

* **In the browser.** On the server page, click "Connect", select "EC2 Instance Connect", user `ubuntu`, and click "Connect".

  <figure><img src="https://2194691319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMuOulAKIicy77MPPDXF%2Fuploads%2F5vjghytSAJ2oBwVNDsdF%2FConnect%20-%20In%20Web%20Browser.png?alt=media&amp;token=e2f477c8-d362-4226-a27c-86d0473b0e12" alt=""><figcaption></figcaption></figure>
* **From your computer.** Open the "SSH client" tab and run the command shown there:

  ```bash
  ssh -i "your-key.pem" ubuntu@<server Public DNS>
  ```

  <figure><img src="https://2194691319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMuOulAKIicy77MPPDXF%2Fuploads%2FQ4gI3hyWdJ9SUeqESc60%2FConnect%20-%20In%20SSH%20Client.png?alt=media&amp;token=a9cf4e1f-7403-4f4c-8d12-7297297c12db" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
In the EC2 Instance Connect browser terminal, paste with Ctrl+Shift+V. If pasting does not work, allow the site to access the clipboard: icon left of the address bar → "Site settings" → "Clipboard" → "Allow", then reload the page.
{% endhint %}

## Installing the core

1. Install the required packages:

   ```bash
   sudo apt update && sudo apt install -y screen xz-utils wget
   ```
2. Download the core for your server architecture. For "64-bit (Arm)":

   ```bash
   wget https://cdn3.moontrader.com/beta/linux-arm64/MoonTrader-linux-arm64.tar.xz
   ```

   For "64-bit (x86)":

   ```bash
   wget https://cdn3.moontrader.com/beta/linux-x86_64/MoonTrader-linux-x86_64.tar.xz
   ```

   Current links are in your account, in the "Download" section.
3. Extract the archive to your home folder:

   ```bash
   tar -xf MoonTrader-linux-*.tar.xz
   ```

   The folder now contains the `MTCore` file and the `BotClient` folder.

   <figure><img src="https://2194691319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMuOulAKIicy77MPPDXF%2Fuploads%2FXFgzZz80lrLaqgETDLJD%2FInstalling%20the%20core.png?alt=media&amp;token=6c346671-a616-4e98-81d8-4891fe96ea5a" alt=""><figcaption></figcaption></figure>

## First launch and setup wizard

The core runs inside a `screen` session, so it keeps running after you close the terminal.

1. Create a session and start the core:

   ```bash
   screen -S mtcore
   ./MTCore
   ```

   If you extracted the archive to a different folder, go to it first: `cd <folder>`. If you get a `Permission denied` error on launch, run `chmod +x MTCore` and start the core again.
2. The profile setup wizard starts. Enter a "Profile name": up to 64 characters, allowed `a-z`, `0-9`, `-`, and `_`.

   <figure><img src="https://2194691319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMuOulAKIicy77MPPDXF%2Fuploads%2Fr88JdSewbPJj8sD7lNqm%2FProfile%20name.png?alt=media&amp;token=60293034-3f35-4dea-823d-9d3e35c45d93" alt=""><figcaption></figcaption></figure>
3. Paste the "Activation Code" from your account. It is a long string, not the license number in the `15-xxx-xxx-xxx` format. The wizard shows "Activation Code accepted" with the license number and exchange.

   <figure><img src="https://2194691319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMuOulAKIicy77MPPDXF%2Fuploads%2Fs3Ex1sRC5lIOcswppcQs%2FActivation%20Code.png?alt=media&amp;token=79631c17-33af-4012-8adf-363ea1ba1247" alt=""><figcaption></figcaption></figure>
4. At the "Client Token" prompt, press Enter: the wizard generates a new token. If you already have a token, paste it.

   ⚠️ Save the Client Token shown. You need it to connect the client to this core.

   <figure><img src="https://2194691319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMuOulAKIicy77MPPDXF%2Fuploads%2FDSisZb5gv6EPY0vtP160%2FClient%20Token.png?alt=media&amp;token=3fda653d-05ed-49fa-96fd-288b852129b9" alt=""><figcaption></figcaption></figure>
5. Press any key to continue.
6. In "Core Network configuration", press Enter twice to keep the defaults: address `*` and port `4242`.

   <figure><img src="https://2194691319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMuOulAKIicy77MPPDXF%2Fuploads%2FxkeYbrFlsxOAqjJn3lkr%2FCore%20Network%20configuration.png?alt=media&amp;token=f3ea0089-cd66-4ec4-a8e7-d75e176d7b56" alt=""><figcaption></figcaption></figure>
7. Press any key. The wizard warns that changing the Binance API keys for the license resets its current data.
8. Choose the Binance key type:

   * `1`: HMAC keys, API Key and Secret Key issued by Binance;
   * `2`: Ed25519 keys generated by the wizard. The wizard marks this option as recommended: [Connecting Binance with Ed25519 keys](https://guide.moontrader.com/en-moontrader-docs/tips-and-recommendations/connecting-binance-via-ed25519-keys.md).

   For a "System generated" key, enter `1`.
9. The wizard lists the required key permissions:

   * must be enabled: "Enable Reading", "Enable Spot & Margin Trading", "Enable Futures", "Permits Universal Transfer";
   * must be disabled: "Enable Withdrawals";
   * recommended: "IP Restriction".

   <figure><img src="https://2194691319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMuOulAKIicy77MPPDXF%2Fuploads%2FoAuF0Nob2Nzp2idBgFfA%2FAPI%20Key%20-%20Type%20%26%20Required%20Permissions.png?alt=media&amp;token=4ddc454c-8020-4be1-a163-b42d1e216ddc" alt=""><figcaption></figcaption></figure>
10. Paste the "Public API key" and the "Secret API key". The wizard checks the key permissions.

    <figure><img src="https://2194691319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMuOulAKIicy77MPPDXF%2Fuploads%2F2fy8sScl9WmHJOCQZBX4%2FPublic%20%26%20Secret%20API%20Key.png?alt=media&amp;token=9b655d60-35b6-41a8-aaa8-e1c89c65ae01" alt=""><figcaption></figcaption></figure>
11. If permissions are missing, the wizard shows the permission list and offers options:

    * `1`: fix the permissions on Binance and check again;
    * `2`: enter different keys;
    * `3`: continue without the required permissions (not recommended);
    * `4`: quit.

    <figure><img src="https://2194691319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMuOulAKIicy77MPPDXF%2Fuploads%2FLRJajzO9qBmQsIdyrF6F%2FPermissions%20are%20missing.png?alt=media&amp;token=0a702950-3dde-49f4-bda1-8a18907dcef4" alt=""><figcaption></figcaption></figure>
12. The wizard activates the license and shows "License activated successfully!".

    <figure><img src="https://2194691319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMuOulAKIicy77MPPDXF%2Fuploads%2FEk2F1S2fnODxFTE7XfuO%2FLicense%20activated%20successfully-1.png?alt=media&amp;token=ae0f1700-a31d-4cf0-9776-f9456f513b04" alt=""><figcaption></figcaption></figure>
13. At the "Watchdog Token" prompt, press Enter: the wizard generates a token for the Watchdog service. If you already have a token, paste it.

    ⚠️ Save the Watchdog Token shown. You need it to set up Watchdog: [Watchdog: monitoring trading cores](https://guide.moontrader.com/en-moontrader-docs/tips-and-recommendations/watchdog-trading-core-monitoring-setup.md).

    <figure><img src="https://2194691319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMuOulAKIicy77MPPDXF%2Fuploads%2FiJ6WWAOXNB5VRHAJFBme%2FWatchdog%20Token.png?alt=media&amp;token=e7b1bf7f-e534-43bd-aa56-a20ed0c23aa6" alt=""><figcaption></figcaption></figure>
14. Press any key. The wizard saves the profile and makes it the default profile.
15. After "Configuration wizard completed successfully!", press any key. The core starts and loads Binance markets.

    <figure><img src="https://2194691319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMuOulAKIicy77MPPDXF%2Fuploads%2FT9wHoDHtUXWX3DYeqNDV%2FConfiguration%20wizard%20completed%20successfully.png?alt=media&amp;token=acb4156c-340e-40e6-8f39-509422c5e8cd" alt=""><figcaption></figcaption></figure>
16. Detach from the session without stopping the core: press Ctrl+A, then D.

Useful commands:

| Command            | What it does                    |
| ------------------ | ------------------------------- |
| `screen -ls`       | lists running sessions          |
| `pgrep -a MTCore`  | checks that the core is running |
| `screen -r mtcore` | returns to the core session     |

## Connecting the client to the core

The client needs the **Client Token** the wizard showed in step 4. If you did not save it, you can get it on the server: it is stored in the profile's `client.auth` file, base64-encoded.

1. If you do not have the token, print it on the server. Replace `<profile>` with the profile name from the wizard:

   ```bash
   grep '^CLIENT:' ~/.config/moontrader-data/data/<profile>/client.auth | cut -d: -f2 | base64 -d; echo
   ```

   The command prints a 64-character string of `0-9` and `a-f`. Copy it.
2. On your computer, launch MoonTrader and click "Add profile".

   <figure><img src="https://2194691319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMuOulAKIicy77MPPDXF%2Fuploads%2FHjxVZe5uqAJepcS3ubZy%2FAdd%20Profile.png?alt=media&amp;token=f7ef49a2-c28d-48c4-8b31-551c360f257a" alt=""><figcaption></figcaption></figure>
3. Fill in the fields:

   * "Profile name": the profile name;
   * "Launch Mode": "Run Client Only";

     <figure><img src="https://2194691319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMuOulAKIicy77MPPDXF%2Fuploads%2FsFOozGcbpGou3KbjFre5%2FLaunch%20Mode.png?alt=media&amp;token=e5d9ef4c-0cd5-4a55-8edb-94a764026384" alt=""><figcaption></figcaption></figure>
   * "Exchange": "Binance";
   * "Client Token": the token from the wizard or from step 1;
   * "Address (IP)": the server Public IPv4;
   * "Port": `4242`.

   <figure><img src="https://2194691319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMuOulAKIicy77MPPDXF%2Fuploads%2FfOG9RLnn0UGQIAPLTLLx%2FAdd%20Profile%20-%20Details.png?alt=media&amp;token=4a3d68a3-494c-4dd2-9963-223a4e3be719" alt=""><figcaption></figcaption></figure>
4. Click "Add".
5. Hover over the profile row and click "Start".

   <figure><img src="https://2194691319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMuOulAKIicy77MPPDXF%2Fuploads%2FkCE3MPXBSURRJi1t4sHu%2FStart%20Profile.png?alt=media&amp;token=b2668fde-7ab0-414a-9cfe-9ef8583c0731" alt=""><figcaption></figcaption></figure>
6. Check the connection: the MoonTrader window title shows the core address, for example `3.112.213.120:4242`.

   <figure><img src="https://2194691319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMuOulAKIicy77MPPDXF%2Fuploads%2FgcMBxktlqhb7h1ARrhav%2FMT%20Window%20Title.png?alt=media&amp;token=4b391daf-5dab-4691-8a44-c3266fc9bae1" alt=""><figcaption></figcaption></figure>

## Binance IP whitelist

Add the server Public IPv4 to the API key's trusted IP list. The core sends the trading requests, so add the server IP, not the IP of the computer running the client. How to do it: [Getting Binance API keys](https://guide.moontrader.com/en-moontrader-docs/getting-started/working-with-exchanges/getting-api-keys-for-trading/getting-api-keys-for-binance.md).

**Still have questions? Contact** [**support**](https://t.me/moontrader_support_ru)**!**


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://guide.moontrader.com/en-moontrader-docs/getting-started/installing-core-and-client/cloud-installation/installation-on-linux.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
