Roll Your Own Google Analytics Alternative with Umami
#Umami #Analytics #NodeJS
Full steps can be found at https://i12bretro.github.io/tutorials/0522.html
--------------------------------------------------------------------
What is Umami
--------------------------------------------------------------------
Umami is a simple, fast, website analytics alternative to Google Analytics. - https://github.com/mikecao/umami
--------------------------------------------------------------------
Installing NodeJS
--------------------------------------------------------------------
01. Log into the Linux device
02. Run the following commands in a terminal window
# download nodejs
wget -O nodejs.tar.xz https://nodejs.org/dist/v14.17.0/node-v14.17.0-linux-x64.tar.xz
# extract nodejs.tar.xz
tar -xJf nodejs.tar.xz
# change directory to extracted folder
cd node-v14.17.0-linux-x64
# copy node binaries to /usr/local
sudo cp -R * /usr/local/
# test node is working
node -v
# test npm is working
npm -v
--------------------------------------------------------------------
Running Umami
--------------------------------------------------------------------
01. Run the following commands in a terminal window
# install MySQL
sudo apt install mariadb-server -y
# configure the MySQL database
sudo su
mysql_secure_installation
02. Press Enter to login as root
03. Type Y and press Enter to set a root password, type the password twice to confirm
04. Type Y and press Enter to remove anonymous users
05. Type Y and press Enter to disallow root login remotely
06. Type Y and press Enter to remove the test database
07. Type Y and press Enter to reload privilege tables
08. Run the following command to login into MySQL:
mysql -u root -p
09. Authenticate with the root password set earlier
10. Run the following commands to create the database and database user
CREATE DATABASE umami DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
GRANT ALL ON umami.* TO 'umami_rw'@'localhost' IDENTIFIED BY 'um@m1!';
FLUSH PRIVILEGES;
EXIT;
exit
11. Continue with the following commands:
# install git
sudo apt install git -y
# cd back to home
cd ~
# clone umami github repo
git clone https://github.com/mikecao/umami.git
# cd into git clone
cd umami
# import database structure
mysql -u umami_rw -p umami ≪ sql/schema.mysql.sql
# install dependencies
npm install
# create and edit .env
nano ./.env
12. Paste the following into .env
DATABASE_URL=mysql://umami_rw:um@m1!@localhost:3306/umami
HASH_SALT=SomethingSecure
13. Press CTRL+O, Enter, CTRL+X to write the changes to .env
14. Continue with the following commands:
# build umami
npm run build
# run umami
npm start
15. Open a web browser and navigate to http://DNSorIP:3000
16. Login with the username admin and password umami
17. Navigate to Settings ≫ Profile and click the Change Password button
18. Enter the current password (umami) and enter and confirm the new password ≫ Click save
### Connect with me and others ###
★ Discord: https://discord.com/invite/EzenvmSHW8
★ Reddit: https://reddit.com/r/i12bretro
★ Twitter: https://twitter.com/i12bretro