Windows 10 Local Wiki Import: Difference between revisions

From CompleteNoobs
Jump to navigation Jump to search
No edit summary
 
(4 intermediate revisions by one other user not shown)
Line 9: Line 9:
Video demo:
Video demo:
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
{{#evu:https://www.youtube.com/watch?v=8ECoY94IEHM
<youtube>8ECoY94IEHM</youtube>
|alignment=inline
}}
</div>
</div>
</div>
</div>
Line 25: Line 23:
Video demo:
Video demo:
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
{{#evu:https://www.youtube.com/watch?v=61Njpy8diBI
<youtube>61Njpy8diBI</youtube>
|alignment=inline
}}
</div>
</div>
</div>
</div>
Line 38: Line 34:
Video demo:
Video demo:
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
{{#evu:https://www.youtube.com/watch?v=jOc6yjrhO2g
<youtube>jOc6yjrhO2g</youtube>
|alignment=inline
}}
</div>
</div>
</div>
</div>
Line 51: Line 45:
</blockquote>
</blockquote>
LXD does not work on the subsystem but we dont need it.<br \>
LXD does not work on the subsystem but we dont need it.<br \>
==Video demonstration==
<youtube>q4I8qwOUaLo</youtube>


===Find your Subsystem Ubuntu IP address on network===
===Find your Subsystem Ubuntu IP address on network===
Line 263: Line 260:
But thats why we have a Main_Index page.<br \>
But thats why we have a Main_Index page.<br \>
Edit the home page and add <nowiki>[[Main_Index | Wiki index]]</nowiki> that will take you to the wiki's main index page.
Edit the home page and add <nowiki>[[Main_Index | Wiki index]]</nowiki> that will take you to the wiki's main index page.
===Youtube extension===
* needed to view embedded videos
https://www.mediawiki.org/wiki/Extension:YouTube
<code>wget https://extdist.wmflabs.org/dist/extensions/YouTube-REL1_39-f272bb3.tar.gz</code>
<code>tar -xzf YouTube-REL1_39-f272bb3.tar.gz -C /var/www/html/mediawiki/extensions/</code>
* Append to '''LocalSettings.php'''
<code>wfLoadExtension( 'YouTube' );</code>
* On wiki page can now embed youtube videos
** https://www.youtube.com/watch?v=wB4gvSgYmfY
** After '''watch?v='''
** <nowiki><youtube>wB4gvSgYmfY</youtube></nowiki>
* Defaults '''width'''=640 pixels '''height'''=385 pixels
* Change defaults <nowiki><youtube width="800" height="400">wB4gvSgYmfY</youtube></nowiki>


==Restarting Windows==
==Restarting Windows==
Line 269: Line 285:
<code>sudo service apache2 start</code><br>
<code>sudo service apache2 start</code><br>
<code>sudo service mysql start</code><br>
<code>sudo service mysql start</code><br>
==Create Local Domain name shortcut to your local wiki==
==Create Local Domain name shortcut to your local wiki==


Line 280: Line 297:
Change the IP to your ubuntu subsystem ip and the Domain, you can change the domain name to anything you want.<br \>
Change the IP to your ubuntu subsystem ip and the Domain, you can change the domain name to anything you want.<br \>
You can now view your wiki on your browser by entering <b>mywiki.local</b> or whatever you want your local domain called.
You can now view your wiki on your browser by entering <b>mywiki.local</b> or whatever you want your local domain called.
==If Syntax highlighting not working==
Install <b>pygments</b><br>
<code>apt install python3-pygments</code><br>
Add to LocalSettings:<br>
<code>wfLoadExtension( 'SyntaxHighlight_GeSHi' );</code><br>

Latest revision as of 17:57, 4 May 2023

local wiki on win 10 2nd draft

Make sure Linux subsystem enabled on windows 10

Control Panel > Programs > Turn Windows features on or off Scroll down and make sure Windows Subsystem for Linux box is ticked

If it was unticked, you might should reboot/restart your computer after the subsystem installs.

Video demo:

Install Ubuntu from Microsoft store

Install the Ubuntu App from the store.
And launch it.

When you launch you will be prompted for a username and password:

Video demo:

To Reset Ubuntu

If you want to reset Ubuntu and start again.
In search bar goto Apps & features
Find Ubuntu 22.04.2 TLS and click Advanced options scroll down to Reset and click the Reset button.

Video demo:

Windows 10 subsystem notes

Interacting with snapd is not yet supported on Windows Subsystem for Linux. This command has been left available for documentation purposes only

LXD does not work on the subsystem but we dont need it.

Video demonstration

Find your Subsystem Ubuntu IP address on network

Get the ip for your linux on the subsystem win10.
ip route show default
Will return something like:

none default via 192.168.0.1 dev eth0 proto unspec metric 0


You are looking for your network interface, its after dev in my case it's eth0
Now to find the ip for that interface:
ip address

ip address will return something like this:

12: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 group default qlen 1
    link/ether 9c:b6:54:a5:a0:da
    inet 192.168.0.130/24 brd 192.168.0.255 scope global dynamic
       valid_lft 86178sec preferred_lft 86178sec
    inet6 fe80::55b2:e14f:3167:365d/64 scope link dynamic
       valid_lft forever preferred_lft forever
1: lo: <LOOPBACK,UP> mtu 1500 group default qlen 1
    link/loopback 00:00:00:00:00:00
    inet 127.0.0.1/8 brd 127.255.255.255 scope global dynamic
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host dynamic
       valid_lft forever preferred_lft forever
16: wifi0: <> mtu 1500 group default qlen 1
    link/ieee802.11 0c:8b:fd:77:97:d2
    inet 169.254.163.24/16 brd 169.254.255.255 scope global dynamic
       valid_lft forever preferred_lft forever
    inet6 fe80::fd1c:33d1:6cae:a318/64 scope link dynamic
       valid_lft forever preferred_lft forever
8: wifi1: <> mtu 1500 group default qlen 1
    link/ieee802.11 0c:8b:fd:77:97:d3
    inet 169.254.66.175/16 brd 169.254.255.255 scope global dynamic
       valid_lft forever preferred_lft forever
    inet6 fe80::c0e4:3ef8:4054:42af/64 scope link dynamic
       valid_lft forever preferred_lft forever
17: wifi2: <> mtu 1500 group default qlen 1
    link/ieee802.11 0e:8b:fd:77:97:d2
    inet 169.254.142.131/16 brd 169.254.255.255 scope global dynamic
       valid_lft forever preferred_lft forever
    inet6 fe80::5dbb:c7b1:c7f7:8e83/64 scope link dynamic
       valid_lft forever preferred_lft forever

Look for your interface, mine was eth0
2 lines down, you will see a line that starts with inet that contains you network address.
Mine was 192.168.0.130


Copy and Paste to the subsystem terminal

Right clicking in the ubuntu terminal will paste.
Highlighting text in the ubuntu terminal and right clicking will copy.

Install mediawiki

sudo apt update && sudo apt upgrade -y

sudo apt install apache2 mysql-server php php-mysql libapache2-mod-php php-xml php-mbstring php-intl -y
Does not seem to use systemd on win subsystem.
sudo service apache2 start
If you see error:

(92)Protocol not available: AH00076: Failed to enable ARP_TCP_DEFER_ACCEPT

Don't worry, it should still work. Check status of apache2.
sudo service apache2 status

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

tar -zxvf mediawiki-1.39.2.tar.gz

sudo 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:

To Avoid Error:

su: warning: cannot change directory to /nonexistent: No such file or directory

Fix with:
sudo usermod -d /var/lib/mysql/ mysql

sudo service mysql start
sudo mysql -u root
CREATE USER 'wiki'@'localhost';
CREATE DATABASE my_wiki;
use my_wiki;
GRANT ALL ON my_wiki.* TO 'wiki'@'localhost';
quit;

Syntax Database setup:

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

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

Config Apache2

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

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


Reload Apache2

sudo service apache2 restart

Visit webpage and carry on with normal basic wiki setup

Remember your IP address for your subsystem, Mine was 192.168.0.130, now enter that in a web browser.
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 Change to 127.0.0.1 to avoid error
Database name:wiki
Database table prefix (no hyphens): LEAVE BLANK
Database username:my_wiki
Database password: LEAVE BLANK

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.php to subsystem

Now i am sure there is a way to send this file to the linux subsystem.
But the only thing i remember and know right now is that i really dont like windows
So open the file LocalSettings.php with notepad and CTRL+A to select all and CTRL+c to copy.
Back on the linux subsystem.
sudo nano /var/www/html/mediawiki/LocalSettings.php
On windows 10 its right click to paste.
Once pasted CTRL+o (will prompt 'File Name to Write: /var/www/html/mediawiki/LocalSettings.php' press enter) and CTRL+x to exit.
Do not refresh your web-browser it will prompt you to download LocalSettings.php again, revisit the IP address from earlier 192.168.0.130. and well come to your wiki.
Now to import CompleteNoobs Wiki content from a xml dump.

Visit https://xml.completenoobs.com and select the latest xml dump, right click and select 'Copy link address' now back to the subsystem
wget https://xml.completenoobs.com/xmlDumps/20_03_23.Noobs/20_03_23.Noobs.xml
TIP:Type wget and then right click to paste the address

now to import the dump.
php /var/www/html/mediawiki/maintenance/importDump.php --conf /var/www/html/mediawiki/LocalSettings.php wikidump_28_07_2021-updated.xml

Not finished yet:
php /var/www/html/mediawiki/maintenance/rebuildrecentchanges.php
php /var/www/html/mediawiki/maintenance/initSiteStats.php
php /var/www/html/mediawiki/maintenance/rebuildall.php

and thats it, Everything apart from the Main_Page is imported.
But thats why we have a Main_Index page.
Edit the home page and add [[Main_Index | Wiki index]] that will take you to the wiki's main index page.


Youtube extension

  • needed to view embedded videos

https://www.mediawiki.org/wiki/Extension:YouTube

wget https://extdist.wmflabs.org/dist/extensions/YouTube-REL1_39-f272bb3.tar.gz

tar -xzf YouTube-REL1_39-f272bb3.tar.gz -C /var/www/html/mediawiki/extensions/

  • Append to LocalSettings.php

wfLoadExtension( 'YouTube' );

  • On wiki page can now embed youtube videos
  • Defaults width=640 pixels height=385 pixels
  • Change defaults <youtube width="800" height="400">wB4gvSgYmfY</youtube>

Restarting Windows

Restarting windows will fix the display bugs on the wiki.
You will need to open ubuntu and restart mysql and apache2.
sudo service apache2 start
sudo service mysql start

Create Local Domain name shortcut to your local wiki

On windows 10, open Notepad with Run as administrator and open the file C:\Windows\System32\drivers\etc\hosts (you will need to change "Text Documents (*.txt)" to "All Files" to see it.) And add the line at the bottom:

192.168.0.130    mywiki.local

192.168.0.130 is the ip of my ubuntu subsystem and mywiki.local is the domain name on browser i would like forwarded to the local wiki.
Change the IP to your ubuntu subsystem ip and the Domain, you can change the domain name to anything you want.
You can now view your wiki on your browser by entering mywiki.local or whatever you want your local domain called.


If Syntax highlighting not working

Install pygments
apt install python3-pygments

Add to LocalSettings:
wfLoadExtension( 'SyntaxHighlight_GeSHi' );