{"id":6497,"date":"2018-08-31T18:18:58","date_gmt":"2018-08-31T14:18:58","guid":{"rendered":"https:\/\/www.howtoforge.com\/tutorial\/how-to-install-mediawiki-on-ubuntu-1804\/"},"modified":"2018-08-31T18:18:58","modified_gmt":"2018-08-31T14:18:58","slug":"how-to-install-mediawiki-on-ubuntu-18-04-lts","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/how-to-install-mediawiki-on-ubuntu-18-04-lts\/","title":{"rendered":"How to install MediaWiki on Ubuntu 18.04 LTS"},"content":{"rendered":"<p>Mediawiki is a free and open source wiki software that allows you to create your own wiki site. It is written in PHP and uses MySQL\/MariaDB database backend. Mediawiki comes with lots of features including, Multilanguage support, User Management, Content management and sharing, Editing, Formatting, Referencing and much more.<\/p>\n<p>In this tutorial, we will learn how to install Mediawiki with Apache web server on Ubuntu 18.04 server.<\/p>\n<h2 id=\"requirements\">Requirements<\/h2>\n<ul>\n<li>A server running Ubuntu 18.04.<\/li>\n<li>A non-root user with sudo privileges.<\/li>\n<\/ul>\n<h2 id=\"install-lamp-server\">Install LAMP Server<\/h2>\n<p>First, install Apache and MariaDB server using the following command:<\/p>\n<p class=\"command\">sudo apt-get install apache2 mariadb-server -y<\/p>\n<p>Once both packages are installed, you will need to add Ondrej PHP repository to your system. You can add it with the following command:<\/p>\n<p class=\"command\">sudo apt-get install software-properties-common<br \/>sudo add-apt-repository ppa:ondrej\/php -y<\/p>\n<p>Once the repository is installed, update the repository and install PHP along with all the required PHP libraries:<\/p>\n<p class=\"command\">sudo apt-get update -y<br \/>sudo apt-get install php7.2 libapache2-mod-php7.2 php7.2-common php7.2-mbstring php7.2-xmlrpc php7.2-soap php7.2-gd php7.2-xml php7.2-intl php7.2-mysql php7.2-cli php7.2-mcrypt php7.2-zip php7.2-curl -y<\/p>\n<p>Once all the packages are installed, open php.ini file with the following command:<\/p>\n<p class=\"command\">sudo nano \/etc\/php\/7.2\/apache2\/php.ini<\/p>\n<p>Make the following changes:<\/p>\n<pre>memory_limit = 256M&#13;\nupload_max_filesize = 100M&#13;\nmax_execution_time = 360&#13;\ndate.timezone = Asia\/Kolkata&#13;\n<\/pre>\n<p>Save and close the file, then start Apache and MariaDB service and enable them to start on boot time:<\/p>\n<p class=\"command\">sudo systemctl start apache2<br \/>sudo systemctl enable apache2<br \/>sudo systemctl start mysql<br \/>sudo systemctl enable mysql<\/p>\n<h2 id=\"configure-mariadb\">Configure MariaDB<\/h2>\n<p>First, secure MariaDB installation with the following command:<\/p>\n<p class=\"command\">sudo mysql_secure_installation<\/p>\n<p>Answer all the questions as shown below:<\/p>\n<pre> Enter current password for root (enter for none):&#13; Set root password? [Y\/n]: N&#13; Remove anonymous users? [Y\/n]: Y&#13; Disallow root login remotely? [Y\/n]: Y&#13; Remove test database and access to it? [Y\/n]: Y&#13; Reload privilege tables now? [Y\/n]: Y&#13;\n<\/pre>\n<p>Once the MariaDB is secured, log in to MariaDB shell:<\/p>\n<p class=\"command\">mysql -u root -p<\/p>\n<p>Enter your root password when prompt, then create a database and user for Mediawiki:<\/p>\n<p class=\"command\">MariaDB [(none)]&gt;CREATE DATABASE mediadb;<br \/>MariaDB [(none)]&gt;CREATE USER &#8216;media&#8217;@&#8217;localhost&#8217; IDENTIFIED BY &#8216;password&#8217;;<\/p>\n<p>Next, grant all the privileges to the mediadb with the following command:<\/p>\n<p class=\"command\">MariaDB [(none)]&gt;GRANT ALL ON mediadb.* TO &#8216;media&#8217;@&#8217;localhost&#8217; IDENTIFIED BY &#8216;password&#8217; WITH GRANT OPTION;<\/p>\n<p>Next, flush the privileges and exit from the MariaDB shell:<\/p>\n<p class=\"command\">MariaDB [(none)]&gt;FLUSH PRIVILEGES;<br \/>MariaDB [(none)]&gt;EXIT;<\/p>\n<p>First, download the latest version of Mediawiki from their official website:<\/p>\n<p class=\"command\">wget https:\/\/releases.wikimedia.org\/mediawiki\/1.31\/mediawiki-1.31.0.tar.gz<\/p>\n<p>Once the download is completed, extract the downloaded file with the following command:<\/p>\n<p class=\"command\">tar -xvzf mediawiki-1.31.0.tar.gz<\/p>\n<p>Next, copy the extracted directory to the Apache root directory and give proper permissions:<\/p>\n<p class=\"command\">sudo cp -r mediawiki-1.31.0 \/var\/www\/html\/mediawiki<br \/>sudo chown -R www-data:www-data \/var\/www\/html\/mediawiki<br \/>sudo chmod -R 777 \/var\/www\/html\/mediawiki<\/p>\n<p>Next, create an Apache virtual host file for Mediawiki with the following command:<\/p>\n<p class=\"command\">sudo nano \/etc\/apache2\/sites-available\/mediawiki.conf<\/p>\n<p>add the following lines:<\/p>\n<pre>&lt;VirtualHost *:80&gt;&#13;\nServerAdmin <a href=\"https:\/\/www.howtoforge.com\/cdn-cgi\/l\/email-protection\" class=\"__cf_email__\" data-cfemail=\"d8b9bcb5b1b698bda0b9b5a8b4bdf6bbb7b5\" target=\"_blank\" rel=\"noopener\">[email\u00a0protected]<\/a>&#13;\nDocumentRoot \/var\/www\/html\/mediawiki\/&#13;\nServerName example.com&#13;\n&lt;Directory \/var\/www\/html\/mediawiki\/&gt;&#13;\nOptions +FollowSymLinks&#13;\nAllowOverride All&#13;\n&lt;\/Directory&gt;&#13;\nErrorLog \/var\/log\/apache2\/media-error_log&#13;\nCustomLog \/var\/log\/apache2\/media-access_log common&#13;\n&lt;\/VirtualHost&gt;&#13;\n<\/pre>\n<p>Save the file, then enable virtual host file and Apache rewrite module with the following command:<\/p>\n<p class=\"command\">sudo a2ensite mediawiki.conf<br \/>sudo a2enmod rewrite<\/p>\n<p>Finally, restart Apache web server to make the changes:<\/p>\n<p class=\"command\">sudo systemctl restart apache2<\/p>\n<p>Now, open your web browser and type the URL http:\/\/example.com. You will be redirected to the following page:<\/p>\n<p><a class=\"fancybox\" id=\"img-page1\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_install_mediawiki_on_ubuntu_1804\/big\/page1.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/how-to-install-mediawiki-on-ubuntu-18-04-lts.png\" alt=\"MediaWiki Installer\" width=\"550\" height=\"272\" title=\"\"><\/a><\/p>\n<p>Now, click on the <strong>set up the wiki<\/strong> button. You should see the following page:<\/p>\n<p><a class=\"fancybox\" id=\"img-page2\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_install_mediawiki_on_ubuntu_1804\/big\/page2.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/how-to-install-mediawiki-on-ubuntu-18-04-lts-1.png\" alt=\"Choose language\" width=\"550\" height=\"289\" title=\"\"><\/a><\/p>\n<p>Here, choose your wiki language and click on the <strong>Continue<\/strong> button. You should see the following page:<\/p>\n<p><a class=\"fancybox\" id=\"img-page3\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_install_mediawiki_on_ubuntu_1804\/big\/page3.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/how-to-install-mediawiki-on-ubuntu-18-04-lts-2.png\" alt=\"Installation environmnet check\" width=\"550\" height=\"277\" title=\"\"><\/a><\/p>\n<p>Now, click on the <strong>Continue<\/strong> button. You should see the following page:<\/p>\n<p><a class=\"fancybox\" id=\"img-page4\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_install_mediawiki_on_ubuntu_1804\/big\/page4.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/how-to-install-mediawiki-on-ubuntu-18-04-lts-3.png\" alt=\"Database details\" width=\"550\" height=\"291\" title=\"\"><\/a><\/p>\n<p>Now, provide your database details and click on the <strong>Continue<\/strong> button. You should see the following page:<\/p>\n<p><a class=\"fancybox\" id=\"img-page5\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_install_mediawiki_on_ubuntu_1804\/big\/page5.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/how-to-install-mediawiki-on-ubuntu-18-04-lts-4.png\" alt=\"Select database type\" width=\"550\" height=\"269\" title=\"\"><\/a><\/p>\n<p>Now, select storage engine and click on the <strong>Continue<\/strong> button. You should see the following page:<\/p>\n<p><a class=\"fancybox\" id=\"img-page6\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_install_mediawiki_on_ubuntu_1804\/big\/page6.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/how-to-install-mediawiki-on-ubuntu-18-04-lts-5.png\" alt=\"Set a site name, username and password\" width=\"550\" height=\"289\" title=\"\"><\/a><\/p>\n<p>Now, provide your wiki site name, username and password. Then, click on the <strong>Continue<\/strong> button. You should see the following page:<\/p>\n<p><a class=\"fancybox\" id=\"img-page7_1\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_install_mediawiki_on_ubuntu_1804\/big\/page7_1.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/how-to-install-mediawiki-on-ubuntu-18-04-lts-6.png\" alt=\"MediaWiki Settings\" width=\"550\" height=\"266\" title=\"\"><\/a><\/p>\n<p><a class=\"fancybox\" id=\"img-page7_2\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_install_mediawiki_on_ubuntu_1804\/big\/page7_2.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/how-to-install-mediawiki-on-ubuntu-18-04-lts-7.png\" alt=\"MediaWiki Settings - page 2\" width=\"550\" height=\"295\" title=\"\"><\/a><\/p>\n<p>Now, mark all your required settings and click on the <strong>Continue<\/strong> button. You should see the following page:<\/p>\n<p><a class=\"fancybox\" id=\"img-page8\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_install_mediawiki_on_ubuntu_1804\/big\/page8.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/how-to-install-mediawiki-on-ubuntu-18-04-lts-8.png\" alt=\"Start MediaWiki installation\" width=\"550\" height=\"261\" title=\"\"><\/a><\/p>\n<p>Now, click on <strong>Continue<\/strong> button to start the installation. Once the installation is completed. You should see the following page:<\/p>\n<p><a class=\"fancybox\" id=\"img-page9\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_install_mediawiki_on_ubuntu_1804\/big\/page9.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/how-to-install-mediawiki-on-ubuntu-18-04-lts-9.png\" alt=\"Installation finished\" width=\"550\" height=\"276\" title=\"\"><\/a><\/p>\n<p>Now, click on the <strong>Continue<\/strong> button. You should see the following page:<\/p>\n<p><a class=\"fancybox\" id=\"img-page10\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_install_mediawiki_on_ubuntu_1804\/big\/page10.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/how-to-install-mediawiki-on-ubuntu-18-04-lts-10.png\" alt=\"DownloadlocalSettings.php\" width=\"550\" height=\"289\" title=\"\"><\/a><\/p>\n<p>Here, you need to download the LocalSettings.php file and put it on MediaWiki root directory.<\/p>\n<p>Now, open your web browser and type the URL http:\/\/example.com. You should see your MediaWiki site in the following image:<\/p>\n<p><a class=\"fancybox\" id=\"img-page11\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_install_mediawiki_on_ubuntu_1804\/big\/page11.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/how-to-install-mediawiki-on-ubuntu-18-04-lts-11.png\" alt=\"MediaWiki start page\" width=\"550\" height=\"230\" title=\"\"><\/a><\/p>\n<h2 id=\"links\">Links<\/h2>\n<div class=\"authorbox\" readability=\"30\">\n<img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/how-to-install-mediawiki-on-ubuntu-18-04-lts.jpg\" alt=\"Hitesh Jethva\" title=\"\"> <\/p>\n<p><strong>About Hitesh Jethva<\/strong><\/p>\n<p>Over 8 years of experience as a Linux system administrator. My skills include a depth knowledge of Redhat\/Centos, Ubuntu Nginx and Apache, Mysql, Subversion, Linux, Ubuntu, web hosting, web server, Squid proxy, NFS, FTP, DNS, Samba, LDAP, OpenVPN, Haproxy, Amazon web services, WHMCS, OpenStack Cloud, Postfix Mail Server, Security etc.<\/p>\n<\/div>\n<div>\n<p><b>Share this page:<\/b><\/p>\n<p>\n<a href=\"https:\/\/www.facebook.com\/sharer.php?u=https%3A%2F%2Fwww.howtoforge.com%2Ftutorial%2Fhow-to-install-mediawiki-on-ubuntu-1804%2F\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/how-to-install-mediawiki-on-ubuntu-18-04-lts-12.png\" height=\"20\" alt=\"\" title=\"\"><\/a><br \/>\n<a href=\"https:\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Fwww.howtoforge.com%2Ftutorial%2Fhow-to-install-mediawiki-on-ubuntu-1804%2F&amp;text=How+to+install+MediaWiki+on+Ubuntu+18.04+LTS&amp;via=howtoforgecom&amp;related=howtoforgecom\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/how-to-install-mediawiki-on-ubuntu-18-04-lts-13.png\" height=\"20\" alt=\"\" title=\"\"><\/a><br \/>\n<a href=\"https:\/\/twitter.com\/howtoforgecom\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/how-to-install-mediawiki-on-ubuntu-18-04-lts-14.png\" height=\"20\" alt=\"\" title=\"\"><\/a><br \/>\n<a href=\"https:\/\/plus.google.com\/share?url=https%3A%2F%2Fwww.howtoforge.com%2Ftutorial%2Fhow-to-install-mediawiki-on-ubuntu-1804%2F\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/09\/how-to-install-mediawiki-on-ubuntu-18-04-lts-15.png\" height=\"20\" alt=\"\" title=\"\"><\/a>\n<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Mediawiki is a free and open source wiki software that allows you to create your own wiki site. It is written in PHP and uses MySQL\/MariaDB database backend. Mediawiki comes with lots of features including, Multilanguage support, User Management, Content management and sharing, Editing, Formatting, Referencing and much more. In this tutorial, we will learn [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"class_list":["post-6497","post","type-post","status-publish","format-standard","hentry","category-36"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/6497","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=6497"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/6497\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=6497"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=6497"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=6497"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}