0522.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>Roll Your Own Google Analytics Alternative with Umami</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <meta charset="UTF-8">
  7. <meta name="keywords" content="Debian,Browser Based,Home Lab,Home Lab Ideas,Install Guide,Self-Hosted,Ubuntu,Umami,Umami Analytics,Analytics,Web Traffic,Google Analytics,Google Analytics Alternative,Open Source,FOSS,NodeJS,Alternative To Google Analytics,Self-hosted Web Analytics,Web Analytics,Web Based,Web Based Tools,MySQL,MariaDB,Linux,How To,Tutorial,i12bretro">
  8. <meta name="author" content="i12bretro">
  9. <meta name="description" content="Roll Your Own Google Analytics Alternative with Umami">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  11. <meta name="revised" content="05/31/2023 09:56:41 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>Roll Your Own Google Analytics Alternative with Umami</h1>
  22. </div>
  23. <div></div>
  24. <div id="content">
  25. <h2>What is Umami</h2>
  26. <p><em>Umami is a simple, fast, website analytics alternative to Google Analytics.</em> -<a href="https://github.com/mikecao/umami" target="_blank">https://github.com/mikecao/umami</a></p>
  27. <h2>Installing NodeJS</h2>
  28. <ol>
  29. <li>Log into the Linux device</li>
  30. <li>Run the following commands in a terminal window
  31. <div class="codeBlock"># download nodejs<br />
  32. wget -O nodejs.tar.xz https://nodejs.org/dist/v14.17.0/node-v14.17.0-linux-x64.tar.xz<br />
  33. # extract nodejs.tar.xz<br />
  34. tar -xJf nodejs.tar.xz<br />
  35. # change directory to extracted folder<br />
  36. cd node-v14.17.0-linux-x64<br />
  37. # copy node binaries to /usr/local<br />
  38. sudo cp -R * /usr/local/<br />
  39. # test node is working<br />
  40. node -v<br />
  41. # test npm is working<br />
  42. npm -v</div>
  43. </li>
  44. </ol>
  45. <h2>Running Umami</h2>
  46. <ol>
  47. <li>Run the following commands in a terminal window
  48. <div class="codeBlock"># install MySQL<br />
  49. sudo apt install mariadb-server -y<br />
  50. # configure the MySQL database<br />
  51. sudo su<br />
  52. mysql_secure_installation</div>
  53. </li>
  54. <li>Press Enter to login as root</li>
  55. <li>Type Y and press Enter to set a root password, type the password twice to confirm</li>
  56. <li>Type Y and press Enter to remove anonymous users</li>
  57. <li>Type Y and press Enter to disallow root login remotely</li>
  58. <li>Type Y and press Enter to remove the test database</li>
  59. <li>Type Y and press Enter to reload privilege tables</li>
  60. <li>Run the following command to login into MySQL:
  61. <div class="codeBlock">mysql -u root -p</div>
  62. </li>
  63. <li>Authenticate with the root password set earlier</li>
  64. <li>Run the following commands to create the database and database user
  65. <div class="codeBlock">CREATE DATABASE umami DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;<br />
  66. GRANT ALL ON umami.* TO &#39;umami_rw&#39;@&#39;localhost&#39; IDENTIFIED BY &#39;um@m1!&#39;;<br />
  67. FLUSH PRIVILEGES;<br />
  68. EXIT;<br />
  69. exit</div>
  70. </li>
  71. <li>Continue with the following commands:
  72. <div class="codeBlock"># install git<br />
  73. sudo apt install git -y<br />
  74. # cd back to home<br />
  75. cd ~<br />
  76. # clone umami github repo<br />
  77. git clone https://github.com/mikecao/umami.git<br />
  78. # cd into git clone<br />
  79. cd umami<br />
  80. # import database structure<br />
  81. mysql -u umami_rw -p umami &lt; sql/schema.mysql.sql<br />
  82. # install dependencies<br />
  83. npm install<br />
  84. # create and edit .env<br />
  85. nano ./.env</div>
  86. </li>
  87. <li>Paste the following into .env
  88. <p>DATABASE_URL=mysql://umami_rw:um@m1!@localhost:3306/umami<br />
  89. HASH_SALT=SomethingSecure</p>
  90. </li>
  91. <li>Press CTRL+O, Enter, CTRL+X to write the changes to .env</li>
  92. <li>Continue with the following commands:
  93. <div class="codeBlock"># build umami<br />
  94. npm run build<br />
  95. # run umami<br />
  96. npm start</div>
  97. </li>
  98. <li>Open a web browser and navigate to http://DNSorIP:3000</li>
  99. <li>Login with the username admin and password umami</li>
  100. <li>Navigate to Settings &gt; Profile and click the Change Password button</li>
  101. <li>Enter the current password (umami) and enter and confirm the new password &gt; Click save</li>
  102. </ol> </div>
  103. </div>
  104. </body>
  105. </html>