Actions

Dev/Replicating whonix.org

From Whonix

< Dev


Installation[edit]

(Firefox-ESR is required, because Tor Browser no longer supports visiting 127.0.0.1. Any other browser would work as well.)

(Due to no instructions available on how to get mediawiki's maintenance/install.php to work, we must do a normal install of mediawiki first. Then we upgrade it to replicate whonix.org.)

Open a terminal. As normal, not root user!

Get into your home folder.

cd ~

Install web software:

sudo apt-get install git apache2 libapache2-mod-removeip php5-mysql php5 libapache2-mod-php5 php-apc mysql-client mysql-server firefox-esr php5-dev liblua5.1-dev lua5.1 curl

You will be asked for a mysql root password. Remember it.

Get our wiki images and content database backup:

git clone --depth=1 https://github.com/WhonixBOT/WhonixWikiBackups.git

Get and install the mediawiki web app:

curl --tlsv1.2 --proto =https https://releases.wikimedia.org/mediawiki/1.26/mediawiki-1.26.2.tar.gz > mediawiki-1.26.2.tar.gz
tar -xvzf mediawiki-*.tar.gz
rm mediawiki-*.tar.gz
sudo mv mediawiki-* /var/www/wiki

Start Firefox-ESR.

Setup mediawiki. Go to http://127.0.0.1/wiki/mw-config/index.php [archive].

Use the following settings:

Database name: wiki
Datebase password: what you remembered above
No more questions.
Otherwise use the defaults.
Name of wiki: Whonix

Download LocalSettings.php, save as in your home folder as ~/LocalSettings.php.

sudo mv ~/LocalSettings.php /var/www/wiki/

Go to http://127.0.0.1/wiki [archive], see if you see a fresh wiki, log in, see if that works as well.

Move the dummy wiki out of the way:

## Maybe rm when this instructions are finished.
sudo mv /var/www /var/www_dummy

Replicate Whonix ™ /var/www folder from git:

sudo git clone --depth=1 https://github.com/Whonix/www.git /var/www

Create a file /etc/apache2/wikiSecrets.php.

lxsudo mousepad /etc/apache2/wikiSecrets.php

With the following content. Make sure you replace xxxxxx with your actual you remembered password. (You need to replace xxxxxx with your actual password 3 times, for wgDBpassword, wgSecretKey and wgUpgradeKey.)

<?php
## Database settings
$wgDBtype = "mysql";
$wgDBserver = "localhost";
$wgDBname = "wiki";
$wgDBuser = "root";
$wgDBpassword = "xxxxxx";

# MySQL specific settings
$wgDBprefix = "";

# MySQL table options to use during installation or update
$wgDBTableOptions = "ENGINE=InnoDB, DEFAULT CHARSET=binary";

# Experimental charset support for MySQL 5.0.
$wgDBmysql5 = false;

$wgSecretKey = "xxxxxx";

# Site upgrade key. Must be set to a string (default provided) to turn on the
# web installer while LocalSettings.php is in place
$wgUpgradeKey = "xxxxxx";

#CAPTCHA here

require_once( "$IP/extensions/ConfirmEdit/ConfirmEdit.php" );
require_once( "$IP/extensions/ConfirmEdit/QuestyCaptcha.php");
$wgCaptchaClass = 'QuestyCaptcha';
$arr = array (
        "type answerhere" => "answerhere",
);
foreach ( $arr as $key => $value ) {
        $wgCaptchaQuestions[] = array( 'question' => $key, 'answer' => $value );
}

Edit /etc/apache2/sites-enabled/000-default:

lxsudo mousepad /etc/apache2/sites-enabled/000-default

Insert the following at the end of the file, but before </VirtualHost>:

RewriteEngine On
RewriteRule ^/?wiki(/.*)?$ /w/index.php [QSA,L]
RewriteRule ^/?$ /w/index.php [QSA,L]

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^/?w/images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/w/thumb.php?f=$1&width=$2 [L,QSA,B]

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^/?w/images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/w/thumb.php?f=$1&width=$2&archived=1 [L,QSA,B]

Run:

sudo mkdir /var/www/w/cache

Your webserver must have read/write access to your /var/www folder. Run:

sudo chown --recursive www-data:www-data /var/www

Run:

sudo -u www-data php /var/www/wiki/maintenance/update.php --quick
sudo -u www-data php /var/www/wiki/maintenance/importImages.php ~/WhonixWikiBackups/mediafiles/
sudo -u www-data php /var/www/wiki/maintenance/importDump.php ~/WhonixWikiBackups/dumpContentCurrent.xml
sudo -u www-data php /var/www/wiki/maintenance/rebuildrecentchanges.php

Run:

sudo a2enmod rewrite
sudo a2enmod removeip

Run:

sudo service apache2 restart

You should now be able to visit http://127.0.0.1 [archive] and/or http://127.0.0.1/wiki/Main_Page [archive].

Debugging[edit]

Rewrites[edit]

Perhaps working:

Perhaps not working:

In that case, something is wrong with shorturl / rewrite.

Apache Error Log[edit]

tail -f /var/log/apache2/error.log

Mediawiki Debug Log[edit]

Run.

## Replace "user" with your actual operating system user name.
touch /home/user/wgdebuglog
chmod o+w /home/user/wgdebuglog
chmod g+w /home/user/wgdebuglog

Edit /var/www/wiki/LocalSettings.php.

lxsudo mousepad /var/www/wiki/LocalSettings.php

And add.

## Replace "user" with your actual operating system user name.
$wgDebugLogFile = "/home/user/wgdebuglog";

Watch the log while trying to access the wiki in Firefox-ESR.

## Replace "user" with your actual operating system user name.
tail -f /home/user/wgdebuglog

Alternative Backup[edit]

Maybe it would be simpler if we shared a mysql backup without passwords.

mediawiki irc channel:

mysqldump --ignore-table=wiki.user

although it would result in a broken database if you restore it



Follow: Twitter.png Facebook.png 1280px-Gab text logo.svg.png Rss.png Matrix logo.svg.png 1024px-Telegram 2019 Logo.svg.png Discourse logo.svg

Donate: Donate Bank Wire Paypal Bitcoin accepted here Monero accepted here Contriute

Whonix donate bitcoin.png Monero donate whonix.png

Share: Twitter | Facebook

Bored? Want to chat with other Whonix users? Join us in IRC [archive] chat (Webchat [archive]) or Telegram Chat [archive].

https [archive] | (forcing) onion [archive]

This is a wiki. Want to improve this page? Help is welcome and volunteer contributions are happily considered! Read, understand and agree to Conditions for Contributions to Whonix ™, then Edit! Edits are held for moderation.

Copyright (C) 2012 - 2019 ENCRYPTED SUPPORT LP. Whonix ™ is a trademark. Whonix ™ is a licensee [archive] of the Open Invention Network [archive]. Unless otherwise noted, the content of this page is copyrighted and licensed under the same Freedom Software license as Whonix ™ itself. (Why?)

Whonix ™ is a derivative of and not affiliated with Debian [archive]. Debian is a registered trademark [archive] owned by Software in the Public Interest, Inc [archive].

Whonix ™ is produced independently from the Tor® [archive] anonymity software and carries no guarantee from The Tor Project [archive] about quality, suitability or anything else.

By using our website, you acknowledge that you have read, understood and agreed to our Privacy Policy, Cookie Policy, Terms of Service, and E-Sign Consent. Whonix ™ is provided by ENCRYPTED SUPPORT LP. See Imprint.