B870 - instalace SQLtutor

Z GeoWikiCZ

Obecné poznámky viz SQLtutor - instalace.

Založení databáze

Pod uživatelem root updatujeme dpkg repository

apt-get update 
apt-get upgrade 

a spustíme skript

./instalace-sqltutor-b870.sh
#!/bin/bash
#
#   apt-get -y install apache2
#   apt-get -y install libpqxx-2.6.8 libpqxx-dev

cat > tmp.b870-sqltutor <<EOF
dropdb sqlquiz
dropuser wwwquiz
dropuser cepek

createuser -D -R -S cepek
createdb sqlquiz -O cepek
createuser -D -R -S wwwquiz
psql -c "ALTER USER wwwquiz WITH PASSWORD 'xxxxxx';"
psql -c "CREATE LANGUAGE plpgsql;"
EOF

su -l postgres < tmp.b870-sqltutor
rm -f tmp.b870-sqltutor


chmod go= /home/pytel
chmod go= /home/cepek

rm -rf /home/cepek/install-sqltutor
mkdir  /home/cepek/install-sqltutor
(cd /home/cepek/install-sqltutor && cvs -d:pserver:anonymous@cvs.sv.gnu.org:/sources/sqltutor co sqltutor && cd sqltutor/sqltutor && ./configure && make )

cat > /home/cepek/install-sqltutor/install-sqltutor.sh <<EOF
#!/bin/bash
#
DBNAME=sqlquiz
DBUSER=wwwquiz
PASSWD=xxxxxx


# rm -rf sqltutor
# cvs -d:pserver:anonymous@cvs.sv.gnu.org:/sources/sqltutor co sqltutor

cd sqltutor/sqltutor

rm -f settings.cpp
cvs update -dPA

sed -i /^T\ SQLtutor::db_connection/s/sqlquiz/\$DBNAME/ settings.cpp
sed -i /^T\ SQLtutor::db_connection/s/wwwquiz/\$DBUSER/ settings.cpp
sed -i /^T\ SQLtutor::db_connection/s/krok/\$PASSWD/    settings.cpp

make && cp -v sqltutor /usr/lib/cgi-bin/sqltutor
EOF

chown -R cepek:cepek /home/cepek/install-sqltutor
chmod +x /home/cepek/install-sqltutor/install-sqltutor.sh

rm -rf /usr/lib/cgi-bin/sqltutor
mkdir  /usr/lib/cgi-bin/sqltutor
chown -R cepek:cepek /usr/lib/cgi-bin/sqltutor

cp -av /home/cepek/install-sqltutor/sqltutor/sqltutor/sqltutor /usr/lib/cgi-bin/sqltutor

cat > /tmp/tmp-sqltutor <<EOF
cd install-sqltutor
bash install-sqltutor.sh
cd sqltutor/sqlquiz/cs/gi_ctu
make
EOF

su - cepek < /tmp/tmp-sqltutor