Deploying Software on Linux via PM2 Guide @ Linux Guide:¶
Note
PM2 only works with py (Python) and js (Javascript)!
Install Node.js and NPM:¶
For Ubuntu/Debian-based systems:
| Bash | |
|---|---|
| Bash | |
|---|---|
| Bash | |
|---|---|
How to install PM2?¶
| Bash | |
|---|---|
OR:
| Bash | |
|---|---|
Starting Up:¶
**Ensure you are in the right directory when doing this command*
| Bash | |
|---|---|
You can add any of the following optional arguments to the start command:
Python Discord Bot Guide:¶
A simple guide on how to deploy a Python Discord Bot 24/7 with PM2.
- Transfer the Bot's Source Code into a new folder named
discord-bot. Use FileZilla (Use Port Number22) for file transfers between your PC/Laptop and your Bot's server.- You can overwrite files but not folders.
- Now use Putty to access your Bot's server's command line and do the rest of the steps below.
- Use Port Number
22and "SSH" as your Connection Type.
- Use Port Number
- Enable Virtual Environments and Activate it.
- First
cdto the Bot's source code's Folder. Example:cd discord-bot - Then do the following commands in the Terminal: (This is to avoid Package Installation issues and more)
python3 -m venv .venvsource .venv/bin/activate
- First
- Install all the required packages. To do this please do the command below in the terminal/command-line.
Bash - Install Node.JS
- Install PM2
- Do:
Your bot should now be online. Please note PM2 will say "Online" even if your code has encountered syntax errors or etc.
Bash