Create directory and download binary package
]# mkdir /usr/local/alertmanager-0.20.0.linux-amd64
]# cd /usr/local/alertmanager-0.20.0.linux-amd64
]# wget https://github.com/prometheus/alertmanager/releases/download/v0.20.0/alertmanager-0.20.0.linux-amd64.tar.gz
Write service file
]# vim /usr/lib/systemd/system/alertmanager.service
[Unit]
Description=alertmanager
Documentation=https://prometheus.io/
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
User=prometheus
ExecStart=/usr/local/alertmanager-0.20.0.linux-amd64/alertmanager --config.file=/usr/local/alertmanager-0.20.0.linux-amd64/alertmanager.yml --storage.path=/usr/local/alertmanager-0.20.0.linux-amd64/data
WorkingDirectory=/usr/local/alertmanager-0.20.0.linux-amd64/
Restart=on-failure
[Install]
WantedBy=multi-user.target
--config.file specifies the path to the configuration file
--storage.tsdb.path specifies the path of the data storage
start service
]# systemctl daemon-reload
]# systemctl start alertmanager.service
]# systemctl enable alertmanager.service
Check if the port is displayed
]# ss -anlt
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:*
LISTEN 0 128 [::]:22 [::]:*
LISTEN 0 128 [::]:9093 [::]:*