Windows 10 Local Wiki Import: Difference between revisions
No edit summary |
|||
Line 13: | Line 13: | ||
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 \> | ||
==Reset Ubuntu== | ==To Reset Ubuntu== | ||
In search bar goto <b>Apps & features</b><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> | 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> |
Revision as of 11:20, 23 March 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.
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:
To Reset Ubuntu
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.
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.
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 status apache2
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 db;
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.
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.