Ubuntu Local Wiki Import: Difference between revisions

From CompleteNoobs
Jump to navigation Jump to search
Line 151: Line 151:
<code>php /var/www/html/mediawiki/maintenance/rebuildall.php</code><br \>
<code>php /var/www/html/mediawiki/maintenance/rebuildall.php</code><br \>


===EmbedVideo===
In order to view the embedded video's you will need to install the <b>EmbedVideo</b> extension.<br>
If you do not, you will still be able to view the video address.<br>
https://www.mediawiki.org/wiki/Extension:EmbedVideo<br>
<code>apt install unzip</code><br>
<code>wget https://gitlab.com/hydrawiki/extensions/EmbedVideo/-/archive/v2.9.0/EmbedVideo-v2.9.0.zip</code><br>
<code>unzip EmbedVideo-v2.9.0.zip -d /var/www/html/mediawiki/extensions/</code><br>
<br>
<code>mv /var/www/html/mediawiki/extensions/EmbedVideo-v2.9.0 /var/www/html/mediawiki/extensions/EmbedVideo</code><br>
<br>
<code>$EDITOR /var/www/html/mediawiki/LocalSettings.php</code><br>
<pre>
#Embed Video
wfLoadExtension( 'EmbedVideo' );
</pre>


===Visit your local copy of CompleteNoobs===
===Visit your local copy of CompleteNoobs===

Revision as of 12:34, 11 March 2023

Tested on Ubuntu-Mate 20.04
Download CompleteNoobs wiki and Keep Private Copy you can edit as you wish on your own computer.

Download CompleteNoobs's XML dump

CompleteNoobs xml dump

Create a container

lxc launch ubuntu:20.04 localwiki
Push file conataining xml dump to container
lxc file push wiki-dump.xml localwiki/root/
Log/Chroot into container
lxc exec localwiki bash

update container and set to auto update

update container
apt update && apt upgrade -y
Auto updates
$EDITOR /etc/apt/apt.conf.d/50unattended-upgrades
Uncomment the line:

// "${distro_id}:${distro_codename}-updates";

to

"${distro_id}:${distro_codename}-updates";

Install mediawiki

apt install apache2 mysql-server php php-mysql libapache2-mod-php php-xml php-mbstring php-intl -y

wget https://releases.wikimedia.org/mediawiki/1.39/mediawiki-1.39.2.tar.gz

tar -zxvf mediawiki-1.39.2.tar.gz

mv mediawiki-1.39.2 /var/www/html/mediawiki

Create database

As this is just for your own computer on your own network, you can keep it super simple:
mysql -u root
CREATE USER 'u'@'localhost' IDENTIFIED BY 'passwd';
CREATE DATABASE db;
use db;
GRANT ALL ON db.* TO 'u'@'localhost';
quit;

Syntax Database setup:

Login to Mysql as user root: mysql -u $USER

CREATE USER '$USERNAME'@'localhost' IDENTIFIED BY '$PASSWORD';
CREATE DATABASE $DATABASE_NAME;
use $DATABASE_NAME;
GRANT ALL ON $DATABASE_NAME.* TO '$USER'@'localhost';

Config Apache2

$EDITOR /etc/apache2/sites-available/000-default.conf

<VirtualHost *:80>
        DocumentRoot /var/www/html/mediawiki
</VirtualHost>


Reload Apache2

systemctl restart apache2

Visit webpage and carry on with normal basic wiki setup

Use lxc list on host to get IP address for your container: mine is 10.3.45.40
With a web browser visit enter the ip in the address bar.
You will now find yourself on the mediawiki setup landing page.

MediaWiki 1.36.1 LocalSettings.php not found. Please complete the installation and download LocalSettings.php.

Click complete the installation

Language Page

Just pick a language mate

Welcome to MediaWiki!

read and click Continue

Connect to database - going to need the details from when you created the database.

Database host:localhost
Database name:db
Database table prefix (no hyphens): LEAVE BLANK
Database username:u
Database password:passwd

Database Settings

Database account for web access
[x]Use the same account as for installation
Leave ticked

Name

Name of wiki:LocalWiki
Project namespace:
[x]Same as the wiki name:
[ ]Project
[ ]Other (specify)
Administrator account Will be the admin account on the wiki.
CLICK I'm bored already, just install the wiki.

At the end you would of downloaded a file called LocalSettings.php
Now lets send it to the container from host.

Send LocalSettings to Container

From host:
lxc file push Downloads/LocalSettings.php localwiki/var/www/html/mediawiki/

restore xml dump

In container
php /var/www/html/mediawiki/maintenance/importDump.php --conf /var/www/html/mediawiki/LocalSettings.php /root/wiki-dump.xml

php /var/www/html/mediawiki/maintenance/rebuildrecentchanges.php
php /var/www/html/mediawiki/maintenance/initSiteStats.php
php /var/www/html/mediawiki/maintenance/rebuildall.php


EmbedVideo

In order to view the embedded video's you will need to install the EmbedVideo extension.
If you do not, you will still be able to view the video address.

https://www.mediawiki.org/wiki/Extension:EmbedVideo
apt install unzip
wget https://gitlab.com/hydrawiki/extensions/EmbedVideo/-/archive/v2.9.0/EmbedVideo-v2.9.0.zip
unzip EmbedVideo-v2.9.0.zip -d /var/www/html/mediawiki/extensions/

mv /var/www/html/mediawiki/extensions/EmbedVideo-v2.9.0 /var/www/html/mediawiki/extensions/EmbedVideo

$EDITOR /var/www/html/mediawiki/LocalSettings.php

#Embed Video
wfLoadExtension( 'EmbedVideo' );

Visit your local copy of CompleteNoobs

In Browser go to http://$YOUR_CONTAINERS_IP

Everything apart from index.php/Main_Page restored.
Edit main page to have link to main_index
[[Main_Index | wiki index]]
And thats why we have a Main_Index page.