How to Deploy Prometheus on Your Server

Download all required packages Go to the download page, find these packages as below, https://prometheus.io/download/ Prometheus https://github.com/prometheus/prometheus/releases/download/v2.37.5/prometheus-2.37.5.linux-amd64.tar.gz Alertmanager https://github.com/prometheus/alertmanager/releases/download/v0.24.0/alertmanager-0.24.0.linux-amd64.tar.gz Node_exporter https://github.com/prometheus/node_exporter/releases/download/v1.5.0/node_exporter-1.5.0.linux-amd64.tar.gz Allow 9090 port open ufw allow 9090/tcp ufw reload Configure and start tar xvfz prometheus-2.37.5.linux-amd64.tar.gz cd prometheus-2.37.5.linux-amd64/ mv prometheus-2.37.5.linux-amd64 /usr/local/prometheus useradd -M -s /sbin/nologin prometheus cd /usr/local/prometheus mkdir data chown -R prometheus:prometheus /usr/local/prometheus Add to system service [Unit] Description=Prometheus After=network.target [Service] User=prometheus Group=prometheus WorkingDirectory=/usr/local/prometheus ExecStart=/usr/local/prometheus/prometheus [Install] WantedBy=multi-user.target Save the file to /usr/lib/systemd/system/prometheus....

December 18, 2022 · 3 min · Jingwei Lei

How To Set Up Django with Postgres, Nginx, and Gunicorn on Debian 11

Installing the Packages from the Debian Repositories sudo apt update sudo apt install python3-venv python3-dev libpq-dev postgresql postgresql-contrib nginx curl Creating the PostgreSQL Database and User sudo -u postgres psql CREATE DATABASE myproject; CREATE USER myprojectuser WITH PASSWORD 'password'; ALTER ROLE myprojectuser SET client_encoding TO 'utf8'; ALTER ROLE myprojectuser SET default_transaction_isolation TO 'read committed'; ALTER ROLE myprojectuser SET timezone TO 'UTC'; GRANT ALL PRIVILEGES ON DATABASE myproject TO myprojectuser; \q Creating a Python Virtual Environment for your Project mkdir ~/myprojectdir cd ~/myprojectdir python3 -m venv myprojectenv source myprojectenv/bin/activate pip install django gunicorn psycopg2-binary Creating and Configuring a New Django Project django-admin startproject myproject ~/myprojectdir nano ~/myprojectdir/myproject/settings....

October 9, 2022 · 2 min · Jingwei Lei

How to set up ssh keys on debian 11

Step 1 Create the RSA Key Pair The first step is to create a key pair on the client machine (usually your computer): ssh-keygen By default ssh-keygen will create a 3072-bit RSA key pair, which is secure enough for most use cases (you may optionally pass in the -b 4096 flag to create a larger 4096-bit key). After entering the command, you should see the following output: OutputGenerating public/private rsa key pair....

October 7, 2021 · 9 min · Jingwei Lei