1,575
edits
Changes
Created page with "[https://www.mediawiki.org/ MediaWiki] is an excellent software package that almost instantly gives you a highly functional, highly configurable wiki. It is what powers [http..."
[https://www.mediawiki.org/ MediaWiki] is an excellent software package that almost instantly gives you a highly functional, highly configurable wiki. It is what powers [https://www.wikipedia.org/ Wikipedia] and this wiki too!
This article describes how I setup a MediaWiki server on a [https://www.debian.org/ Debian] 9 based [https://linuxcontainers.org/ Linux Container (LXC)] under [https://www.proxmox.com/en/ Proxmox] and made the page available using an [https://httpd.apache.org Apache2] [https://en.wikipedia.org/wiki/Reverse_proxy Reverse Proxy].
In the case of a MediaWiki instance I'm more interested in stability, ease of installation, and ease of updating over having the latest features. Therefore I'm installing the version distributed with Debian 9 ([https://www.mediawiki.org/wiki/MediaWiki_1.27 1.27] at the time of this writing) even though the latest available version is [https://www.mediawiki.org/wiki/MediaWiki_1.32 1.32] at the time of this writing). Furthermore I'll be configuring MediaWiki the way I like it and installing some extra packages and extensions that I find useful.
I use [https://www.nano-editor.org/ nano] as the command line text editor of choice here. Once you've finished editing the text file click '''Ctrl-X''' and then '''Y''' to save the file.
=Setup the Container=
#Using the Proxmox web interface, create a new Container using the Debian 9 template.
#Log into the container, with the root account, using the Proxmox web console
#Update, Upgrade, and Install a few packages
##run ''apt update''
##run ''apt upgrade''
##run ''apt install sudo unzip''
#Update the timezone
##run ''timedatectl set-timezone America/New_York''
##*change ''America/New_York'' to a location relevant to your physical location using the "TZ database name" in this [https://en.wikipedia.org/wiki/List_of_tz_database_time_zones table]
#Add a user and give them sudo access
##useradd admin
##usermod -aG sudo admin
#Exit the web console and ssh in as the admin user
=Setup Prerequisite Packages=
#Install the packages we'll need
##First install the required prerequisite packages (note that the package mysql-server actually installs [https://mariadb.org/ MariaDB] which is great! MariaDB is an open-source fork of [https://www.mysql.com/ MySQL]).
##*''sudo apt install apache2 mysql-server php php-mysql libapache2-mod-php php-xml php-mbstring''
##Next install some useful extra packages
##*''sudo apt install php-apcu php-intl imagemagick php-gd php-curl git''
##Restart apache2 to make it aware of php-apcu
##*''sudo service apache2 reload''
#Setup MariaDB
##Secure the MariaDB installation by running the following command
##*''sudo mysql_secure_installation''
###Ensure the root password is set and answer ''yes'' to all of the questions
##Log in to MariaDB with the following command. Enter your root password when prompted
##*''sudo mysql -u root -p''
##Create the mediawiki MariaDB user by typing the following at the ''MariaDB [(none)]>'' prompt
##*''CREATE USER 'mediawiki_user'@'localhost' IDENTIFIED BY 'THISpasswordSHOULDbeCHANGED';''
##Create the mediawiki database with the following command
##*''CREATE DATABASE mediawikidb;''
##Grant necessary privileges to the mediawiki user on the mediawiki database with the following commands
##*''USE mediawikidb;''
##*''GRANT ALL ON mediawikidb.* TO 'mediawiki_user'@'localhost';''
##exit the MariaDB console with the following command
##*''exit;''
#Configure PHP
##edit the apache2 php config file with the following command
##*''sudo nano /etc/php/7.0/apache2/php.ini''
###change ''upload_max_filesize'' to at least 20M
###ensure that that ''memory_limit'' is set to at least 128M
#Configure Apache2
##Add an Alias for your wiki
###run ''sudo nano /etc/apache2/apache2.conf''
###add ''Alias /wiki /var/lib/mediawiki'' to the bottom of the file
=Install & Configure MediaWiki=
#run ''sudo apt install mediawiki''
#navigate a web browser to ''http://server/mediawiki/''
##click '''set up the wiki'''
##click '''Continue'''
##click '''Continue'''
##on the '''Connect to database''' page
###change '''Database name:''' to ''mediawikidb''
###change '''Database username:''' to ''mediawiki_user''
###change '''Database password:''' to ''THISpasswordSHOULDbeCHANGED''
###click '''Continue'''
##click '''Continue'''
##on the '''Name''' page
###on the name of your wiki in '''Name of the wiki'''
###setup an admin account
###click '''Continue'''
##on the '''Options''' page
###choose your '''User rights profile:''' <pre style="color: red">'''<--- THIS IS IMPORTANT make sure the wiki is setup the way you want it to be. Be aware that an open wiki or a wiki that allows user to create and authenticate their own accounts will almost certainly result in your wiki getting vandalized by automated advertisement/hacking scripts!'''</pre>
###choose your license
###decide if you want email support
###decide if you want to disable any skins
###I recommend enabling the following extensions
###*ImageMap
###*InputBox
###*Nuke
###*ParserFunctions
###*PdfHandler
###*Renameuser
###*SyntaxHighlight_GeSHi
###*WikiEditor
###turn on '''Enable file uploads'''
###click '''Continue'''
###click '''Continue'''
###click '''Continue'''
#Move the ''LocalSettings.php'' file generated by the installer to ''/etc/mediawiki/LocalSettings.php'' on the target machine with the following
##on the browser machine run ''sudo scp ~/Downloads/LocalSettings.php user@server:~/''
##on the server machine run ''sudo mv ~/LocalSettings.php /etc/mediawiki/"
#Install and Enable some extra extensions
##'''MobileFrontend''' to give your wiki a nicely formatted view when seen from a mobile device
###Get the download link from https://www.mediawiki.org/wiki/Special:ExtensionDistributor/MobileFrontend
###run ''wget https://extdist.wmflabs.org/dist/extensions/MobileFrontend-REL1_27-717861c.tar.gz''
###run ''sudo tar -xzf MobileFrontend-*.tar.gz -C /usr/share/mediawiki/extensions''
###run ''sudo chown -R root:root /usr/share/mediawiki/extensions/MobileFrontend/''
###run ''rm MobileFrontend-*.tar.gz''
###run ''sudo nano /etc/mediawiki/LocalSettings.php'' and add the following to the bottom
###* # Enable MobileFrontend
###* wfLoadExtension( 'MobileFrontend' );
###* $wgMFAutodetectMobileView = true;
###* $wgMFDefaultSkinClass = 'SkinMinerva';
##'''LabeledSectionTransclusion''' to all you to link labelled section of a page to another page
###Get the download link from: https://www.mediawiki.org/wiki/Special:ExtensionDistributor/LabeledSectionTransclusion
###run ''wget https://extdist.wmflabs.org/dist/extensions/LabeledSectionTransclusion-REL1_27-9212396.tar.gz''
###run ''sudo tar -xzf LabeledSectionTransclusion-*.tar.gz -C /usr/share/mediawiki/extensions''
###run ''sudo chown -R root:root /usr/share/mediawiki/extensions/LabeledSectionTransclusion/''
###run ''rm LabeledSectionTransclusion-*.tar.gz''
###run ''sudo nano /etc/mediawiki/LocalSettings.php'' and add the following to the bottom
###* # Enable LabeledSectionTransclusion
###* wfLoadExtension( 'LabeledSectionTransclusion' );
##''IframePage'' to allow you load iFrames from other sites into your wiki pages
###run ''wget https://extdist.wmflabs.org/dist/extensions/IframePage-REL1_27-ca7f4fc.tar.gz''
###run ''sudo tar -xzf IframePage-*.tar.gz -C /usr/share/mediawiki/extensions''
###run ''sudo chown -R root:root /usr/share/mediawiki/extensions/IframePage/''
###run ''rm IframePage-*.tar.gz''
###run ''sudo nano /etc/mediawiki/LocalSettings.php'' and add the following to the bottom
###* # Enable IframePage
###* require_once "$IP/extensions/IframePage/IframePage.php";
###* $wgIframePageSrc= array( /* REQUIRED! */ );
#Enable a wider array of file uploads by running ''sudo nano /etc/mediawiki/LocalSettings.php'' and placing the following at the bottom of the file
#* # Accepted Upload File Extensions
#* $wgFileExtensions = array(
#* 'png', 'gif', 'jpg', 'jpeg', 'tiff', 'bmp',
#* 'doc', 'xls', 'ppt', 'docx', 'xlsx', 'pptx',
#* 'odt', 'ods', 'odp', 'odg',
#* 'py', 'py3',
#* 'pdf',
#* 'pem'
#* );
#* $wgFileBlacklist = array();
#* $wgStrictFileExtensions = false;
#* $wgMimeTypeBlacklist = array();
#* $wgVerifyMimeType = false;
You're done! Go visit http://server/mediawiki to start using your brand new wiki!
=Bonus=
If you want to visit http://server and have it automatically, instantly, redirect the user to http://server/mediawiki run ''sudo nano /var/www/html/index.html'' and enter the following into the file
<nowiki><head>
<meta http-equiv="refresh" content="0; url=http://wiki/mediawiki/" />
</head></nowiki>
This article describes how I setup a MediaWiki server on a [https://www.debian.org/ Debian] 9 based [https://linuxcontainers.org/ Linux Container (LXC)] under [https://www.proxmox.com/en/ Proxmox] and made the page available using an [https://httpd.apache.org Apache2] [https://en.wikipedia.org/wiki/Reverse_proxy Reverse Proxy].
In the case of a MediaWiki instance I'm more interested in stability, ease of installation, and ease of updating over having the latest features. Therefore I'm installing the version distributed with Debian 9 ([https://www.mediawiki.org/wiki/MediaWiki_1.27 1.27] at the time of this writing) even though the latest available version is [https://www.mediawiki.org/wiki/MediaWiki_1.32 1.32] at the time of this writing). Furthermore I'll be configuring MediaWiki the way I like it and installing some extra packages and extensions that I find useful.
I use [https://www.nano-editor.org/ nano] as the command line text editor of choice here. Once you've finished editing the text file click '''Ctrl-X''' and then '''Y''' to save the file.
=Setup the Container=
#Using the Proxmox web interface, create a new Container using the Debian 9 template.
#Log into the container, with the root account, using the Proxmox web console
#Update, Upgrade, and Install a few packages
##run ''apt update''
##run ''apt upgrade''
##run ''apt install sudo unzip''
#Update the timezone
##run ''timedatectl set-timezone America/New_York''
##*change ''America/New_York'' to a location relevant to your physical location using the "TZ database name" in this [https://en.wikipedia.org/wiki/List_of_tz_database_time_zones table]
#Add a user and give them sudo access
##useradd admin
##usermod -aG sudo admin
#Exit the web console and ssh in as the admin user
=Setup Prerequisite Packages=
#Install the packages we'll need
##First install the required prerequisite packages (note that the package mysql-server actually installs [https://mariadb.org/ MariaDB] which is great! MariaDB is an open-source fork of [https://www.mysql.com/ MySQL]).
##*''sudo apt install apache2 mysql-server php php-mysql libapache2-mod-php php-xml php-mbstring''
##Next install some useful extra packages
##*''sudo apt install php-apcu php-intl imagemagick php-gd php-curl git''
##Restart apache2 to make it aware of php-apcu
##*''sudo service apache2 reload''
#Setup MariaDB
##Secure the MariaDB installation by running the following command
##*''sudo mysql_secure_installation''
###Ensure the root password is set and answer ''yes'' to all of the questions
##Log in to MariaDB with the following command. Enter your root password when prompted
##*''sudo mysql -u root -p''
##Create the mediawiki MariaDB user by typing the following at the ''MariaDB [(none)]>'' prompt
##*''CREATE USER 'mediawiki_user'@'localhost' IDENTIFIED BY 'THISpasswordSHOULDbeCHANGED';''
##Create the mediawiki database with the following command
##*''CREATE DATABASE mediawikidb;''
##Grant necessary privileges to the mediawiki user on the mediawiki database with the following commands
##*''USE mediawikidb;''
##*''GRANT ALL ON mediawikidb.* TO 'mediawiki_user'@'localhost';''
##exit the MariaDB console with the following command
##*''exit;''
#Configure PHP
##edit the apache2 php config file with the following command
##*''sudo nano /etc/php/7.0/apache2/php.ini''
###change ''upload_max_filesize'' to at least 20M
###ensure that that ''memory_limit'' is set to at least 128M
#Configure Apache2
##Add an Alias for your wiki
###run ''sudo nano /etc/apache2/apache2.conf''
###add ''Alias /wiki /var/lib/mediawiki'' to the bottom of the file
=Install & Configure MediaWiki=
#run ''sudo apt install mediawiki''
#navigate a web browser to ''http://server/mediawiki/''
##click '''set up the wiki'''
##click '''Continue'''
##click '''Continue'''
##on the '''Connect to database''' page
###change '''Database name:''' to ''mediawikidb''
###change '''Database username:''' to ''mediawiki_user''
###change '''Database password:''' to ''THISpasswordSHOULDbeCHANGED''
###click '''Continue'''
##click '''Continue'''
##on the '''Name''' page
###on the name of your wiki in '''Name of the wiki'''
###setup an admin account
###click '''Continue'''
##on the '''Options''' page
###choose your '''User rights profile:''' <pre style="color: red">'''<--- THIS IS IMPORTANT make sure the wiki is setup the way you want it to be. Be aware that an open wiki or a wiki that allows user to create and authenticate their own accounts will almost certainly result in your wiki getting vandalized by automated advertisement/hacking scripts!'''</pre>
###choose your license
###decide if you want email support
###decide if you want to disable any skins
###I recommend enabling the following extensions
###*ImageMap
###*InputBox
###*Nuke
###*ParserFunctions
###*PdfHandler
###*Renameuser
###*SyntaxHighlight_GeSHi
###*WikiEditor
###turn on '''Enable file uploads'''
###click '''Continue'''
###click '''Continue'''
###click '''Continue'''
#Move the ''LocalSettings.php'' file generated by the installer to ''/etc/mediawiki/LocalSettings.php'' on the target machine with the following
##on the browser machine run ''sudo scp ~/Downloads/LocalSettings.php user@server:~/''
##on the server machine run ''sudo mv ~/LocalSettings.php /etc/mediawiki/"
#Install and Enable some extra extensions
##'''MobileFrontend''' to give your wiki a nicely formatted view when seen from a mobile device
###Get the download link from https://www.mediawiki.org/wiki/Special:ExtensionDistributor/MobileFrontend
###run ''wget https://extdist.wmflabs.org/dist/extensions/MobileFrontend-REL1_27-717861c.tar.gz''
###run ''sudo tar -xzf MobileFrontend-*.tar.gz -C /usr/share/mediawiki/extensions''
###run ''sudo chown -R root:root /usr/share/mediawiki/extensions/MobileFrontend/''
###run ''rm MobileFrontend-*.tar.gz''
###run ''sudo nano /etc/mediawiki/LocalSettings.php'' and add the following to the bottom
###* # Enable MobileFrontend
###* wfLoadExtension( 'MobileFrontend' );
###* $wgMFAutodetectMobileView = true;
###* $wgMFDefaultSkinClass = 'SkinMinerva';
##'''LabeledSectionTransclusion''' to all you to link labelled section of a page to another page
###Get the download link from: https://www.mediawiki.org/wiki/Special:ExtensionDistributor/LabeledSectionTransclusion
###run ''wget https://extdist.wmflabs.org/dist/extensions/LabeledSectionTransclusion-REL1_27-9212396.tar.gz''
###run ''sudo tar -xzf LabeledSectionTransclusion-*.tar.gz -C /usr/share/mediawiki/extensions''
###run ''sudo chown -R root:root /usr/share/mediawiki/extensions/LabeledSectionTransclusion/''
###run ''rm LabeledSectionTransclusion-*.tar.gz''
###run ''sudo nano /etc/mediawiki/LocalSettings.php'' and add the following to the bottom
###* # Enable LabeledSectionTransclusion
###* wfLoadExtension( 'LabeledSectionTransclusion' );
##''IframePage'' to allow you load iFrames from other sites into your wiki pages
###run ''wget https://extdist.wmflabs.org/dist/extensions/IframePage-REL1_27-ca7f4fc.tar.gz''
###run ''sudo tar -xzf IframePage-*.tar.gz -C /usr/share/mediawiki/extensions''
###run ''sudo chown -R root:root /usr/share/mediawiki/extensions/IframePage/''
###run ''rm IframePage-*.tar.gz''
###run ''sudo nano /etc/mediawiki/LocalSettings.php'' and add the following to the bottom
###* # Enable IframePage
###* require_once "$IP/extensions/IframePage/IframePage.php";
###* $wgIframePageSrc= array( /* REQUIRED! */ );
#Enable a wider array of file uploads by running ''sudo nano /etc/mediawiki/LocalSettings.php'' and placing the following at the bottom of the file
#* # Accepted Upload File Extensions
#* $wgFileExtensions = array(
#* 'png', 'gif', 'jpg', 'jpeg', 'tiff', 'bmp',
#* 'doc', 'xls', 'ppt', 'docx', 'xlsx', 'pptx',
#* 'odt', 'ods', 'odp', 'odg',
#* 'py', 'py3',
#* 'pdf',
#* 'pem'
#* );
#* $wgFileBlacklist = array();
#* $wgStrictFileExtensions = false;
#* $wgMimeTypeBlacklist = array();
#* $wgVerifyMimeType = false;
You're done! Go visit http://server/mediawiki to start using your brand new wiki!
=Bonus=
If you want to visit http://server and have it automatically, instantly, redirect the user to http://server/mediawiki run ''sudo nano /var/www/html/index.html'' and enter the following into the file
<nowiki><head>
<meta http-equiv="refresh" content="0; url=http://wiki/mediawiki/" />
</head></nowiki>