LazyAdminMediaWiki

From JQuantLib

Jump to: navigation, search

This article explains how Mediawiki can be easily installed. Richard Gomes


Requirements: Lazy Admin: Quickly installing PostgreSQL on Debian Etch

You can easily install MediaWiki onto PostgreSQL simply running the script below.

#!/bin/bash -x

create_wikidb() {
  # create user to own wiki database
  su - postgres -c "createuser --no-superuser --no-createdb --no-createrole wikiuser"

  # create wiki database
  su - postgres -c "createdb --owner=wikiuser wikidb"

  # enable plpgsql on wiki database
  su - postgres -c "createlang plpgsql wikidb"
}


install_tsearch2() {
  # install TSearch2 on wikidb database
  su - postgres -c "psql -d wikidb " < /usr/share/postgresql/8.2/contrib/tsearch2.sql
}


update_locale() {
  # change the default locale on wiki database
  lang=`locale | fgrep LANG | sed -r -e 's/LANG=(.+)/\1/'`
  su - postgres -c "psql -d wikidb" << EOD
    update pg_ts_cfg set locale='${lang}' where ts_name='default' and prs_name='default';
    commit;
\q
EOD
}


grant_privileges() {
  su - postgres -c "psql -d wikidb" << EOD
    grant all privileges on database wikidb to wikiuser;
    grant select on table public.pg_ts_cfg    to wikiuser;
    grant select on table public.pg_ts_cfgmap to wikiuser;
    grant select on table public.pg_ts_dict   to wikiuser;
    grant select on table public.pg_ts_parser to wikiuser;
\q
EOD
}



create_wikidb
install_tsearch2
update_locale
grant_privileges

Richard Gomes 17:06, 26 January 2008 (UTC)