How to host 24/7 discord bot on ubuntu VPS (2024)

How to host 24/7 discord bot on ubuntu VPS (2024)

PoprostuIzI

8 месяцев назад

1,384 Просмотров

How to host 24/7 discord bot on ubuntu VPS (2024)
Commands and instruction:

PREPARING SYSTEM

1. Own a ubuntu system vps
2. Log in (best as root user to avoid problems)

PREPARING ENVIRONMENT

3. Execute `apt-get update && apt-get upgrade`
3. Execute `curl -sL https://deb.nodesource.com/setup_17.x | sudo -E bash -`
3.1 More versions on https://github.com/nodesource/distributions
4. Execute `sudo apt-get install -y nodejs`
5. Check at the end of installation by using `node` - if that works, check `npm`

PREPARING SPACE FOR BOT

6. Make a directory for your bot
6.1 Execute `mkdir yourdirectoryname`
6.2 Go to your dir by `cd yourdirectoryname`

UPLOADING BOT

7. Upload your bot to the vps
7.1 You can use mediafire to do that
7.2 Upload your bot (in zip file) to mediafire
7.3 go to your bot download, right click download button and copy link
7.4 Execute `wget yourdownloadlink`
7.5 Delete Bot from mediafire to avoid code leak

PREPARING BOT FOR START

8. Always delete your node_modules (or rename it to keep a copy)
8.1 Execute `npm i` or just install your node packages again
8.2 Test your bot by executing `node yourbotmain.js` or `npm run start` if you set it up.
8.3 Test if it works on discord
8.4 If it works, turn it off by hitting `ctrl + C`

PREPARING BOT FOR 24/7 WORKING

9. Install pm2
9.1 Execute `sudo npm i -g pm2`
9.2 Execute `pm2` to check if it went succesful
10. In your bot directory
10.1 Execute `pm2 start --name=MyDiscordBot` ./yourbotmain.js`
10.2 To check logs execute `pm2 logs`
11. Test your bot on discord
12. If it works, you can go ahead and turn off the cmd

Тэги:

#bot #discord #host #24/7 #coding #javascript #python #vps #ubuntu #linux #virtual_private_server #cloudvps #cloud #dedicated_server #hosting #free #verification #discord.js #discord.js_bot #instruction #windows #apple #mac #debian #mysql #operation_system #os #CentOS #Fedora #nodejs #pm2 #22.04
Ссылки и html тэги не поддерживаются


Комментарии:

@Alejo-k8i
@Alejo-k8i - 20.06.2024 00:11

How did you turn off the screen?

Ответить
@cozy_annie
@cozy_annie - 16.07.2024 07:32

what if I dont have a system vps is there a work around?

Ответить
@cozy_annie
@cozy_annie - 16.07.2024 09:13

Also how do I change the bot status?

Ответить
@soggra7073
@soggra7073 - 01.09.2024 17:25

yo bro, which vps are you using?

Ответить
@IdK-er6rh
@IdK-er6rh - 02.09.2024 15:20

Cant see what youre typing

Ответить