Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux_guide [2018/09/30 22:54]
sgtbatten
linux_guide [2019/06/16 18:22] (current)
taniman
Line 1: Line 1:
-===== Linux Setup Guide ===== +/* 
- +This is a hidden comment area - don't delete 
-This guide will assist you getting ProfitTrailer running on an Ubuntu Server. The process will be roughly the same for other Linux versions. +This page is also a slide - be careful with markup, and test both the page AND the slide when editing 
- +*/ 
----- +~~REVEAL~~ 
- +====Linux Setup Guide==== 
-=== Contents === +In slideshow mode, use arrow keys or the navigation buttons at lower right of screen to move forward/​back.\\ 
- +\\ 
-  * [[linux_guide#​Connect to Linux]] +This guide will assist you getting ProfitTrailer running on an Ubuntu Server.\\ 
-  * [[linux_guide#​Installing Java (and other things)]] +The process will be roughly the same for other Linux versions.
-  * [[linux_guide#​Downloading ProfitTrailer]] +
-  * [[linux_guide#​Mandatory Settings]] +
-  * [[linux_guide#​Running ProfitTrailer]] +
-  * [[linux_guide#​Setup a Second Bot]] +
  
-----+====Contents==== 
 +  * Connect to Linux 
 +  * Installing Java (and other things) 
 +  * Downloading ProfitTrailer 
 +  * Mandatory Settings 
 +  * Running ProfitTrailer 
 +  * Setup a Second Bot
  
 ====Getting Started with ProfitTrailer on Linux==== ====Getting Started with ProfitTrailer on Linux====
 +First of all, note that running the bot 24/7 is not possible if you allow your PC to fall asleep or close a laptop as the bot will not run anymore. You may want to consider using a VPS instead of installing it on a dedicated computer.
  
-First of all, note that running the bot 24/7 is not possible if you allow your PC to fall asleep or close a laptop as the bot will not run anymore. You may want to consider using a VPS before installing it on a dedicated computer. +====1.Connect to Linux==== 
- +We need some software to connect from your home computer to the linux server.\\ 
----- +Use anything you are comfortable ​with however we suggest you download:
-===1. Connect to Linux=== +
- +
-We need some software to connect from your home computer to the linux server. Use anything you are compfortable ​with however we suggest you download: +
   * [[https://​winscp.net/​eng/​download.php|WinSCP]] on Windows or   * [[https://​winscp.net/​eng/​download.php|WinSCP]] on Windows or
   * [[https://​www.realvnc.com/​en/​connect/​download/​viewer/​|VNC Viewer]] on MAC.    * [[https://​www.realvnc.com/​en/​connect/​download/​viewer/​|VNC Viewer]] on MAC. 
 +---->>​
 In this guide we will use WinSCP. WinSCP allows you to connect to the server, FTP files, edit files and has PuTTY integrated into the app. So in english it can move files, edit files and also connect to the terminal in one nice little free app. In this guide we will use WinSCP. WinSCP allows you to connect to the server, FTP files, edit files and has PuTTY integrated into the app. So in english it can move files, edit files and also connect to the terminal in one nice little free app.
- +<---- 
-Your VPS provider will have given you access information:​ an IP Address, username and password. In our example, ​Westhost gave us root user, which is fine. Use this info to open a terminal window to your new VPS.  Here we open WinSCP and set up a new connection. +---->>​ 
- +Your VPS provider will have given you access information:​ an IP Address, username and password. In our example, ​we have a root user, which is fine. Use this info to open a terminal window to your new VPS.  Here we open WinSCP and set up a new connection. 
-Enter the Hostname (IP address), User name (root) and Password and click login. You may need to allow the connection and will be able to chose a name to save the connection as for future use. +<---- 
- +---->>​ 
-{{:ptwinscpui.png|}} +Enter the Hostname (IP address), User name (root) and Password and click login. You may need to allow the connection and will be able to chose a name to save the connection as for future use.\\ 
 +{{ptwinscpui.png?nolink}} 
 +<---- 
 +---->>​
 In WinSCP, click the terminal icon in the menu bar to get to a terminal: In WinSCP, click the terminal icon in the menu bar to get to a terminal:
- +{{winscp_folders.png?nolink}} 
-{{:​ptwinscpterm.png|}} +<---- 
- +---->>​ 
-We are now connected to the server. +We are now connected to the server.\\ 
-  +{{ptwinscpwindow.png?nolink}} 
-{{:ptwinscpwindow.png|}} +<---- 
- +---->>​ 
- +====2. Installing Java (and other things)==== 
-===2. Installing Java (and other things) === +We need to make a directory for ProfitTrailer. Use the cd command to change to the root directory of your choice. I like to drop my bots into the /var/opt folder 
- +<---- 
-We need to make a directory for ProfitTrailer. Use the cd command to change to the root directory of your choice. I like to drop my bots into the /var/opt folder: +---->>​ 
- +Enter the following commands one line at a time:\\ 
-Enter the following commands one line at a time: +<​code>​cd .. 
-            cd .. +cd /var/opt 
-            cd /var/opt +mkdir pt 
-            mkdir pt +cd pt</​code>​ 
-            cd pt +<---- 
-  +---->>​ 
-You should now be inside a folder called pt in your /var/opt path +You should now be inside a folder called pt in your /var/opt path\\ 
-The prompt will look similar to this: +The prompt will look similar to this:\\ 
-             root@proxybot:/​var/​opt/​pt#​ +root@profittrailer:/​var/​opt/​pt#​ 
-  +<---- 
-Run an update: +---->>​ 
-  sudo apt-get update +Run an update:\\ 
- +<​code>​sudo apt-get update</​code>​\\ 
-Install Java 8: +\\ 
-            sudo apt-get install openjdk-8-jdk +Install Java 8:\\ 
-             +<​code>​sudo apt-get install openjdk-8-jdk<​/code>\\
-<WRAP center round important 60%>+
 Be advised: You need JAVA 8. Version 9 or 10 are **not** supported. Be advised: You need JAVA 8. Version 9 or 10 are **not** supported.
-</WRAP> +<---- 
- +---->
- +Install Nodejs and create a symlink ​from the /nodejs to /node folder:\\ 
-Install Nodejs and create a simlink ​from the /nodejs to /node folder: +<​code>​curl -sL https://​deb.nodesource.com/​setup_10.x | sudo -E bash - 
-            curl -sL https://​deb.nodesource.com/​setup_10.x | sudo -E bash - +sudo apt-get install -y nodejs
-            sudo apt-get install -y nodejs +
-            sudo ln -s /​usr/​bin/​nodejs /​usr/​bin/​node +
- +
-<WRAP center round important 60%> +
-Recently new installs have had issues with pm2 not starting correctly. Update Node using the above commands if you have issues +
-</​WRAP>​ +
-             +
- +
-install npm and use npm to install pm2:   +
-            npm may already be installed and you will receive dependencies errors. skip to pm2 install +
-            sudo apt-get install npm +
-            sudo npm install pm2@latest -g+
  
 +sudo ln -s /​usr/​bin/​nodejs /​usr/​bin/​node
 +[this is optional and may not be needed]</​code>​\\
 +<----
 +---->>​
 +Recently new installs have had issues with pm2 not starting correctly. Update Node using the previous commands if you have issues
 +<----
 +---->>​
 +Install npm and use npm to install pm2:\\
 +npm may already be installed and if so you will receive dependencies errors. skip to pm2 install:\\
 +<​code>​sudo apt-get install npm
 +sudo npm install pm2@latest -g</​code>​
 +<----
 +---->>​
 pm2 is a process manager – it lets you run the bot in the background, and has features to autostart, log-rotation and much more. You do not HAVE to use pm2, but we like it, especially from running multiple bots. pm2 is a process manager – it lets you run the bot in the background, and has features to autostart, log-rotation and much more. You do not HAVE to use pm2, but we like it, especially from running multiple bots.
 http://​pm2.keymetrics.io/​docs/​usage/​quick-start/​ http://​pm2.keymetrics.io/​docs/​usage/​quick-start/​
-  +<---- 
-At this point you have all the apps and tools you need to run the Profit Trailer. +---->>​ 
-  * Java to run the jar +At this point you have all the apps and tools you need to run the Profit Trailer.\\ 
-  * Nodejs to run pm2+  * Java to run the jar\\ 
 +  * Nodejs to run pm2\\
   * Pm2 to manage your bot process, log windows and logs   * Pm2 to manage your bot process, log windows and logs
- +<---- 
 +---->>​
 Type ''​pm2''​ at your prompt and you should get a list of pm2 commands. This will verify everything is running as expected. Type ''​pm2''​ at your prompt and you should get a list of pm2 commands. This will verify everything is running as expected.
- +<---- 
----- +---->> 
- +====3. Downloading ProfitTrailer====
-===3. Downloading ProfitTrailer=== +
 I like to download the bot to my local machine, edit the configs and then upload everything to the VPS at one time. I’ll show you how I do that. If you are familiar with Linux, you can certainly download and unzip the bot directly to your working folder. I like to download the bot to my local machine, edit the configs and then upload everything to the VPS at one time. I’ll show you how I do that. If you are familiar with Linux, you can certainly download and unzip the bot directly to your working folder.
-  +<---- 
-Go to this link:​ https://​github.com/​taniman/​profit-trailer/​releases.\\ +---->>​ 
-Download the latest release. \\ +Go to this link: https://​github.com/​taniman/​profit-trailer/​releases.\\ 
-Right click on the zip and select Extract All.  +Download the latest release.\\ 
- +Right click on the zip and select Extract All.\\ 
-{{::unzip.png?​nolink|}} +{{unzip.png?​nolink}} 
- +<---- 
-Choose a location to extract to, for example on the desktop. +---->>​ 
- +Choose a location to extract to, for example on the desktop.\\ 
-{{::windows_unzip_to_desktop.png?​nolink|}} +{{windows_unzip_to_desktop.png?​nolink}} 
- +<---- 
-You should have something similar to: +---->>​ 
- +You should have something similar to:\\ 
-{{::v2_folder.png?​nolink|}} +{{v2_folder.png?​nolink}} 
- +<---- 
- +---->> 
----- +====4. Configuring ProfitTrailer==== 
-===4. Configuring ProfitTrailer=== +Open WinSCP, and connect to your VPS if not already.\\
- +
-Open WinSCP, and connect to your VPS if not already. +
- +
 Select the “Open directory/​bookmark” icon and type in /var/opt/pt Select the “Open directory/​bookmark” icon and type in /var/opt/pt
- +<---- 
 +---->>​
 This should bring you to your pt folder:\\ This should bring you to your pt folder:\\
-{{:ptwinvpsptfolder.png|}} +{{ptwinvpsptfolder.png?nolink}} 
-\\ +<---- 
-\\+---->>​
 In the left hand window of WinSCP, find your new PT folder, the one you just unzipped from the download.\\ In the left hand window of WinSCP, find your new PT folder, the one you just unzipped from the download.\\
-Things should look like this:  +Things should look like this:\\ 
- +{{winscp_folders.png?​nolink}} 
-{{::winscp_folders.png?​nolink|}} +<---- 
- +---->>​
-\\ +
-\\+
 Simply select and drag all of the files from the left window to the right window.\\ Simply select and drag all of the files from the left window to the right window.\\
-{{::winscp_copy.png?​nolink|}} +{{winscp_copy.png?​nolink}} 
- +<---- 
-You now have the PT files on your VPS, and are ready to start editing configs. +---->>​ 
 +You now have the PT files on your VPS, and are ready to start editing configs.\\
 You can double-click on a file in WinSCP to edit that file (left and right panels). The bot will be using the files on the right panel, in the /var/opt/pt folder. You can double-click on a file in WinSCP to edit that file (left and right panels). The bot will be using the files on the right panel, in the /var/opt/pt folder.
- +<---- 
 +---->>​
 At this point, you can minimize WinSCP and go back to your terminal window (or click on the terminal icon to connect again) At this point, you can minimize WinSCP and go back to your terminal window (or click on the terminal icon to connect again)
- +<---- 
----- +---->> 
-=== 5. Mandatory Settings === +====5. Mandatory Settings==== 
- +Now we can proceed to setup the [[https://​wiki.profittrailer.com/​doku.php?​id=mandatory_settings|Mandatory Settings]] before attempting to run the bot. 
-Now we can proceed to setup the [[mandatory_settings|Mandatory Settings]] before attempting to run the bot. +  * This guide only includes an example application properties file, so please check the other parts of the wiki for settings, before you go ahead and run the bot on random settings without knowing what they do.  
-  * This guide doesn’t include configuring your settings, so please check the other parts of the wiki for that, before you go ahead and run the bot on random settingswithout knowing what they do.  +<---- 
- +---->> 
----- +{{ app-properties.mp4?​640x480&​app-prop-preview.png |Application Properties Video Guide}} 
-===6. Running ProfitTrailer=== +<---- 
-Now for the fun part. To run your bot, you first navigate to your pt folder +---->>​ 
- +====6. Running ProfitTrailer==== 
-  ​cd /​var/​opt/​pt +Now for the fun part. To run your bot, you first navigate to your pt folder\\ 
- +<​code>​cd /var/opt/pt</​code>​\\ 
-Change the permission on the JAR file so it will execute correctly +\\ 
-  chmod +x ProfitTrailer.jar +Change the permission on the JAR file so it will execute correctly\\ 
- +<​code>​chmod +x ProfitTrailer.jar</​code>​ 
-Start the bot using pm2:   ​ +<---- 
-  pm2 start pm2-ProfitTrailer.json +---->>​ 
 +Start the bot using pm2:\\ 
 +<​code>​pm2 start pm2-ProfitTrailer.json</​code>​\\
 {{:​ptwinvpspm2.png|}} {{:​ptwinvpspm2.png|}}
- +<---- 
-At this point, the bot is running. To see the live log scrolling by, type pm2 log 0. You use CTRL-C to get out of the window.+---->>​ 
 +At this point, the bot is running. To see the live log scrolling by, type pm2 log 0. You use CTRL-C to get out of the window.\\
   pm2 log 0          See log live   pm2 log 0          See log live
   pm2 stop 0        Stop the bot   pm2 stop 0        Stop the bot
   pm2 reload 0   ​ reload and restart the bot   pm2 reload 0   ​ reload and restart the bot
 +<---- 
 +---->>​
 Text logs are maintained by pm2 and are located at /root/.pm2/ (for my root account access) Text logs are maintained by pm2 and are located at /root/.pm2/ (for my root account access)
- +<---- 
-Your ProfitTrailer bot is now up and running. Congratulations!  +---->> 
- +Run a save and startup command. ​After this is complete, PM2 will restart your bot if you restart the server. ​ Run this command again if you change your app, or add a second bot.\\
-**Now go to http://​localhost:​8081 if it did not open automatically.** (adjust port if you have used a different one) +
- +
-When you open the GUI for the first time you will be asked to set a password. You will also need to enter your [[application.properties#​default_api_key]] to confirm you are the owner. +
- +
-{{:​set_admin_password.png?​nolink|}} +
- +
-If successful you will then be asked to Login. +
- +
-{{::​login.png?​nolink|}} +
- +
-Finally you will be presented with the Config Load screen. There are three methods for choosing your first configuration:​ +
- +
-  * **Public** ​Choose from our database of public configs and copy it to your bot giving it a unique name. +
-  * **Saved** ​Choose from one of your own configs that you have already created in the past. +
-  * **Import** ​Choose a name and import a config from your ProfitTrailer initialization folder. +
- +
-{{::​initial_settings_load.png?​nolink|}} +
- +
-Finally, run a save and startup command. ​Ater this is complete, PM2 will restart your bot if you restart the server. ​ Run this command again if you change your app, or add a second bot.+
  pm2 save  pm2 save
  pm2 startup  pm2 startup
- +<---- 
-To run Profit Trailer without Pm2 you can still ececute ​the same java command as any other operating system. +---->>​ 
- +To run Profit Trailer without Pm2 you can still execute ​the same java command as any other operating system.\\ 
-<file java> +<code>java -Djava.net.preferIPv4Stack=true -Dsun.stdout.encoding=UTF-8 ​-Dio.netty.allocator.numDirectArenas=0 -Djdk.nio.maxCachedBufferSize=262144 ​-XX:+UseSerialGC -XX:​+UseStringDeduplication -Xms64m ​-Xmx512m -XX:​CompressedClassSpaceSize=300m -XX:​MaxMetaspaceSize=128m ​-jar ProfitTrailer.jar</​code>​ 
-java -Djava.net.preferIPv4Stack=true -Dsun.stdout.encoding=UTF-8 -XX:+UseConcMarkSweepGC ​-Xmx512m -Xms512m ​-jar ProfitTrailer.jar +<---- 
-</file+---->>​ 
- +Your ProfitTrailer bot is now up and running. Congratulations!\\ 
----- +**Now go to http://​localhost:​8081 if it did not open automatically.** (adjust port if you have used a different one) 
- +<---- 
-===7. Setup a Second bot===+---->
 +When you open the GUI for the first time you will be asked to set a password. You will also need to enter your default_api_key to confirm you are the owner.\\ 
 +{{set_admin_password.png?​nolink}} 
 +<---- 
 +---->>​ 
 +If successful you will then be asked to Login.\\ 
 +{{login.png?​nolink}} 
 +<---- 
 +---->>​ 
 +Finally you will be see the Config Load screen.\\ 
 +  * Public - Choose from our database of public configs and copy it to your bot giving it a unique name.\\ 
 +  * Saved - Choose from one of your own configs that you have already created in the past.\\ 
 +{{initial_settings_load.png?​nolink}} 
 +<---- 
 +---->>​ 
 +====7. Setup a Second bot====
 Time to go bigger? Running a second bot is fairly straightforward. Time to go bigger? Running a second bot is fairly straightforward.
- +<---- 
-Make a second folder in your /var/opt/ folder, maybe pt2 +---->>​ 
 +Make a second folder in your /var/opt/ folder, maybe pt2\\
   /​var/​opt/​pt2   /​var/​opt/​pt2
- 
 Upload a copy of your Profit Bot to this folder. Upload a copy of your Profit Bot to this folder.
- +<---- 
-Edit the application.properties file and change the port number - I increment them by 1 +---->>​ 
- +Edit the application.properties file and change the port number - I increment them by 1\\ 
-(If these variables do not exist, add them) +(If these variables do not exist, add them)\\ 
- +In /​var/​opt/​pt/​application.properties\\
-In /​var/​opt/​pt/​application.properties+
   server.port = 8081   server.port = 8081
- +In /​var/​op/​pt2/​application.properties\\
-In /​var/​op/​pt2/​application.properties+
   server.port = 8082   server.port = 8082
- +<---- 
- +---->>​ 
----- +====8. Running the second instance with pm2==== 
- +You will need to edit /​var/​opt/​pt/​pm2-start.json in order to change the Application name. Pm2 requires unique application names. I like to edit all of my start jsons to be descriptive of the bot:\\
-===8. Running the second instance with pm2=== +
-You will need to edit /​var/​opt/​pt/​pm2-start.json in order to change the Application name. Pm2 requires unique application names. I like to edit all of my start jsons to be descriptive of the bot: +
 {{::​pm2.png?​nolink|}} {{::​pm2.png?​nolink|}}
- +<---- 
-Just start the second bot the same way you started the first: +---->>​ 
-pm2 start pm2-start.json+Just start the second bot the same way you started the first.\\ 
 +Navigate to the 2nd bot folder in the command line, then type:\\ 
 +pm2 start pm2-ProfitTrailer.json\\
 This will display PT Polo as the app name in the pm2 list. This will display PT Polo as the app name in the pm2 list.
-~~DISCUSSION~~+<---- 
 +---->>​ 
 +This concludes the ProfitTrailer Linux Setup Guide 
 +<----
  • linux_guide.1538348073.txt.gz
  • Last modified: 9 months ago
  • by sgtbatten