More detailed dotnet install instructions and automation with pm2. thx to x-Jihn-x

JackTerok 2021-03-28 19:56:16 +02:00
parent ee52d9d559
commit 776a915764
1 changed files with 102 additions and 11 deletions

@ -1,30 +1,61 @@
**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.**
**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.
### Other Guides
**Neomelb** created a posting that has instructions on how to setup PT Magic on Ubuntu in _Chinese_ [here](https://steemit.com/ptmagic/@neomelb/ubuntu-linux-ptmagic-profittrailer) and **Nidkil** in english [here](http://nidkil.me/2018/02/19/pt-magic-setup-on-ubuntu-17-10/).
**Neomelb** created a posting that has instructions on how to setup PT Magic on Ubuntu in _Chinese_ [here](https://steemit.com/ptmagic/@neomelb/ubuntu-linux-ptmagic-profittrailer) and **Nidkil** in English [here](http://nidkil.me/2018/02/19/pt-magic-setup-on-ubuntu-17-10/).
**A Rasberry Pi Thread** exists on our old repository which you might find helpful, [here](https://github.com/Legedric/ptmagic/issues/81).
**A Rasberry Pi Thread** See [here](https://github.com/Heler554/ProfitTrailer/wiki/PTMagic-on-Raspberry-Pi).
## 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
Click this [link](https://docs.microsoft.com/en-us/dotnet/core/linux-prerequisites?tabs=netcore2x) to find instructions to download and setup .NET Core on your Linux distribution (exampe is Ubuntu Linux). You only need to execute the first 2 topics:
### Download and setup ASP.NET Core and the .NET Runtime
Click this [link](https://dotnet.microsoft.com/download/dotnet/3.1) to download. You'll need:
1. Add the dotnet product feed
2. Install .NET SDK
1. .NET Desktop Runtime 3.1.x
2. ASP.NET Core Runtime 3.1.x
**Note:** It seems that you also need to install the .NET framework runtime package store with
Once downloaded, extract the both files using:
> apt-get install aspnetcore-store-2.0.5
> 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 walk through can be found [here](https://blog.todotnet.com/2017/07/publishing-and-running-your-asp-net-core-project-on-linux/).
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](https://blog.todotnet.com/2017/07/publishing-and-running-your-asp-net-core-project-on-linux/).
### Configure PT Magic
After installing .NET Core proceed with the [setup guide](https://github.com/PTMagicians/PT-Magic/wiki/Setup-Guide) to configure your installation. After that go to the **PT Magic** folder in a terminal window and start with the command
@ -36,4 +67,64 @@ 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](https://github.com/PTMagicians/PT-Magic/wiki/Post-Install-Checklist) and [FAQ](https://github.com/Legedric/ptmagic/wiki/FAQ-and-Tips).
If something is not working as expected please have a look at our [Post-Install Checklist](https://github.com/PTMagicians/PT-Magic/wiki/Post-Install-Checklist) and [FAQ](https://github.com/Legedric/ptmagic/wiki/FAQ-and-Tips).
### Automate startup with pm2
1. Install npm and pm2
> sudo apt-get install nodejs
> sudo apt-get install npm
> sudo npm install pm2 -g
2. 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": "don't",
> "exec_mode": "fork",
> "autorestart": true
> }]
>}
3. From your ProfitTrailer Magic directory, start up your files using pm2
> pm2 start pm2-PTM-core.json
> pm2 start pm2-PTM-monitor.json
4. Automate startup
> pm2 save
> pm2 startup