-
-
Save slobsv/a38adbe50e3cacab4407205370d49581 to your computer and use it in GitHub Desktop.
Script to download and install prometheus, create prometheus user. Specifically for Ubuntu linux distributions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# downlaod prometheus | |
wget https://github.com/prometheus/prometheus/releases/download/v2.45.0/prometheus-2.45.0.linux-amd64.tar.gz | |
# create prometheus user and its required directories | |
sudo useradd --no-create-home --shell /bin/false prometheus | |
sudo mkdir /etc/prometheus | |
sudo mkdir /var/lib/prometheus | |
sudo chown prometheus:prometheus /etc/prometheus | |
sudo chown prometheus:prometheus /var/lib/prometheus | |
# unzip and install prometheus | |
tar xvfz prometheus-2.45.0.linux-amd64.tar.gz | |
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 prometheus:prometheus /usr/local/bin/prometheus | |
sudo chown prometheus:prometheus /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 cp -r ./prometheus-2.45.0.linux-amd64/prometheus.yml /etc/prometheus | |
sudo chown -R prometheus:prometheus /etc/prometheus/consoles | |
sudo chown -R prometheus:prometheus /etc/prometheus/console_libraries | |
echo """ | |
Prometheus installation complete. | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment