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 commang 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/13/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 cosmic
database url will be postgresql://$PGUSER:$PASS@localhost:5432/cosmic
replace $PASS
and $PGUSER
with the ones you chose
cd && git clone https://github.com/ItsLuuke/ProjectcosmiclionFork.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
bash bot.sh
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
Start the bot with pm2
pm2 start run.sh --name cosmic
pm2 save
pm2 start cosmic
pm2 stop cosmic
pm2 restart cosmic
pm2 logs cosmic --lines 100 #or how many lines to check