askanton

Размещени TELEGRAM бота на сервере Ubuntu

May 28th, 2020
1,501
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. Tutorial https://youtu.be/HOJsalRLnEQ
  2. sudo su
  3.  
  4. apt update
  5. apt install -y git build-essential libssl-dev libffi-dev python3-pip python3-dev python3-setuptools python3-venv
  6.  
  7. adduser newbot
  8. *************
  9.  
  10. whoami
  11. su - newbot
  12. whoami
  13.  
  14. git clone https://github.com/******/newrep
  15.  
  16. cd newrep/
  17. ls -lh
  18. nano newbot.py
  19.  
  20.  
  21. python3 -m venv .venv
  22. ls -lah
  23. cd
  24. source /home/newbot/newrep/.venv/bin/activate
  25. pip install -r /home/newbot/newrep/requirements.txt
  26.  
  27. /home/newbot/newrep/.venv/bin/python /home/newbot/newrep/newbot.py
  28.  
  29. exit
  30. su - user
  31. sudo su
  32. whoami
  33.  
  34. cd /etc/systemd/system/
  35.  
  36. nano newbot.service
  37.  
  38. [Unit]
  39. Description=My newbot
  40. After=network.target
  41.  
  42. [Service]
  43. User=newbot
  44. Group=newbot
  45.  
  46. WorkingDirectory=/home/newbot/newrep/
  47. Environment="PYTHONPATH=/home/newbot/newrep/"
  48. ExecStart=/home/newbot/newrep/.venv/bin/python /home/newbot/newrep/newbot.py
  49.  
  50. [Install]
  51. WantedBy=multi-user.target
  52.  
  53. sudo systemctl start newbot
  54. sudo systemctl status newbot
  55. sudo systemctl stop newbot
Add Comment
Please, Sign In to add comment