Jump to: navigation, search

Dev/Replicating whonix.org

< Dev


Installation[edit]

(Iceweasel 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 iceweasel 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 iceweasel.

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

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, 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's /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.

kdesudo kwrite /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:

kdesudo kwrite /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 and/or http://127.0.0.1/wiki/Main_Page.

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.

kdesudo kwrite /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 iceweasel.

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


Random News:

Did you contribute to Whonix? Feel free to add your name and what you did to the Whonix Authorship page.


Impressum | Datenschutz | Haftungsausschluss

https | (forcing) onion
Share: Twitter | Facebook | Google+
This is a wiki. Want to improve this page? Help welcome, volunteer contributions are happily considered! See Conditions for Contributions to Whonix, then Edit! IP addresses are scrubbed, but editing over Tor is recommended. Edits are held for moderation. Whonix (g+) is a licensee of the Open Invention Network. Unless otherwise noted above, content of this page is copyrighted and licensed under the same Free (as in speech) license as Whonix itself.