0594.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>Running MediaWiki in Docker on Ubuntu Server</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <meta charset="UTF-8">
  7. <meta name="keywords" content="Browser Based,Docker Made Easy,Home Lab,Home Lab Ideas,Hypervisor,Install Guide,Self-Hosted,Web Based,Web Based Tools,FOSS,How To Install WikiMedia On Debian,Linux,MariaDB,MySQL,PHP,WikiMedia,Self-Hosted Wikipedia,Container,Containerization,Docker,Docker How To,Docker Installation Tutorial,Docker Simplified,Docker Tutorial,How To,Tutorial,i12bretro">
  8. <meta name="author" content="i12bretro">
  9. <meta name="description" content="Running MediaWiki in Docker on Ubuntu Server">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  11. <meta name="revised" content="08/19/2024 06:09:40 AM" />
  12. <link rel="icon" type="image/x-icon" href="includes/favicon.ico">
  13. <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
  14. <script type="text/javascript" src="includes/js/steps.js"></script>
  15. <link href="css/steps.css" rel="stylesheet" type="text/css" />
  16. </head>
  17. <body>
  18. <div id="gridContainer">
  19. <div class="topMargin"></div>
  20. <div id="listName" class="topMargin">
  21. <h1>Running MediaWiki in Docker on Ubuntu Server</h1>
  22. </div>
  23. <div></div>
  24. <div id="content">
  25. <h2>What is MediaWiki?</h2>
  26. <p><em>The MediaWiki software is used by tens of thousands of websites and thousands of companies and organizations. It powers Wikipedia and also this website. MediaWiki helps you collect and organize knowledge and make it available to people. It&#39;s powerful, multilingual, free and open, extensible, customizable, reliable, and free of charge.</em> -<a href="https://www.mediawiki.org/wiki/MediaWiki" target="_blank">https://www.mediawiki.org/wiki/MediaWiki</a></p>
  27. <h2>Installing Docker</h2>
  28. <ol>
  29. <li>Log into the Linux host and run the following commands in a terminal window
  30. <div class="codeBlock"># update software respositories<br />
  31. sudo apt update<br />
  32. # install available software updates<br />
  33. sudo apt upgrade -y<br />
  34. # install prerequisites<br />
  35. sudo apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common -y<br />
  36. # add docker gpg key<br />
  37. curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -<br />
  38. # add docker apt repository<br />
  39. sudo add-apt-repository &quot;deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable&quot;<br />
  40. # install docker<br />
  41. sudo apt install docker-ce docker-compose containerd.io -y<br />
  42. # add the current user to the docker group<br />
  43. sudo usermod -aG docker $USER<br />
  44. # reauthenticate for the new group membership to take effect<br />
  45. su - $USER</div>
  46. </li>
  47. </ol>
  48. <h2>Running MediaWiki Container</h2>
  49. <ol>
  50. <li>Continue with the following commands in a terminal window
  51. <div class="codeBlock"># create working directories<br />
  52. mkdir /home/$USER/docker/mediawiki/images -p &amp;&amp; mkdir /home/$USER/docker/mariadb -p<br />
  53. # set owner of working directories<br />
  54. sudo chown &quot;$USER&quot;:&quot;$USER&quot; /home/&quot;$USER&quot;/docker -R<br />
  55. # create containers network<br />
  56. docker network create containers<br />
  57. # run the mariadb docker container<br />
  58. docker run --name mariadb -e MYSQL_ROOT_PASSWORD=r00tp@$$ -e MYSQL_USER=mediawiki_rw -e MYSQL_PASSWORD=WikiW1k1What! -e MYSQL_DATABASE=mediawiki -v /home/$USER/docker/mariadb:/var/lib/mysql --network containers --restart=unless-stopped -d mariadb:latest<br />
  59. # run the mediawiki docker container<br />
  60. docker run -d --name mediawiki -p 8080:80 -e MYSQL_USER=mediawiki_rw -e MYSQL_PASSWORD=WikiW1k1What! -e MYSQL_DATABASE=mediawiki -v /home/$USER/docker/mediawiki/images:/var/www/html/images --network containers mediawiki:latest</div>
  61. </li>
  62. <li>Open a web browser and navigate to http://DNSorIP:8080</li>
  63. <li>Scroll to the bottom and click the set up the wiki link</li>
  64. <li>Set the Languages &gt; Click Continue</li>
  65. <li>Click Continue at the Welcome screen</li>
  66. <li>Complete the Database settings as follows:
  67. <p>Database type:<br />
  68. Database host: mariadb<br />
  69. Database name: mediawiki<br />
  70. Database table prefix:<br />
  71. Database username: mediawiki_rw<br />
  72. Database password: WikiW1k1What!</p>
  73. </li>
  74. <li>Click Continue</li>
  75. <li>Leave the Use the same account as for installation box checked &gt; Click Continue</li>
  76. <li>Give the Wiki a name and create an administrator username and password</li>
  77. <li>Uncheck the Share data about this installation with MediaWiki developers box</li>
  78. <li>Check the I&#39;m bored already, just install the wiki box &gt; Click Continue</li>
  79. <li>Click Continue again to begin the installation</li>
  80. <li>After the installation completes click Continue</li>
  81. <li>At the Download LocalSettings.php page, download the file</li>
  82. <li>Open the downloaded LocalSettings.php and copy the contents to the clipboard</li>
  83. <li>Back on the Docker host, run the following command to create LocalSettings.php in the correct location
  84. <div class="codeBlock"># create and edit LocalSettings.php<br />
  85. nano /home/$USER/docker/mediawiki/LocalSettings.php</div>
  86. </li>
  87. <li>Paste the copied contents from the downloaded LocalSettings.php</li>
  88. <li>Press CTRL+O, Enter, CTRL+X to write the changes</li>
  89. <li>Continue with the following commands
  90. <div class="codeBlock"># remove mediawiki container<br />
  91. docker rm mediawiki --force<br />
  92. # re-initialize mediawiki container with local settings<br />
  93. docker run -d --name mediawiki -p 8080:80 -e MYSQL_USER=mediawiki_rw -e MYSQL_PASSWORD=WikiW1k1What! -e MYSQL_DATABASE=mediawiki -v /home/$USER/docker/mediawiki/images:/var/www/html/images -v /home/$USER/docker/mediawiki/LocalSettings.php:/var/www/html/LocalSettings.php --network containers --restart=unless-stopped mediawiki:latest<br />
  94. # allow the container to write to working directories<br />
  95. sudo chmod a+rwx -R ~/docker</div>
  96. </li>
  97. <li>Back in the browser click the enter your wiki link</li>
  98. <li>Click the Log In link at the top right</li>
  99. <li>Log in with the administrator account created during the setup</li>
  100. <li>Welcome to MediaWiki</li>
  101. </ol>
  102. <p>Source: <a href="https://hub.docker.com/_/mediawiki" target="_blank">https://hub.docker.com/_/mediawiki</a></p> </div>
  103. </div>
  104. </body>
  105. </html>