7 Setup PT Magic on Linux
HojouFotytu edited this page 2023-07-01 22:45:49 +09:00

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.

Note: As we are no Linux experts we are not able to support you with Linux specific issues.

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 .NET Core and a webserver. 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 ASP.NET Core and the .NET Runtime

Click this link to download. You'll need:

  1. .NET Desktop Runtime
  2. ASP.NET Core Runtime

Once downloaded, extract the both files using:

sudo tar zxf dotnet-aspnetcore-runtime-3.1.13-linux-arm64.tar -C /opt/dotnet/dotnet-runtime-3.1.13/

sudo tar zxf dotnet-runtime-3.1.13-linux.tar -C /opt/dotnet/dotnet-runtime-3.1.13/

Now, let's verify that dotnet works:

cd /usr/share/dotnet/ ls -lisa ./dotnet --info

Now, let's get it working from any directory:

sudo nano ./profile

Scroll right down to the bottom and add the following:

export PATH=$PATH:/opt/dotnet/dotnet-runtime-3.1.13 export DOTNET_ROOT=/opt/dotnet/dotnet-runtime3.1.13

Save and export the file.

Now we need to reboot the system to apply the environment change.

sudo reboot

Once rebooted, you should be able to use dotnet from any folder with the following command, this verifies dotnet is installed correctly.

dotnet --info

Note: Failing the manual method, you can also install the .NET framework runtime package store with the package manager manually with:

apt-get install aspnetcore-store-3.1.13

This installs a lot of packages for offline usage that is needed by ASP.NET Core (PT Magic monitor).

Setup PTMagic monitor website

To access the PTMagic monitor website (running on port 5000) you need to install and configure the Apache webserver on your machine and setup a reverse proxy for port 80. An example walkthrough can be found here.

Configure PT Magic

After installing .NET Core proceed with the setup guide to configure your installation. After that go to the PT Magic folder in a terminal window and start with the command

dotnet PTMagic.dll

and the monitor application with

dotnet Monitor/Monitor.dll

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

Automate startup with pm2

  1. Install npm and pm2

sudo apt-get install nodejs sudo apt-get install npm sudo npm install pm2 -g

  1. Create a JSON file for pm2

In the command line, navigate to your ProfitTrailer Magic directory.

We will now create a pm2 startup file for the core Profit Trailer Magic application.

sudo nano pm2-PTM-core.json

Copy and paste the following:

{ "apps": [{ "name": "ptm-core", "cwd": ".", "script": "PTMagic.dll", "node_args": [], "log_date_format": "YYYY-MM-DD HH:mm Z", "exec_interpreter": "dotnet", "exec_mode": "fork", "autorestart": true }] }

We will now create a pm2 startup file for the Profit Trailer Magic Monitor application.

sudo nano pm2-PTM-monitor.json

Copy and paste the following:

{ "apps": [{ "name": "ptm-monitor", "cwd": ".", "script": "Monitor/Monitor.dll", "node_args": [], "log_date_format": "YYYY-MM-DD HH:mm Z", "exec_interpreter": "dotnet", "exec_mode": "fork", "autorestart": true }] }

  1. From your ProfitTrailer Magic directory, start up your files using pm2

pm2 start pm2-PTM-core.json pm2 start pm2-PTM-monitor.json

  1. Automate startup

pm2 save pm2 startup