- Step 1-installing Apache and Updating the
Firewall
- Adjust the Firewall to allow Web
Traffic
- How to Find your Server's public IP
Address
- Step 2-installing MySQL
- Step 3-installing PHP
- Step 4-testing PHP processing on your Web
Server
- Step 5-before Installation
- Installation Requirements
- Step 5-installing MediaWiki
- Step 6-create a database
- Step 7-run the installation
Script
- Step 8-short Url/apache
- Enabling Mod_rewrite
- Setting up Apache2
- Setting up the rewrite rules
- LocalSettings.php
- Step 8-
Extension:syntaxhighlight
- References
Step 1-installing Apache and Updating the Firewalladjust the Firewall to allow WEB traffic
sudo apt updatesudo apt install apache2sudo ufw app listsudo ufw app info "Apache Full"sudo ufw allow in "Apache Full"
http://localhost
How to Find your Server's public IP address
sudo apt install curlcurl http://icanhazip.com
Step 2-installing MySQL
sudo apt install mysql-serversudo mysql_secure_installation
Step 3-installing PHP
sudo apt install php libapache2-mod-php php-mysql
sudo gedit /etc/apache2/mods-enabled/dir.conf
<IfModule mod_dir.c> DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm</IfModule>
sudo systemctl restart apache2sudo systemctl status apache2
apt search php- | less
Step 4-testing PHP processing on your Web Server
sudo gedit /var/www/html/info.php
<?php phpinfo();?>
http://localhost/info.php
Step 5-before installationinstallation Requirements
sudo apt install php-apcuphp-curl php-gd php-intl php-mbstring php-xml
sudo apt install texlive
Step 5-installing MediaWiki
curl -O https://releases.wikimedia.org/mediawiki/1.30/mediawiki-1.30.0.tar.gztar xvzf mediawiki-*.tar.gzsudo mkdir /var/www/html/wsudo mv mediawiki-1.30.0/* /var/www/html/w
Step 6-create a database
CREATE DATABASE wikidb;GRANT ALL PRIVILEGES ON wikidb.* TO 'wikiuser'@'localhost' IDENTIFIED BY 'password';
Step 7-run the installation script
http://localhost/w/index.php
sudo mv LocalSettings.php /var/www/html/w
Step 8-short Url/apache
MediaWiki ' s default page addresses looks like these examples:
http://localhost/w/index.php/Page_title
Short URL
Page addresses looks like these examples:
http://localhost/w/index.php/Page_title
- The MediaWiki directory is located at:/w
- The desired short URL, format is:/wiki/page_title
Enabling Mod_rewrite
sudo a2enmod rewritesudo systemctl restart apache2
Setting up Apache2
sudo gedit /etc/apache2/sites-available/mediawiki.conf
<virtualhost *:80> <Directory/var/www/html> Options Indexes followsymlinks multiviews Allowo Verride all Require all granted </Directory> # the SERVERNAME Directive sets the request scheme, Hostna Me and port that # The server uses to identify itself. This was used when creating # redirection URLs. In the context of the virtual hosts, the ServerName # specifies what hostname must appear in the request ' s Host:header to # match this virtual host. The default virtual host (this file) of this # value is not decisive as it's used as a last resort host regardless. # However, must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin [email protected] documentroot/var/www/html # Available Loglevels: Trace8, ..., Trace1, debug, info, notice, warn, # Error, Crit, alert, Emerg. # It's also possible to configure the loglevel for particular # modules, e.g. #LogLevel INFO ssl:warn errorlog ${apache_log_dir}/error.log customlog ${apache_log_dir}/access.log Combined # for most CONF iguration files from conf-available/, which was # enabled or disabled at a global level, it's possible to # include A line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally Disab LED with "a2disconf". #Include conf-available/serve-cgi-bin.conf</virtualhost># vim:syntax=apache ts=4 sw=4 sts=4 SR Noet
sudo a2ensite mediawiki.confsudo a2dissite 000-default.confsudo apache2ctl configtestsudo systemctl restart apache2
Setting up the rewrite rules
sudo gedit /var/www/html/.htaccess
## http://www.mediawiki.org/wiki/Manual:Short_URL/Apache# Enable the rewrite engineRewriteEngine On# Short URL for wiki pagesRewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L]# Redirect / to Main PageRewriteRule ^/*$ %{DOCUMENT_ROOT}/w/index.php [L]
LocalSettings.php
sudo gedit /var/www/html/w/LocalSettings.php
## https://www.mediawiki.org/wiki/Manual:Short_URL$wgScriptPath = "/w"; // this should already have been configured this way$wgArticlePath = "/wiki/$1";$wgUsePathInfo = true;
Step 8-extension:syntaxhighlight
Troubleshooting
After updating to MediaWiki v1.26 and above, some users started reporting problems with the extension.
- Try pointing?
$wgPygmentizePath
? In localsettings.php towards a external pygmentize binary.
- See The?phabricator Task?on this for further suggestions and information.
sudo apt install pythoncurl https://bootstrap.pypa.io/get-pip.py -o get-pip.pysudo python get-pip.pysudo pip install Pygmentswhich pygmentize
/usr/local/bin/pygmentize
sudo gedit /var/www/html/w/LocalSettings.php
$wgPygmentizePath = "/usr/local/bin/pygmentize";
References
How to Install MediaWiki on Ubuntu 14.04
How to Rewrite URLs with mod_rewrite for Apache on Ubuntu 16.04
How to Install the Apache Web Server on Ubuntu 18.04
How to Install Linux, Apache, MySQL, PHP (LAMP) stacks on Ubuntu 18.04
INSTALL MEDIAWIKI on UBUNTU 18.04 LTS with APACHE2, MARIADB and PHP 7.1 support
Manual:installation Guide
Manual:installation Requirements
Manual:installing MediaWiki
Manual:config Script
Manual:short Url/apache
Extension:syntaxhighlight
How to Install MediaWiki on Ubuntu 18.04 LTS