@clyde_reichert
Please note that the previous installation steps are outdated. Here is an updated version:
- Update your package lists:
- Download the latest version of Prometheus using curl:
1
|
curl -LO https://github.com/prometheus/prometheus/releases/latest/download/prometheus.tar.gz
|
- Extract the downloaded file:
1
|
tar xvf prometheus.tar.gz
|
- Move into the extracted directory:
- Copy the necessary configuration files:
1
2
|
sudo cp prometheus /usr/local/bin/
sudo cp promtool /usr/local/bin/
|
- Create a dedicated system user for Prometheus:
1
|
sudo useradd -M -r -s /bin/false prometheus
|
- Create the necessary directories and assign ownership to the prometheus user:
1
2
3
4
|
sudo mkdir /etc/prometheus
sudo mkdir /var/lib/prometheus
sudo chown prometheus:prometheus /etc/prometheus
sudo chown prometheus:prometheus /var/lib/prometheus
|
- Move the configuration files to the appropriate directories:
1
|
sudo cp -r consoles/ console_libraries/ /etc/prometheus/
|
- Assign ownership of the directories and files to the prometheus user:
1
2
|
sudo chown -R prometheus:prometheus /etc/prometheus/consoles
sudo chown -R prometheus:prometheus /etc/prometheus/console_libraries
|
- Configure Prometheus:
1
|
sudo nano /etc/prometheus/prometheus.yml
|
- In the configuration file, specify the targets you want to monitor. For example:
1
2
3
4
|
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
|
- Save and close the file (Ctrl+X, then Y, then Enter).
- Assign ownership of the Prometheus directories and files to the prometheus user:
1
2
3
|
sudo chown -R prometheus:prometheus /etc/prometheus/prometheus.yml
sudo chown prometheus:prometheus /usr/local/bin/prometheus
sudo chown prometheus:prometheus /usr/local/bin/promtool
|
- Create a Prometheus systemd service file:
1
|
sudo nano /etc/systemd/system/prometheus.service
|
- Paste the following content into the file:
1
2
3
4
5
6
7
8
9
10
11
12
13
|
[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
[Install]
WantedBy=multi-user.target
|
- Save and close the file (Ctrl+X, then Y, then Enter).
- Reload the systemd daemon:
1
|
sudo systemctl daemon-reload
|
- Start and enable Prometheus:
1
2
|
sudo systemctl start prometheus
sudo systemctl enable prometheus
|
After completing these steps, Prometheus should be installed and running on your Ubuntu system. You can access the Prometheus web interface by entering your server's IP address followed by port 9090 in your web browser's address bar. For example, http://<IP_address>:9090
.