Setup PT Magic on Linux - PTMagicians/PTMagic GitHub Wiki

Important: Please do not install PTMagic if you are already running Profit Trailer Feeder. Both tools write to your bot.PROPERTIES files and there may be side effects.

Other Guides

Neomelb created a posting that has instructions on how to setup PT Magic on Ubuntu in Chinese here and Nidkil in English here.

A Rasberry Pi Thread See here.

Quick Start

To run PTMagic on a Linux server you have to install Microsoft .NET. The steps and commands are slightly different for each Linux distribution, so you need to find the instructions that are right for your Linux flavour.

Download and setup .Net 10

sudo apt install -y aspnetcore-runtime-10.0

Or go to https://dotnet.microsoft.com/en-us/download/dotnet/10.0 to download. You'll need:

  • .NET Desktop Runtime
  • ASP.NET Core Runtime

Verify both required runtimes (Microsoft.NETCore.App & Microsoft.AspNetCore.App) are available:

dotnet --list-runtimes

You shouldn't need to reboot.

Setup PTMagic

  1. Create the installation directory: sudo mkdir -p /var/opt/PTMagic

  2. Set directory ownership: sudo chown -R "$USER:$(id -gn)" /var/opt/PTMagic

  3. Run the updater from Github which installs to /var/opt/ptmagic by default curl -fsSL https://raw.githubusercontent.com/PTMagicians/PTMagic/master/install-linux.sh | sudo bash

(for a custom directory, change sudo bash to sudo bash -s -- /yourpath/yourdirectory)

Configure PT Magic

If this is a new installation the default files settings.analyzer.json, settings.general.json, and /_presets/Default will be moved into the main folder. If you are updating, all your settings files will remain intact.

After installing, proceed with the setup guide to understand how to configure your installation. You can use nano to edit your configuration files via SSH, or edit them elsewhere and move them to your server.

To start the PTMagic application cd /var/opt/ptmagic && dotnet PTMagic.dll

To start the monitor cd /var/opt/ptmagic && dotnet Monitor/Monitor.dll

If something is not working as expected please have a look at our Post-Install Checklist and other wiki pages.

Automate startup with PM2

  1. Install npm and PM2
sudo apt install -y nodejs npm
sudo npm install -g pm2
  1. Create a JSON file for PM2

Navigate to your PTMagic installation directory:

cd /var/opt/ptmagic

Create a PM2 startup file for PTMagic Core:

nano pm2-PTM-core.json

Copy and paste the following:

{
  "apps": [{
    "name": "ptm-core",
    "cwd": "/var/opt/ptmagic",
    "script": "PTMagic.dll",
    "exec_interpreter": "dotnet",
    "exec_mode": "fork",
    "autorestart": true
  }]
}

Create a PM2 startup file for the Monitor:

nano pm2-PTM-monitor.json

Copy and paste the following:

{
  "apps": [{
    "name": "ptm-monitor",
    "cwd": "/var/opt/ptmagic/Monitor",
    "script": "Monitor.dll",
    "exec_interpreter": "dotnet",
    "exec_mode": "fork",
    "autorestart": true
  }]
}

Replace /var/opt/ptmagic with your installation directory if different.

  1. Start PTMagic and Monitor
pm2 start pm2-PTM-core.json
pm2 start pm2-PTM-monitor.json
  1. Automate startup after reboot
pm2 startup

Run the command PM2 displays, then:

pm2 save
  1. View logs
pm2 logs ptm-core
pm2 logs ptm-monitor