top of page
BackGround_DarkMap.jpg

RUN SAP BETTER

Homelab

Raspberry PI | Imager

​

Raspberry Imager

​

  • Download Raspberry PI Imager | Path: https://www.raspberrypi.com/software/

  • ​Install Raspberry Imager

    • Insert the Micro SSD in the laptop​

    • Run the Raspberry Imager​

      • Select the Device

      • Select the Operating System

      • Select the Storage

​​After the installation is done, you just need to insert the Micro SSD on Raspberry PI and power it.

Uptime Kuma | Monitoring Tool

 

​Uptime Kuma is an open-source monitoring tool that can track the health of websites, applications, and APIs. It can monitor services over HTTP/S, TCP, DNS, and other protocols. 
 

Features

​

  • Notifications: Uptime Kuma can send notifications via email, Telegram, Discord, Gotify, Slack, Pushover, and more than 90 other notification services​​

  • Status pages: Uptime Kuma allows users to create custom status pages to share information about service health and manage incidents

  • Scalability: Uptime Kuma can be deployed on any cloud or on-premise

  • Security: Uptime Kuma is secure

  • Data storage: Uptime Kuma uses a local SQLite database to store user data and service configuration

​

Installing Uptime Kuma on Docker

​

  • Open the terminal

  • For non-root users, use the command "sudo" to perform administrative tasks​

  • Update Repository | Command: apt update

  • (Optional) Install 'Docker', if you don't have it | Command: apt install docker-io

  • Install 'Uptime Kuma' using 'Docker' | Command: docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1

  • Accessing 'Uptime Kuma' | Hyperlink: http://<ip-address>:3001

​

Accessing Uptime Kuma over Internet

​

In order to expose Uptime Kuma to the web securely, you can reverse proxy it using a Tunnel (like CloudFlare Tunnel).

​

Monitoring

​

  • HTTP(s)

    • Advanced Status Code

      • 200-299 Range: Page is OK (Use this to your webpage)

      • 400-499 Range: Problem with the Client (Problem is with your Computer)

      • 500-599 Range: Problem with the Server

  • HTTP(s) - Keyword

    • It will monitor and search an specific word in your webpage, if the word is not found it will considered your webpage down

  • DNS

    • You can monitor your DNS Resolver (Like AdGuard or Pi-Hole)

    • You can insert a webpage, and you DNS Resolver and port

Prometheus | Telemetry

 

Prometheus is a free software application used for event monitoring and alerting. It records metrics in a time series database built using an HTTP pull model, with flexible queries and real-time alerting.

​​

Prometheus Components

​​

  • Prometheus Server

    • Prometheus server is a first component of Prometheus architecture

    • Prometheus server is a core of Prometheus architecture which is divided into several parts like Storage, PromQL, HTTP server, etc

    • In Prometheus server data is scraped from the target nodes and then stored in the database

    • Storage

      • Storage in Prometheus server has a local on disk storage

      • Prometheus has many interfaces that allow integrating with remote storage systems

    • PromQL

      • Prometheus uses its own query language i.e. PromQL which is very powerful querying language

      • PromQL allows the user to select and aggregate the data

  • Service Discovery

    • Next and very important component of Prometheus Server is the Service Discovery

    • With the help of Service discovery the services are identified which are need to scraped

    • To Pull metrics, identification of services and finding the targets are compulsory needed

    • Through Service discovery we monitor the entities and can also locate its targets

  • Scrape Target

    • Once the services are identified and the targets are ready then we can pull metrics from it and can scrape the target

    • We can export the data of end point using node exporters

    • Once the metrics or other data is pulled, Prometheus stores it in a local storage

  • Alert Manager

    • Alert Manager handles the alerts which may occurs during the session

    • Alert manager handles all the alerts which are sent by Prometheus server

    • Alert manager is one of the very useful component of Prometheus tool

    • If in case any big error or any issue occurs, alert manager manage those alerts and contact with human via E-mail, Text Messages, On-call, or any other chat application service

  • User Interface

    • User interface is also a important component as it builds a bridge between the user and the system

    • In Prometheus, user interface are note that much user friendly and can be used till graph queries

    • For good exclusive dashboards Prometheus works together with Grafana (visualization tool)

    • Using Grafana over Prometheus to visualize properly we can use custom dashboards

    • Grafana dashboards displays via pie charts, line charts, tables, good data graphs of CPU usage, RAM utilization, network load, etc with indicators

    • Grafana supports and run with Prometheus by querying language i.e. PromQL

    • To fetch data from Prometheus and to display the results on Grafana dashboards PromQL is used

  • What is Grafana ?

    • Grafana is a free and open source visualization tool mostly used with Prometheus to which monitor metrics

    • Grafana provides various dashboards, charts, graphs, alerts for the particular data source

    • Grafana allows us to query, visualize, explore metrics and set alerts for the data source which can be a system, server, nodes, cluster, etc

    • We can also create our own dynamic dashboard for visualization and monitoring

    • We can save the dashboard and can even share with our team members which is one of the main advantage of Grafana

  • What is Node Exporter ?

    • Node exporter is one of the Prometheus exporters which is used to expose servers or system OS metrics

    • With the help of Node exporter we can expose various resources of the system like RAM, CPU utilization, Memory Utilization, disk space

    • Node exporter runs as a system service which gathers the metrics of your system and that gathered metrics is displayed with the help of Grafana visualization tool

​

Architecture


This diagram illustrates the architecture of Prometheus and some of its ecosystem components

​

Implementation Summary

​

​

Installing Prometheus on Ubuntu

​

​​

Organizing Prometheus Directories

​

  • Create a System User for Prometheus

    • Command: groupadd --system prometheus

    • Command: useradd -s /sbin/nologin --system -g prometheus prometheus

  • Create Directories for Prometheus

    • Command: mkdir /etc/prometheus

    • Command: mkdir /var/lib/prometheus

  • Move the Binary Files

    • Command: mv prometheus /usr/local/bin

    • Command: mv promtool /usr/local/bin

  • Move the Configuration Files

    • Command: mv consoles /etc/prometheus

    • Command: mv console_libraries /etc/prometheus

    • Command: mv prometheus.yml /etc/Prometheus

  • Set Owner

    • Command: chown prometheus:prometheus /usr/local/bin/prometheus

    • Command: chown prometheus:prometheus /usr/local/bin/promtool

    • Command: chown prometheus:prometheus /etc/prometheus

    • Command: chown -R prometheus:prometheus /etc/prometheus/consoles

    • Command: chown -R prometheus:prometheus /etc/prometheus/console_libraries

    • Command: chown -R prometheus:prometheus /var/lib/prometheus

​

Configuring Prometheus

​

  • Change Prometheus configuration file | Command: nano /etc/prometheus/prometheus.yml

    • Content: Check the content below

  • Create Prometheus Systemd Service | Command: nano /etc/systemd/system/prometheus.service

    • Content: Check the content below​

  • Reload Systemd | Command: systemctl daemon-reload

  • Enable Prometheus | Command: systemctl enable prometheus

  • Start Prometheus | Command: systemctl start prometheus

  • (Optional) Check Prometheus Status | Command: systemctl status prometheus

​​

TipsIf you later make any changes to "prometheus.services", you will need to:

  • Reload Systemd | Command: systemctl daemon-reload

  • Restart Prometheus | Command: systemctl restart prometheus

​

Content of  "prometheus.yml"

​

# --- Starting on the next line ->

# Global Configuration
global:
  scrape_interval: 15s # By default, scrape targets every 15 seconds.
  evaluation_interval: 15s # Evaluate rules every 15 seconds.


# Attach these labels to any time series or alerts when communicating with
# external systems (federation, remote storage, Alertmanager).

  external_labels:
    monitor: 'codelab-monitor'

 

# Alertmanager configuration
alerting:
  alertmanagers:
    - static_configs:
        - targets:
          # - alertmanager:9093

 

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

 

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  - job_name: 'prometheus'
    scrape_interval: 5s
    static_configs:
      - targets: ['localhost:9090']

 

# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
# Override the global default and scrape targets from this job every 5 seconds.

# --- End ---

​

Content of  "prometheus.service"

​

# --- Starting on the next line ->

[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target

 

[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/prometheus \
--config.file /etc/prometheus/prometheus.yml \
--storage.tsdb.path /var/lib/prometheus/ \
--web.console.templates=/etc/prometheus/consoles \
--web.console.libraries=/etc/prometheus/console_libraries
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure

RestartSec=5s

 

[Install]
WantedBy=multi-user.target

# --- End ---

 

Node Exporter Monitor for Linux

 

  • Open the terminal on the server you want to monitor

  • For non-root users, use the command "sudo" to perform administrative tasks​

  • Create a user named "nodeuser" | Command: useradd --no-create-home --shell /bin/false nodeuser

    • Options: "--no-create-home" and "--shell /bin/false" will ensure that no home directory is created for this user, and this user cannot login to the server

  • Download Node Explorer | Command: wget https://github.com/prometheus/node_exporter/releases/download/v1.8.2/node_exporter-1.8.2.linux-amd64.tar.gz

    • Check the latest version before downloading

  • Extract the files | Command: tar xvfz node_exporter-*.*-amd64.tar.gz

  • Go to directory | Command: cd node_exporter-*.*-amd64

  • Move the directory | Command: mv node_exporter /usr/local/bin/

  • ​Secure the directory | Command: chown -R nodeuser:nodeuser /usr/local/bin/node_exporter

  • Manage the Node Exporter instance with Systemd | Command: nano /etc/systemd/system/node_exporter.service

    • Content: Check the content below​

  • Reload the systemd configuration | Command: systemctl daemon-reload

  • Start the Node Exporter service | Command: systemctl start node_exporter

  • Enable Node Exporter to start on boot | Command: systemctl enable node_exporter

  • (Optional) Check Node Explorer | Command: systemctl status node_exporter

  • (Optional) Check Metrics | Command: curl http://<node-ip-address>:9100/metrics

    • Or you can check using your browser | URL: http://<node-ip-address>:9100/metrics

​​

Content of  "node_exporter.service"

​

# --- Starting on the next line ->

[Unit]
Description=Node Exporter Service
After=network.target

 

[Service]
User=nodeuser
Group=nodeuser
Type=simple
ExecStart=/usr/local/bin/node_exporter
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure

 

[Install]
WantedBy=multi-user.target

# --- End ---

​

Configuring Prometheus to Scrape Node Exporter

​

  • Open the terminal on the Prometheus

  • For non-root users, use the command "sudo" to perform administrative tasks​

  • Config Node on Prometheus | Command: nano /etc/prometheus/prometheus.yml

    • Add the lines in the "scrape_configs" section, after the "prometheus" job_name config: Check below

  • Restart Prometheus | Command: systemctl restart prometheus

  • Check the Telemetry em Prometheus | URL: http://<prometheus-ip-address>:9090

    • Go to menu: Status -> Targets

​

Content of  "prometheus.yml"

​

# --- Starting on the next line ->

  - job_name: 'node'
    scrape_interval: 5s
    static_configs:
      - targets: ['<node-ip-address>:9100']

# --- End ---

​​

Tips: If you need add a second linux node, you just need to install the node_exporter and add one more "target" line on "prometheus.yml" file

​

Node Exporter Monitor for Windows

​​

  • Check the last version of node explorer for windows

  • Download the ".msi" file

  • Install it on windows machine

​

Configuring Prometheus to Scrape Node Exporter

​

  • Open the terminal on the Prometheus

  • For non-root users, use the command "sudo" to perform administrative tasks​

  • Config Node on Prometheus | Command: nano /etc/prometheus/prometheus.yml

    • Add the lines in the "scrape_configs" section, after the "prometheus" job_name config: Check below

  • Restart Prometheus | Command: systemctl restart prometheus

  • Check the Telemetry em Prometheus | URL: http://<prometheus-ip-address>:9090

    • Go to menu: Status -> Targets

​

Content of  "prometheus.yml"

​

# --- Starting on the next line ->

  - job_name: 'windows'
    scrape_interval: 5s
    static_configs:
      - targets: ['<node-ip-address>:9182']

# --- End ---

Grafana | Telemetry


Grafana is a multi-platform open source analytics and interactive visualization web application. It can produce charts, graphs, and alerts for the web when connected to supported data sources.

​

Official Installation URL: https://grafana.com/docs/grafana/latest/setup-grafana/installation/debian/

 

Hardware recommendations:

  • Minimum recommended memory: 512 MB

  • Minimum recommended CPU: 1

​

Supported operating systems:

  • Debian or Ubuntu

  • Red Hat, RHEL, or Fedora

  • SUSE or openSUSE

  • macOS

  • Windows

​

Installing Grafana on Ubuntu

​

  • Open the terminal

  • For non-root users, use the command "sudo" to perform administrative tasks​

  • Update Repository | Command: apt update

  • Install the prerequisite packages | Command: apt-get install -y apt-transport-https software-properties-common wget

  • Import the GPG key

    • Command: mkdir -p /etc/apt/keyrings/

    • Command: wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/grafana.gpg > /dev/null

  • To add a repository for stable releases | Command: echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list​

  • Update the list of available packages | Command: apt-get update

  • To install Grafana OSS | Command: apt-get install grafana

  • Accessing Grafana | URL: http://<ip-address>:3000

​​

Setting Up Prometheus Telemetry on Grafana

​

  • Open Grafana UI | URL: http://<grafana-ip-address>:3000

  • Go to Menu: Connections -> Data Sources

    • Add New Data Source

    • Choose Prometheus

    • Provide URL: http://<prometheus-ip-address>:9090

​

Warning: Prometheus just need to added once. All Nodes will be pushed via Prometheus

​

Uninstalling Grafana

​​

  • Open the terminal

  • For non-root users, use the command "sudo" to perform administrative tasks​

  • Stop the systemd service | Command: systemctl stop grafana-server

  • Stop the init.d service | Command: service grafana-server stop

  • Uninstall Grafana OSS Command: apt-get remove grafana

  • (Optional) Remove the Grafana repository | Command: rm -i /etc/apt/sources.list.d/grafana.list​

Postfix | Mail Transfer Agent (MTA)

 

Postfix is a free and open-source mail transfer agent that routes and delivers electronic mail.

​

Setting Up Postfix with Gmail Relay (Ubuntu)

​

  • Open the terminal

  • For non-root users, use the command "sudo" to perform administrative tasks​

  • Update Repository | Command: apt update

  • Install the Postfix and the authentication module "libsasl2-modules" package | Command: apt install libsasl2-modules postfix

    • When requested, select option: 2 Internet Site

    • When requested, insert a hostname: <hostname>

      • Example: home.arpa

      • Check below where the hostname will be displayed in the email

  • (Optional) If you already have the postfix, or after the installation if the postfix configuration Wizard does not show up automatically, you can run the Wizard, and choose the options above | Command: dpkg-reconfigure postfix

  • (Optional) Check the Postfix service status | Command: service postfix status​

  • Generate the Gmail App Password (action perform in your own gmail account)

  • Create a file with SMTP Host, Port, Username and Password

    • Open or create a file | Command: nano /etc/postfix/sasl/sasl_passwd

    • Create a line | Line: [smtp.gmail.com]:587 <gmail-address>:<gmail-app-password>

  • Create the hash db file for Postfix | Command: postmap /etc/postfix/sasl/sasl_passwd

    • (Optional) You can check the file created | File: /etc/postfix/sasl/sasl_passwd.db

  • Secure Your Postfix Hash Database file

    • Change the permission for root user | Command: chown root:root /etc/postfix/sasl/sasl_passwd.db

    • Change the permission Read and Write for owner | Command: chmod 0600 /etc/postfix/sasl/sasl_passwd.db

    • (Optional) Check permission | Command: ls -l /etc/postfix/sasl/sasl_passwd.db

      • It should be like this "-rw------- 1 root root Jan 01 12:00 sasl_passwd.db"

  • Delete the plain text file for safety measure | Command: rm /etc/postfix/sasl/sasl_passwd

  • Configure the Postfix Relay Server | Command: nano /etc/postfix/main.cf

    • Find and change this lines, or create them if necessary

      • relayhost = [smtp.gmail.com]:587

      • # Enable SASL authentication

      • smtp_sasl_auth_enable = yes

      • # Disallow methods that allow anonymous authentication

      • smtp_sasl_security_options = noanonymous

      • # Location of sasl_passwd

      • smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd

      • # Enable STARTTLS encryption

      • smtp_tls_security_level = encrypt

      • # Location of CA certificates

      • smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

  • Restart Postfix | Command: systemctl restart postfix

  • Install 'mailutils' | Command: apt install mailutils

    • 'Mailutils' is a set of utilities and daemons that allows users to manage email from the command line or Linux terminal

    • You will need 'mailutils' to use the command 'mail' to send emails

​​​​​

Tips

​

  • Check where the Hostname will appear in the email

    • Go to the Gmail and select the email

    • Click in More > Show Original

    • The Hostname will be displayed in these lines:

      • Received: from xxxxx.home.arpa ([xxx.xxx.xxx.xxx])

      • X-Google-Original-From: root@home.arpa (Cron Daemon)

      • Received: by xxxxx.home.arpa (Postfix, from userid 0) id xxxxxxxxxx; Sun, 01 Jan 2000 12:00:00 +0000 (GMT)

      • Message-Id: <20000101120000.xxxxxxxxxx@xxxxx.home.arpa>

​

Sending Emails

​

  • Open the terminal

  • Sending an email | Command: echo "[email body]" | mail -s "[subject]" [recipient]

​

Changing the Mail Header

​

  • Open the terminal

  • For non-root users, use the command "sudo" to perform administrative tasks​

  • Install Postfix PCRE | Command: apt install postfix-pcre

  • Update or Create the Header | Command: nano /etc/postfix/smtp_header_checks

    • Add line: /^From:*/ REPLACE From: <senders-name> <senders-email>

    • Example: /^From:*/ REPLACE From: JohnSmith johnsmith@gmail.com

    • <senders-email> it doesn't matter. It will be replaced automatically

  • Update the Postfix config | Command: nano /etc/postfix/main.cf

    • Add line: smtp_header_checks = pcre:/etc/postfix/smtp_header_checks

​

Configuring Crontab to send automatic emails

​

  • Open the terminal

  • Open Crontab | Command: crontab -e

    • Insert this line above your jobs | Line: MAILTO=<your-email-address>

  • Ctrl+X and Save it

  • Now, every time a Cron Job is executed, an email will be sent to the selected email with the output of the execution​​

BGInfo | Computer Info on Wallpaper

 

​BGInfo is a tool that displays a Windows computer's configuration information on the desktop wallpaper. It's part of Sysinternals and is often used by system administrators in large enterprises.


BGInfo can display information such as: Computer name, IP address, Service pack version, OS version, and Hostname. 
 

Requirements

​

  • Client: Windows 8.1 and higher

  • Server: Windows Server 2012 and higher

​

Warning: BGInfo has issues with some wallpapers extension, like '.png', try using '.jpg'

​

To use BGInfo

​

  • Download BGInfo from the Sysinternals website

  • Extract the ZIP file contents 

    • Suggested Folder: 'C:\Program Files\BGInfo\'

  • Run BGInfo and configure it to your needs

  • Click OK to save your configuration

    • (Option) You can save a '.bgi' file to transfer to another computer

  • View your system information on your desktop background 

​

Custom User Defined Fields

​

  • Architecture | WMI Query | SELECT OSArchitecture FROM Win32_OperatingSystem

    • Example: 64-bit

  • BootDevice | WMI Query | SELECT BootDevice FROM Win32_OperatingSystem

  • NumbProcess| WMI Query | SELECT NumberOfProcessors FROM Win32_ComputerSystem

  • ProcessName | WMI Query | SELECT Name FROM Win32_Processor

  • BIOSDate | Registry Value | HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS\BIOSReleaseDate

  • BoardProduct | Registry Value | HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS\BaseBoardProduct

  • SystemFamily | Registry Value | HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS\SystemFamily

  • Edition | Registry Value | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName

  • Version | Registry Value | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DisplayVersion

  • LastUpdatePurge | Registry Value | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\LastDownloadsPurgeTime

​

Auto Update the Display

 

Windows Startup

​​​

  • Create a shortcut

    • Example 1 | Target | "C:\Program Files\BGInfo\Bginfo64.exe" /timer:0 /silent

    • Example 2 | Target | "C:\Program Files\BGInfo\Bginfo64.exe" Bginfo64.bgi /timer:0 /silent

    • Example 3 | Target | "C:\Program Files\BGInfo\Bginfo64.exe" "C:\Program Files\BGInfo\Bginfo64.bgi" /timer:0 /silent /nolicprompt

    • (Optional) Change the Run Mode | Run: Minimized

  • Put the shortcut on | C:\ProgramData\Microsoft\Microsoft\Windows\Start Menu\ Programs\Startup

​

Registry Editor

​

  • Search Bar | Application: regedit 

  • Go to | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

  • Create a New 'Expandable String Value'

    • Name: BGInfo

    • Value Data: C:\Program Files\BGInfo\Bginfo64.bgi /timer:0 /silent /nolicprompt

​

Parameters

​

  • <path> | Specifies the name of a configuration file to use for the current session. Changes to the configuration are automatically saved back to the file when OK or Apply is pressed. If this parameter is not present BGInfo uses the default configuration information which is stored in the registry under the current user ("HKEY_CURRENT_USER\Software\Winternals\BGInfo")

  • /timer | Specifies the timeout value for the countdown timer, in seconds.

    • Example 1 | /timer:10 | Specifying 10 or no timer (default) will update the display in 10 seconds

    • Example 2 | /timer:0 | Specifying zero will update the display without displaying the configuration dialog

    • Example 3 | /timer:300 |Specifying 300 seconds or longer disables the timer altogether

  • /popup | Causes BGInfo to create a popup window containing the configured information without updating the desktop. The information is formatted exactly as it would if displayed on the desktop, but resides in a fitted window instead. When using this option the history database is not updated

  • /silent | Suppresses error messages

  • /taskbar | Causes BGInfo to place an icon in the taskbar's status area without updating the desktop. Clicking the icon causes the configured information to appear in a popup window. When using this option the history database is not updated

  • /all | Specifies that BGInfo should change the wallpaper for any and all users currently logged in to the system. This option is useful within a Terminal Services environment, or when BGInfo is scheduled to run periodically on a system used by more than one person (see Using a Schedule below)

  • /log | Causes BGInfo to write errors to the specified log file instead of generating a warning dialog box. This is useful for tracking down errors that occur when BGInfo is run under the scheduler

  • /rtf | Causes BGInfo to write its output text to an RTF file. All formatting information and colors are included

  • /nolicprompt | EULA (End User License Agreement) is not prompted for new users

  • /accepteula | EULA (End User License Agreement) is automatically accepted for new users

Pi Hole (DNS Sinkhole)

 

Installing Pi Hole o n Ubuntu

​

  • Open the terminal

  • For non-root users, use the command "sudo" to perform administrative tasks​

  • Update Package Database | Command: apt update

  • Install 'curl' to download the Application | Command: apt install curl

  • Install Pi-Hole | Command: curl -sSL https://install.pi-hole.net | bash

  • Follow the steps to conclude the installation

  • Pi-Hole will be installed and the initial password will be displayed on the screen

  • Changing the Initial Password | Command: pihole -a -p

​

Installing Pi Hole on Docker Container

​

PowerShell Command:

​​

  • Open the terminal

  • For non-root users, use the command "sudo" to perform administrative tasks​

  • Install Pi-Hole | Command: docker run -d --name pihole -p 53:53/tcp -p 53:53/udp -p 80:80 -p 443:443 -e TZ="Europe/London" -v "$(pwd)/etc-pihole/:/etc/pihole/" -v "$(pwd)/etc-dnsmasq.d/:/etc/dnsmasq.d/" --restart=unless-stopped pihole/pihole:latest

  • docker run -d (Run Docker)

  • --name pihole (Container Name)

  • -p 53:53/tcp (Ports to expose. The 53 and 80 are the bare minimum ports required for Pi-holes HTTP and DNS services)

  • -p 53:53/udp

  • -p 80:80

  • -p 443:443

  • -e TZ="Europe/London" (Timezone)

  • -v "$(pwd)/etc-pihole/:/etc/pihole/" (Volume  and $(pwd) for your Pi-hole configs help persist changes across docker image updates)

  • -v "$(pwd)/etc-dnsmasq.d/:/etc/dnsmasq.d/" (Volume  and $(pwd) for your Pi-hole configs help persist changes across docker image updates)

  • --restart=unless-stopped (Automatically (re)start your Pi-hole on boot or in the event of a crash)

  • pihole/pihole:latest (Image of the Pi Hole and the tag latest  to always get the latest release)

​

Automatic Ad List Updates: Since the 3.0+ release, "cron" is baked into the container and will grab the newest versions of your lists and flush your logs. Set your TZ environment variable to make sure the midnight log rotation syncs up with your timezone's midnight.

​

Accessing the Pi Hole

​

URL: http://pi.hole/admin

​

If the URL doesn't work you can check the "IPCONFIG" Command Prompt, the IPv4 of your LAN (main server)

​

Example: 192.168.0.101/admin

​

Initial Password

​

Since we didn't use the variable to set the password, Pi Hole generates a random one.

 

Check the password:

  • Open your Docker Container

  • Containers

  • Click on Pi Hole Container

  • Logs tab

  • Search for assigned random password

    • Line example: [i] Assigning random password: 5Tg45Gd9

​

Changing the Password:

  • You don't need the initial password to change it

  • Just need to type the command: docker exec -it <pihole_container_name> pihole -a -p (in our case the name is pihole)

  • And a prompt will request the new password

​

Command:

​

docker exec -it pihole pihole -a -p

​

Using the Pi Hole

​

You can use the same IP address that you are using to access the Pi Hole Web GUI to put as a DNS in your laptop, mobile or pfSense.

AdGuard Home (DNS Sinkhole)

​

What is AdGuard Home?

​

It is a DNS Resolver and DNS Sinkhole. In other words, AdGuard Home is a application for blocking ads & tracking.

​

It will replace the IP of your DNS server, querying major DNS providers such as Google (8.8.8.8), Cloudflare (1.1.1.1), with the correct IP address for your devices (DNS Resolver). But with one difference, it will block ads and tracking IPs by changing it to (0.0.0.0), a non-existent IP address (DNS Sinkhole).

​

Benefits

  • Privacy (Tracking Blocking)

  • Reduction of Ads

  • Increasing network speed (IP 0.0.0.0 won't download anything)

​

Installing on Docker

​

Warning: According with AdGuard documentation, the application has no drivers to work on Windows Docker, it must be installed on Docker on Linux-based system.

​

Pull the Docker Image

​

docker pull adguard/adguardhome

​

Create and Run the Container

​

docker run --name adguardhome --restart unless-stopped -v /my/own/workdir:/opt/adguardhome/work -v /my/own/confdir:/opt/adguardhome/conf -p 53:53/tcp -p 53:53/udp -p 67:67/udp -p 68:68/udp -p 80:80/tcp -p 443:443/tcp -p 443:443/udp -p 3000:3000/tcp -p 853:853/tcp -p 784:784/udp -p 853:853/udp -p 8853:8853/udp -p 5443:5443/tcp -p 5443:5443/udp -d adguard/adguardhome

​

  • docker run --name adguardhome

  • --restart unless-stopped

  • -v /my/own/workdir:/opt/adguardhome/work

  • -v /my/own/confdir:/opt/adguardhome/conf

  • -p 53:53/tcp -p 53:53/udp

  • -p 67:67/udp -p 68:68/udp

  • -p 80:80/tcp -p 443:443/tcp -p 443:443/udp -p 3000:3000/tcp

  • -p 853:853/tcp

  • -p 784:784/udp -p 853:853/udp -p 8853:8853/udp

  • -p 5443:5443/tcp -p 5443:5443/udp

  • -d adguard/adguardhome

​

Installing on Linux-based Systems (Ubuntu, Raspberry Pi OS)

​

1 Option using "curl"

​​

  • Open the terminal

  • For non-root users, use the command "sudo" to perform administrative tasks​

  • Update Package Database | Command: apt update

​

2 Option using "snapd"

​​

  • Open the terminal

  • For non-root users, use the command "sudo" to perform administrative tasks​

  • Update Repository | Command: apt update

  • (Optional) If you don't have "snap", install it | Command: apt install snapd

    • Verify if you have "snap" | Command: snapd --version

  • Install AdGuard | Command: snap install adguard-home

  • Accessing AdGuard

    • Finishing the installation you will see the IP address to access the Web GUI. (It will be the IP address with port 3000)

    • Example: http://127.0.0.1:3000

Plex Media Server

​

Plex Media Server is a free software application that lets you store, organize, and stream your media collection from a central location. It's similar to having your own personal Netflix or Spotify server that you can access from many different devices.

​​

Plex Media Server Ports

​

  • The most important port to make sure your firewall allows is the main TCP port the Plex Media Server uses for communication:

    • Access to the Plex Media Server | TCP: 32400 (required)

  • The following additional ports are also used within the local network for different services:

    • Access to the Plex DLNA Server | UDP: 1900

    • Older Bonjour/Avahi network discovery | UDP: 5353

    • Controlling Plex for Roku via Plex Companion | TCP: 8324

    • Current GDM network discovery | UDP: 32410, 32412, 32413, 32414

    • Access to the Plex DLNA Server | TCP: 32469

​

Installing Plex Server on Ubuntu

​

​

Accessing Plex via Web Browser

​

  • Open your browser

  • And access it using: http://<plex-ip-address>:32400/web

​​

Mount an SMB Share Drive for Plex

​

If you want to map a SMB share drive to be used on Plex, you can check in those link below:

​

Activating Automatic Update

​

On DEB-based distros (Ubuntu, etc.)

​

The PMS package will automatically do all repository setup for you on Debian 10+/Ubuntu 20.04+ installations, including obtaining the package signing key.

​

  • Open the terminal

  • For non-root users, use the command "sudo" to perform administrative tasks​

  • Edit the file | Command: nano /etc/apt/sources.list.d/plexmediaserver.list

  • 1 Option | On the line "#deb https://downloads.plex.tv/repo/deb/ public main" | Uncomment Removing: #

  • 2 Option | On the line "#deb [arch=amd64 signed-by=/usr/share/keyrings/plexmediaserver.gpg] https://downloads.plex.tv/repo/deb/ public main" | Uncomment Removing: #

  • Save it | Ctrl+X, accept the change with "Yes" and press "Enter"

​

Warning: If you have some issues with the updates, probably you are using older versions and you need to perform this follow steps below

​

For pre Debian 10 and Ubuntu 20.04


To enable the Plex Media Server repository only a few terminal commands are required.

​​

  • Open the terminal

  • For non-root users, use the command "sudo" to perform administrative tasks​

  • Command: echo deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list

  • Command: curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -

    • (OPTIONAL) If you don't have the "curl" install it | Command: apt install curl

    • (OPTIONAL) If you get a error about "gnupg" install it | Command: apt install gnupg

  • Update the Repository | Command: apt update

  • Upgrade the Packages | Command: apt upgrade -y

​​

2 Option | using WGET

​

​

RPM-based distros (Fedora, CentOS, etc.)


Inside the RPM package we have silently added a repository configuration file for Plex Media Server to hook up to a repository.

 

  • To enable the repo, edit /etc/yum.repos.d/plex.repo

  • change line 4 from enabled=0 to enabled=1

 

It should look like this:

​

[PlexRepo]

name=PlexRepo

baseurl=https://downloads.plex.tv/repo/rpm/$basearch/

enabled=1

gpgkey=https://downloads.plex.tv/plex-keys/PlexSign.key

gpgcheck=1

​

  • Once you’ve done that you can then update your Plex Media Server to the current public release

  • Run your update program or |Command: yum update

  • Plex Media Server will automatically get updated too

​

On openSUSE

 

After doing the normal steps for RPM-based distributions, openSUSE users will need to make an additional change:

 

  • Open the “Software Repositories” app

  • Find the “PlexRepo” entry

  • Set that entry to Enabled and Auto Refresh

Zabbix | Monitoring Tool

 

Zabbix is an open-source software tool to monitor IT infrastructure such as networks, servers, virtual machines, and cloud services. Zabbix collects and displays basic metrics.

​

You can check the official documentation for the free installation on: https://www.zabbix.com/download?os_distribution=ubuntu

​

Installing Zabbix on Ubuntu

​

  • Open the terminal

  • For non-root users, use the command "sudo" to perform administrative tasks​

  • Update Repository | Command: apt update

  • Install Zabbix repository

  • Install Zabbix server, frontend, agent | Command: apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent​

  • (Optional) If you don't have the mySQL

    • Check if you have your mySQL up and running | Command: systemctl status mysql

    • If you don't have it. Install it | Command: apt install mysql-server

    • Otherwise, when you try to perform the next step, after the password, you will face this error | Error: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

  • Create Initial Database | Command: mysql -uroot -p

    • Password: password

    • It will open the mysql command line. Use these lines one by one

    • mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;

    • mysql> create user zabbix@localhost identified by 'password';

    • mysql> grant all privileges on zabbix.* to zabbix@localhost;

    • mysql> set global log_bin_trust_function_creators = 1;

    • mysql> quit;

  • Import initial schema and data | Command: zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix

    • Password: password

    • The screen it will stop for a few minutes. Wait until the command line appears again

  • Disable log_bin_trust_function_creators option after importing database schema | Command: mysql -uroot -p

    • Password: password

    • It will open the mysql command line. Use these lines one by one

    • mysql> set global log_bin_trust_function_creators = 0;

    • mysql> quit;

  • Configure the database for Zabbix server | Command: nano /etc/zabbix/zabbix_server.conf​

    • Insert this line in the right place. You will find the password commented below the user | Line: DBPassword=password

    • If you skip this step, when you login, you will face this web warning | Warning: zabbix server is not running

  • Start Zabbix server and agent processes

    • Restart | Command: systemctl restart zabbix-server zabbix-agent apache2

    • Enable | Command: systemctl enable zabbix-server zabbix-agent apache2

​

Starting with Zabbix

​

  • Open your Browser and access | URL: http://<host-ip-address>/zabbix

  • (Optional) When you choose the language and face an issue, try these steps (This example is for en_US Language)​

    • Check the language | Command: localectl

    • Install Locales | Command: apt install locales

    • Choose the language | Command: locale-gen en_US.UTF-8

    • Select the language | Command: localectl set-locale LANG=en_US.UTF-8

    • Reboot the system | Command: reboot

  • Choose your User and Password​

  • Finish the initial setup

References: Microsoft (www.microsoft.com); GitHub (github.com); Proxmox (www.proxmox.com)

bottom of page