SELF HOST

HOW TO HOST CATUSERBOT ON YOUR OWN?

1. First of all, update and upgrade apt :

sudo apt update && sudo apt upgrade -y

2. And then install the required apt packages:

sudo apt install --no-install-recommends -y curl git libffi-dev libjpeg-dev libwebp-dev python3-lxml python3-psycopg2 libpq-dev libcurl4-openssl-dev libxml2-dev libxslt1-dev python3-pip python3-sqlalchemy openssl wget python3 python3-dev libreadline-dev libyaml-dev gcc zlib1g ffmpeg libssl-dev libgconf-2-4 libxi6 unzip libopus0 libopus-dev python3-venv libmagickwand-dev pv tree mediainfo nano

a) If you wanna use VC (voice-call) related features and plugins, follow this step (else skip to next):

curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && apt-get install -y nodejs

b) If you wanna use local database then follow this steps else skip to step 8

Install requirements for this by

sudo apt install postgresql postgresql-contrib

3. Change the user to postgres to change the default ident password:

sudo su - postgres

4. And then open the PostgreSQL shell:

psql

5. Set any password you prefer, by running the below SQL:

ALTER USER postgres WITH PASSWORD 'yourpasswordhere';

6. Create a database:

CREATE DATABASE catuserbot;

7. Get out of the PostgreSQL shell:

\q

8. And go back to your user:

exit

Now, the DB_URI will be:

postgresql://postgres:yourpasswordhere@localhost:5432/catuserbot

or use elephantsql if you wanna use that

9. Clone the repository:

git clone https://github.com/TgCatUB/catuserbot

10. Change dir to the cloned folder:

cd catuserbot

11. Create your config.py.

by renaming the exampleconfig.py

mv exampleconfig.py config.py

you can get string session by running python3 stringsetup.py

before running that install telethon by pip3 install git+https://github.com/jisan09/Telethon

12. Create a new screen:

Either tmux or screen

for screen:

sudo apt install screen

screen -S catuserbot

for tmux:

sudo apt install tmux

tmux

13. And a virtual environment:

virtualenv venv

14. Activate the virtual environment you've just created:

source venv/bin/activate

15. And install the Python requirements:

pip3 install -r requirements.txt

16. Finally, run the userbot:

python3 -m userbot

17. And get out of your screen

by pressing CTRL+A and after that CTRL+D. (if you used screen)

or

CTRL+B and then D (if you use tmux)

Last updated