Ubuntu Local Wiki Import: Difference between revisions
(Created page with "Tested on Ubuntu-Mate 20.04<br \> Download CompleteNoobs wiki and Keep Private Copy you can edit as you wish on your own computer. ==Download CompleteNoobs's XML dump== [https://xml.completenoobs.com CompleteNoobs xml dump] ==Create a container== <code>lxc launch ubuntu:20.04 localwiki</code><br \> Push file conataining xml dump to container<br \> <code>lxc file push wiki-dump.xml localwiki/root/</code><br \> Log/Chroot into container<br \> <code>lxc exec localwiki b...") |
|||
Line 26: | Line 26: | ||
<code>apt install apache2 mysql-server php php-mysql libapache2-mod-php php-xml php-mbstring php-intl -y</code> | <code>apt install apache2 mysql-server php php-mysql libapache2-mod-php php-xml php-mbstring php-intl -y</code> | ||
<code>wget https://releases.wikimedia.org/mediawiki/1. | <code>wget https://releases.wikimedia.org/mediawiki/1.39/mediawiki-1.39.2.tar.gz</code> | ||
<code>tar -zxvf mediawiki-1. | <code>tar -zxvf mediawiki-1.39.2.tar.gz</code> | ||
<code>mv mediawiki-1. | <code>mv mediawiki-1.39.2 /var/www/html/mediawiki </code> | ||
===Create database=== | ===Create database=== |
Revision as of 12:29, 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
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
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.