0279.html 4.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>Run Matomo - Google Analytics Alternative - in Docker</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,Install Guide,Self-Hosted,Web Based,Web Based Tools,Alternative To Google Analytics,Analytics,FOSS,Google Analytics,Google Analytics Alternative,Linux,MariaDB,MySQL,Ubuntu,Web Analytics,Web Traffic,Self-hosted Web Analytics,Matomo,Docker How To,Docker Container,Docker Made Simple,Homelab,Docker,Docker Simplified,Docker Tutorial,How To,Tutorial,i12bretro">
  8. <meta name="author" content="i12bretro">
  9. <meta name="description" content="Run Matomo - Google Analytics Alternative - in Docker">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  11. <meta name="revised" content="08/20/2023 08:08:15 PM" />
  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>Run Matomo - Google Analytics Alternative - in Docker</h1>
  22. </div>
  23. <div></div>
  24. <div id="content">
  25. <h2>What is Matomo?</h2>
  26. <blockquote><em>Matomo is the leading Free/Libre open analytics platform. Matomo aims to be a Free software alternative to Google Analytics and is already used on more than 1,400,000 websites. Privacy is built-in! -<a href="https://github.com/matomo-org/matomo" target="_blank">https://github.com/matomo-org/matomo</a></em></blockquote>
  27. <h2>Installing Docker</h2>
  28. <ol>
  29. <li>Log into the Linux based device</li>
  30. <li>Run the following commands in the terminal
  31. <div class="codeBlock"># install prerequisites<br />
  32. sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg-agent -y<br />
  33. # add docker gpg key<br />
  34. curl -fsSL https://download.docker.com/linux/$(awk -F&#39;=&#39; &#39;/^ID=/{ print $NF }&#39; /etc/os-release)/gpg | sudo apt-key add -<br />
  35. # add docker software repository<br />
  36. sudo add-apt-repository &quot;deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(awk -F&#39;=&#39; &#39;/^ID=/{ print $NF }&#39; /etc/os-release) $(lsb_release -cs) stable&quot;<br />
  37. # install docker<br />
  38. sudo apt install docker-ce docker-compose containerd.io -y<br />
  39. # enable and start docker service<br />
  40. sudo systemctl enable docker &amp;&amp; sudo systemctl start docker<br />
  41. # add the current user to the docker group<br />
  42. sudo usermod -aG docker $USER<br />
  43. # reauthenticate for the new group membership to take effect<br />
  44. su - $USER</div>
  45. </li>
  46. </ol>
  47. <h2>Running Matomo</h2>
  48. <ol>
  49. <li>Continue with the following commands in a terminal window
  50. <div class="codeBlock"># create a working directory<br />
  51. mkdir ~/docker/matomo -p &amp;&amp; mkdir ~/docker/mariadb -p<br />
  52. # set owner of working directories<br />
  53. sudo chown &quot;$USER&quot;:&quot;$USER&quot; ~/docker -R<br />
  54. # allow the container to write to working directories<br />
  55. sudo chmod a+rwx -R ~/docker/matomo<br />
  56. # run the mariadb docker container<br />
  57. docker run -d --name mariadb -e MYSQL_ROOT_PASSWORD=r00tp@$$ -e MYSQL_USER=matomo_rw -e MYSQL_PASSWORD=&#39;M4tom0!&#39; -e MYSQL_DATABASE=matomo -v ~/docker/mariadb:/var/lib/mysql -p 3306:3006 --restart=unless-stopped mariadb:latest<br />
  58. # start the matomo container<br />
  59. docker run -d --name matomo --link mariadb -p 80:80 -v ~/docker/matomo:/var/www/html -e MATOMO_DATABASE_HOST=mariadb -e MATOMO_DATABASE_USERNAME=matomo_rw -e MATOMO_DATABASE_PASSWORD=&#39;M4tom0!&#39; -e MATOMO_DATABASE_DBNAME=matomo --restart=unless-stopped matomo</div>
  60. </li>
  61. <li>Open a web browser and navigate to http://DNSorIP</li>
  62. <li>Click Next at the Welcome screen</li>
  63. <li>Scroll to the bottom of the System Check screen &gt; Click Next</li>
  64. <li>Verify the Database Setup form &gt; Click Next</li>
  65. <li>Click Next on the Creating the Tables page</li>
  66. <li>Enter a Superuser login, password and email &gt; Click Next</li>
  67. <li>Complete the form to setup the first site to start tracking analytics &gt; Click Next</li>
  68. <li>Click Next then Continue to Matomo</li>
  69. <li>Login with the Superuser username and password created earlier</li>
  70. <li>Welcome to Matomo</li>
  71. </ol>
  72. <p>Additional Information: <a href="https://matomo.org/" target="_blank">https://matomo.org/</a></p> </div>
  73. </div>
  74. </body>
  75. </html>