B870 - instalace SQLtutor: Porovnání verzí

Z GeoWikiCZ
Skočit na navigaci Skočit na vyhledávání
Řádek 23: Řádek 23:
 
dropuser cepek
 
dropuser cepek
  
createdb sqlquiz
 
 
createuser -D -R -S cepek
 
createuser -D -R -S cepek
 +
createdb sqlquiz -O cepek
 
createuser -D -R -S wwwquiz
 
createuser -D -R -S wwwquiz
 
psql -c "ALTER USER wwwquiz WITH PASSWORD 'xxxxxx';"
 
psql -c "ALTER USER wwwquiz WITH PASSWORD 'xxxxxx';"

Verze z 15. 5. 2008, 17:34

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 apache
#   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

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