Windows 10 Local Wiki Import: Difference between revisions
No edit summary |
|||
(14 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
== local wiki on win 10 2nd draft== | |||
==Make sure Linux subsystem enabled on windows 10== | ==Make sure Linux subsystem enabled on windows 10== | ||
Line 4: | Line 5: | ||
If it was unticked, you might should reboot/restart your computer after the subsystem installs.<br \> | If it was unticked, you might should reboot/restart your computer after the subsystem installs.<br \> | ||
<div class="toccolours mw-collapsible mw-collapsed"> | |||
Video demo: | |||
<div class="mw-collapsible-content"> | |||
<youtube>8ECoY94IEHM</youtube> | |||
</div> | |||
</div> | |||
==Install Ubuntu from Microsoft store== | ==Install Ubuntu from Microsoft store== | ||
Line 12: | Line 20: | ||
When you launch you will be prompted for a username and password:<br \> | When you launch you will be prompted for a username and password:<br \> | ||
<div class="toccolours mw-collapsible mw-collapsed"> | |||
Video demo: | |||
<div class="mw-collapsible-content"> | |||
<youtube>61Njpy8diBI</youtube> | |||
</div> | |||
</div> | |||
==To Reset Ubuntu== | |||
If you want to reset Ubuntu and start again.<br> | |||
In search bar goto <b>Apps & features</b><br> | |||
Find <b>Ubuntu 22.04.2 TLS</b> and click <b>Advanced options</b> scroll down to <b>Reset</b> and click the <b>Reset</b> button.<br> | |||
<div class="toccolours mw-collapsible mw-collapsed"> | |||
Video demo: | |||
<div class="mw-collapsible-content"> | |||
<youtube>jOc6yjrhO2g</youtube> | |||
</div> | |||
</div> | |||
==Windows 10 subsystem notes== | ==Windows 10 subsystem notes== | ||
Line 20: | 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 82: | Line 110: | ||
Does not seem to use systemd on win subsystem.<br \> | Does not seem to use systemd on win subsystem.<br \> | ||
<code>sudo service apache2 start</code><br \> | <code>sudo service apache2 start</code><br \> | ||
If you see error:<br> | |||
<pre> | |||
(92)Protocol not available: AH00076: Failed to enable ARP_TCP_DEFER_ACCEPT | |||
</pre> | |||
Don't worry, it should still work. Check status of apache2.<br> | |||
<code>sudo service apache2 status</code><br> | |||
<code>wget https://releases.wikimedia.org/mediawiki/1.39/mediawiki-1.39.2.tar.gz</code> | <code>wget https://releases.wikimedia.org/mediawiki/1.39/mediawiki-1.39.2.tar.gz</code> | ||
Line 92: | Line 126: | ||
As this is just for your own computer on your own network, you can keep it super simple:<br \> | As this is just for your own computer on your own network, you can keep it super simple:<br \> | ||
<br>To Avoid Error:<br> | |||
<pre>su: warning: cannot change directory to /nonexistent: No such file or directory</pre> | |||
Fix with:<br> | |||
<code>sudo usermod -d /var/lib/mysql/ mysql</code><br> | |||
<br> | |||
<code>sudo service mysql start</code><br \> | <code>sudo service mysql start</code><br \> | ||
<code>sudo mysql -u root</code><br \> | <code>sudo mysql -u root</code><br \> | ||
<code>CREATE USER ' | <code>CREATE USER 'wiki'@'localhost';</code><br \> | ||
<code>CREATE DATABASE | <code>CREATE DATABASE my_wiki;</code><br \> | ||
<code>use | <code>use my_wiki;</code><br \> | ||
<code>GRANT ALL ON | <code>GRANT ALL ON my_wiki.* TO 'wiki'@'localhost';</code><br \> | ||
<code>quit;</code><br \> | <code>quit;</code><br \> | ||
<div class="toccolours mw-collapsible mw-collapsed"> | <div class="toccolours mw-collapsible mw-collapsed"> | ||
Line 105: | Line 144: | ||
<code>mysql -u $USER</code><br \> | <code>mysql -u $USER</code><br \> | ||
<br \> | <br \> | ||
<code>CREATE USER '$USERNAME'@'localhost' IDENTIFIED BY '$PASSWORD';</code><br \> | <code>CREATE USER '$USERNAME'@'localhost';</code><br \> | ||
If creating a database password <code>CREATE USER '$USERNAME'@'localhost' IDENTIFIED BY '$PASSWORD';</code><br \> | |||
<code>CREATE DATABASE $DATABASE_NAME;</code><br \> | <code>CREATE DATABASE $DATABASE_NAME;</code><br \> | ||
<code>use $DATABASE_NAME;</code><br \> | <code>use $DATABASE_NAME;</code><br \> | ||
Line 157: | Line 197: | ||
Connect to database - going to need the details from when you created the database. | Connect to database - going to need the details from when you created the database. | ||
<div class="mw-collapsible-content"> | <div class="mw-collapsible-content"> | ||
Database host:localhost<br \> | Database host:localhost Change to <b>127.0.0.1</b> to avoid error<br \> | ||
Database name: | Database name:wiki<br \> | ||
Database table prefix (no hyphens): <b>LEAVE BLANK</b><br \> | Database table prefix (no hyphens): <b>LEAVE BLANK</b><br \> | ||
Database username: | Database username:my_wiki<br \> | ||
Database password: | Database password: <b>LEAVE BLANK</b><br \> | ||
</div> | </div> | ||
</div> | </div> | ||
Line 204: | Line 244: | ||
Now to import CompleteNoobs Wiki content from a xml dump.<br \> | Now to import CompleteNoobs Wiki content from a xml dump.<br \> | ||
Visit <code>xml.completenoobs.com</code> and select the latest xml dump, right click and select 'Copy link address' | Visit <code>https://xml.completenoobs.com</code> and select the latest xml dump, right click and select 'Copy link address' | ||
now back to the subsystem<br \> | now back to the subsystem<br \> | ||
<code>wget https://xml.completenoobs.com/xmlDumps/ | <code>wget https://xml.completenoobs.com/xmlDumps/20_03_23.Noobs/20_03_23.Noobs.xml</code><br \> | ||
TIP:Type <b>wget</b> and then right click to paste the address<br \> | TIP:Type <b>wget</b> and then right click to paste the address<br \> | ||
Line 221: | Line 261: | ||
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 will fix the display bugs on the wiki.<br> | |||
You will need to open ubuntu and restart mysql and apache2.<br> | |||
<code>sudo service apache2 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 233: | 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
- https://www.youtube.com/watch?v=wB4gvSgYmfY
- After watch?v=
- <youtube>wB4gvSgYmfY</youtube>
- 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' );