mkdir prometheus
wget ~~~.tar.gz
wget: 파일 다운로드tar xzvf ~~~.tar.gz
tar: 압축 해제xvf: tar 압축파일 시 사용xzvf: tar.gz 압축파일 시 사용참고: wget 사용 시 파일 우측 클릭 후, 링크 주소 복사를 이용한다

cp prometheus /usr/local/bin/prometheus를 root/usr/local/bin/ 으로 복사 mkdir /var/lib/prometheus/mkdir /etc/prometheus/cp prometheus.yml /etc/prometheus/cp -rf consoles /etc/prometheus/cp -rf console_libraries/ /etc/prometheusr: 복사 대상이 디렉토리이면, 하위 폴더와 파일까지 모두 복사한다f: 이미 있는 경우 덮어 씌우기useradd --no-create-home --shell /bin/false prometheususeradd: --no-create-home: 해당 유저의 home 디렉토리를 만들지 않음--shell SHELL: 새 계정의 로그인 쉘prometheus 라는 유저이다chown -R prometheus:prometheus /var/lib/prometheuschown: 파일이나 디렉토리의 소유자 변경하기:를 구분자로 소유자:그룹 형식으로 사용prometheus(소유자) : prometheus(그룹)/var/lib/prometheus: 소유자를 변경할 디렉토리-R: 하위 디렉토리까지 소유자를 변경chmod 775 /var/lib/prometheuschmod: 파일이나 디렉토리에 권한 부여 및 수정

775: 소유자, 그룹은 모두, 다른 사람은 Read, eXecute만vim /etc/prometheus/prometheus.ymlstatic_configs:
- targets: ["mgt01_IP:9100", "web01_IP:9100", "was01_IP:9100", "dbm01_IP:9100"]vim /etc/systemd/system/prometheus.serviceDescription=Prometheus Monitoring Server
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
systemctl daemon-reloadsystemctl start prometheus.servicesystemctl enable prometheus.servicesystemctl status prometheus.service-ss -pltn | grep prometheus
- 9090 포트 Listen 중
- dbm01 IP:9090