In no means is this guide optimized or the only way for setup, I just run it this way
sudo apt update && sudo apt upgrade && sudo apt -y install gnupg2 wget vim git gcc python3-dev build-essential python3-venv libpq-dev psycopg2-binary
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt update && sudo apt upgrade && sudo apt -y install npm nodejs
npm install pm2@latest -g
If the above command gives an error
sudo mkdir /usr/local/lib/node_modules
sudo chown -R $USER /usr/local/lib/node_modules
pm2 startup
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt -y update
sudo apt -y install postgresql-14
sudo su - postgres
createuser -P -s -e $PGUSER
Then enter a pass when prompted and remeber it
If it shows that the pass starts with SCRAM then do the following
Look for Authentication section then password_encryption and set it to md5 (it was scram-sha-256) and uncomment the line if commented
sudo vim /etc/postgresql/14/master/postgresql.conf
Look for the scram and replace them by md5
sudo vim /etc/postgresql/13/master/pg_hba.conf
psql
ALTER USER $PGUSER WITH PASSWORD 'NEW_PASSWORD_HERE';
ctrl + d
createdb -O $PGUSER fizi
database url will be postgresql://$PGUSER:$PASS@localhost:5432/fizi
replace $PASS
and $PGUSER
with the ones you chose
pg_dump $REMOTE_URL --format=tar > database.tar
pg_restore -p 5432 -h localhost -U $PGUSER -d fizi --no-owner --no-privileges database.tar
cd && git clone https://github.com/ItsLuuke/ProjectFizilionFork.git && cd ProjectFizilionFork
cp sample_config.env config.env
now edit the config (vim config.env or nano config.env) and add the vars
python3 -m venv venv
source venv/bin/activate
python3 -m pip install -r requirements.txt
deactivate
cat > run.sh << EOF
#!/bin/bash
source venv/bin/activate
python3 -m userbot
EOF
sudo chmod +x run.sh
./run.sh
If there is error and the bot didnt start correctly, then fix then before continuing to the next step
Strat the bot with pm2
pm2 start run.sh --name fizi
pm2 save
pm2 start fizi
pm2 stop fizi
pm2 restart fizi
pm2 logs fizi --lines 100 #or how many lines to check