-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathprometheus-install.sh
29 lines (29 loc) · 1.3 KB
/
prometheus-install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# Installing packages
sudo apt update -y
sudo apt install nginx -y
sudo systemctl start nginx
# Creating users for service
sudo useradd --no-create-home --shell /bin/false prome
# Creating prometheus directories
sudo mkdir /etc/prometheus
sudo mkdir /var/lib/prometheus
# Downloading and extracting files
wget https://github.com/prometheus/prometheus/releases/download/v2.45.0/prometheus-2.45.0.linux-amd64.tar.gz
tar -xvf prometheus-2.45.0.linux-amd64.tar.gz
# Copying files to respective locations and changing permissions
sudo cp prometheus-2.45.0.linux-amd64/prometheus /usr/local/bin/
sudo cp prometheus-2.45.0.linux-amd64/promtool /usr/local/bin/
sudo chown prome:prome /usr/local/bin/prometheus
sudo chown prome:prome /usr/local/bin/promtool
sudo cp -r prometheus-2.45.0.linux-amd64/consoles /etc/prometheus
sudo cp -r prometheus-2.45.0.linux-amd64/console_libraries /etc/prometheus
sudo chown -R prome:prome /etc/prometheus/consoles
sudo chown -R prome:prome /etc/prometheus/console_libraries
sudo chown -R prome:prome /var/lib/prometheus/
sudo cp prometheus.yml /etc/prometheus/prometheus.yml
sudo cp prometheus.service /etc/systemd/system/prometheus.service
# Perform service reloads and starts
sudo systemctl daemon-reload
sudo systemctl start prometheus.service
sudo systemctl enable prometheus.service