Pandabot/prepare_centos9.sh

32 lines
1.3 KiB
Bash
Executable file

[ `id -u` -ne 0 ] && echo "ERR: must be run as: root" && exit 1
[ ! -f /etc/centos-release ] && echo "ERR: works only on centos" && exit 1
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm -y
dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm -y
dnf module install php:remi-8.3 -y
yum install net-tools postgresql postgresql-server httpd php-fpm -y
yum install php-pecl-yaml php-pgsql php-pdo -y
/usr/bin/postgresql-setup --initdb
cd /var/lib/pgsql/data
cat pg_hba.conf | sed 's|host all all 127.0.0.1/32 ident|host all all 0.0.0.0/0 trust|g' > pg_hba.conf1
cp pg_hba.conf1 pg_hba.conf
rm -rf pg_hba.conf1
systemctl restart postgresql
su - postgres -c 'echo "CREATE DATABASE pandabot;" | psql'
printf "\n------------------------- --- -- - -\n"
echo "edit conf/pandabot.conf && conf/channels.conf"
echo "dbname: pandabot"
echo "dbhost: `ip -br address | grep -iwv lo | awk '{print $3}' | awk -F / '{print $1}'`"
echo "dbport: 5432"
echo "dbuser: postgres"
echo "dbpass: false"
printf "\n"
echo "setup tg session with ./bot.sh setuptg"
echo "start bot with ./bot.sh start"
echo "stop bot with ./bot.sh stop"
echo "------------------------- --- -- - -"