Summary: A Bash shell script that installs a working wiki in seconds
Version: 2016-09-30
Prerequisites: PmWiki 2.x
Status: Beta
Maintainer: HaganFox
Categories: CC0
Users: (view? / edit)
Discussion: InstaWiki-Talk?

Questions answered by this recipe

How can I install PmWiki in seconds using a shell script?


Install PmWiki in seconds using a shell script.

This script

  1. Installs PmWiki
  2. Creates writable wiki.d/ and uploads/ directories.

At that point the wiki is ready to use. The config.php file is a modified version of sample-config.php with URLs shortened and uploads enabled.

The script downloads PmWiki (if it's not already downloaded), unpacks the archive, renames the directory, then downloads InstaWiki-latest.tar.gzΔ and installs index.php and local/config.php.

Then the script sets 2777 permissions, retrieves the home page (without saving it), and sets 0777 permissions.

The wiki, once installed, is a default configuration with an index.php file and The configuration changes are:

  • Automatic semi-clean URLs (with pmwiki.php removed)
  • Uploads are enabled by default.
    • Max upload size is set to 1MB.
    • A server-writable uploads/ directory is created automatically.


Save this as a shell script or download the .txt versionΔ from the command line with

dir="wiki"   # name of the wiki's directory that will be created
ver="2.2.91"   # pmwiki version - see
url="http://localhost/"   # url for the directory where this script is
if [ -e $dir ] ; then
  echo "$dir exists"; exit
if [ ! -f pmwiki-$ver.tgz ] ; then
tar -zxvf pmwiki-$ver.tgz
mv pmwiki-$ver $dir
cd $dir/local/
tar -zxvf InstaWiki-latest.tar.gz -C ../
chmod 2777 ../   # ../ is the wiki's main/ directory
wget -O- $url$dir/ >/dev/null   # retrieve the page
chmod 0775 ../
chmod g-s ../


Set the directory name, PmWiki version, and URL.


  1. Download the scriptΔ and rename it to or copy-n-paste the script text into a script.
  2. Make sure it's in a directory that matches a URL (see below).
  3. Set the settings.
    1. directory name
    2. version of PmWiki
    3. URL that points to the directory where the script is run from, ending in a / because it's a directory.
  4. Run the script. (bash ./


To disable uploads after the wiki is installed,

  1. comment out the line that starts with $HandleAuth['upload'].
  2. delete the uploads/ directory.

Change log / Release notes

2016-09-30 - Initial release

See also




See discussion at InstaWiki-Talk?

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.