不错的网站建设公司,做网站全程指导,创建网站收费,网页基础设计从 https://prometheus.io/download/ 下载相应版本#xff0c;安装到服务器上官网提供的是二进制版#xff0c;解压就 能用#xff0c;不需要编译
1、下载软件 [rootlocalhost ~]# wget -c https://github.com/prometheus/prometheus/releases/download/v2.45.5/prometheus…从 https://prometheus.io/download/ 下载相应版本安装到服务器上官网提供的是二进制版解压就 能用不需要编译
1、下载软件 [rootlocalhost ~]# wget -c https://github.com/prometheus/prometheus/releases/download/v2.45.5/prometheus-2.45.5.linux-amd64.tar.gz一般访问不了可以先下载在本地再上传到虚拟机上 2、解压软件
[rootlocalhost ~]# tar xf prometheus-2.45.5.linux-amd64.tar.gz -C /usr/local/
创建软连接
[rootlocalhost ~]# ln -sv /usr/local/prometheus-2.45.5.linux-amd64/ /usr/local/prometheus3、创建数据目录
[rootlocalhost prometheus]# mkdir -p /usr/local/prometheus/data4、创建服务运行用户
[rootlocalhost ~]# useradd prometheus -M -s /sbin/nologin
修改权限
[rootlocalhost ~]# chown -R prometheus.prometheus /usr/local/prometheus/*5、创建服务运行脚本
[rootlocalhost ~]# vim /usr/lib/systemd/system/prometheus.service
[Unit]
Descriptionprometheus
Afternetwork.target
[Service]
Typesimple
Userprometheus
ExecStart/usr/local/prometheus/prometheus --config.file/usr/local/prometheus/prometheus.yml --storage.tsdb.path/usr/local/prometheus/data
Restarton-failure
ExecReload/bin/kill -HUP $MAINPID
[Install]
WantedBymulti-user.target
6、启动服务
[rootlocalhost ~]# systemctl daemon-reload
[rootlocalhost ~]# systemctl enable --now prometheus.service检查服务
[rootlocalhost ~]# systemctl is-active prometheus.service
active
[rootlocalhost ~]# systemctl is-enabled prometheus.service
enabled
检查端口
[rootlocalhost ~]# ss -lnupt | grep 9090
tcp LISTEN 0 128 [::]:9090 [::]:*
users:((prometheus,pid63281,fd10))