设置主机名

  1. hostnamectl set-hostname prome-master01
  2. 采用公有云服务器
  3. 172.16.58.78 prome-master01
  4. 172.16.58.79 prome-node01

设置时区

  1. timedatectl
  2. [root@prometheus_master01 ~]# timedatectl
  3. Local time: 2021-03-27 22:39:41 CST
  4. Universal time: 2021-03-27 14:39:41 UTC
  5. RTC time: 2021-03-27 14:39:41
  6. Time zone: Asia/Shanghai (CST, +0800)
  7. NTP enabled: yes
  8. NTP synchronized: yes
  9. RTC in local TZ: no
  10. DST active: n/a
  11. timedatectl set-timezone Asia/Shanghai

关闭防火墙 Selinux

  1. systemctl stop firewalld
  2. systemctl disable firewalld
  3. systemctl status firewalld
  4. setenforce 0
  5. sed -i '/^SELINUX/s/enforcing/disabled/' /etc/selinux/config
  6. getenforce

关闭sshd dns反解

  1. sed -i 's/^#UseDNS yes/UseDNS no/' /etc/ssh/sshd_config
  2. systemctl restart sshd

设置国内yum源

  1. mkdir /tmp/yum_repo_bk
  2. /bin/mv -f /etc/yum.repos.d/* /tmp/yum_repo_bk
  3. # 阿里云源
  4. wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
  5. # epel源
  6. wget -O /etc/yum.repos.d/epel-7.repo https://mirrors.aliyun.com/repo/epel-7.repo
  7. yum makecache

安装常用命令

  1. yum -y install lrzsz yum-utils

创建数据目录

  1. # 安装包目录
  2. mkdir -pv /opt/tgzs
  3. # 程序目录
  4. mkdir -pv /opt/app

设置history文件ulimint

  1. cat <<EOF >> /etc/profile
  2. export HISTFILESIZE=
  3. export HISTSIZE=
  4. EOF
  5. source /etc/profile

设置pip

  1. # windows
  2. %APPDATA%\pip\pip.conf
  3. 先在 windows “文件资源管理器” 地址栏 输入 %APPDATA% 按回车,打开程序自定义设置文件夹
  4. 然后,创建名为 pip 的文件夹,用于存放 pip 配置文件
  5. [global]
  6. index-url=http://mirrors.aliyun.com/pypi/simple/
  7. [install]
  8. trusted-host=mirrors.aliyun.com
  9. # linux
  10. mkdir -pv ~/.pip
  11. cat<< EOF > ~/.pip/pip.conf
  12. [global]
  13. index-url=http://mirrors.aliyun.com/pypi/simple/
  14. [install]
  15. trusted-host=mirrors.aliyun.com
  16. EOF

下载prometheus最新版本包

  1. # 地址
  2. # https://github.com/prometheus/prometheus/releases/tag/v2.25.2
  3. # prometheus
  4. wget -O /opt/tgzs/prometheus-2.25.2.linux-amd64.tar.gz https://github.com/prometheus/prometheus/releases/download/v2.25.2/prometheus-2.25.2.linux-amd64.tar.gz
  5. # node_exporter
  6. wget -O /opt/tgzs/node_exporter-1.1.2.linux-amd64.tar.gz https://github.com/prometheus/node_exporter/releases/download/v1.1.2/node_exporter-1.1.2.linux-amd64.tar.gz
  7. # alertmanager
  8. wget -O /opt/tgzs/alertmanager-0.21.0.linux-amd64.tar.gz https://github.com/prometheus/alertmanager/releases/download/v0.21.0/alertmanager-0.21.0.linux-amd64.tar.gz
  9. # pushgateway
  10. wget -O /opt/tgzs/pushgateway-1.4.0.linux-amd64.tar.gz https://github.com/prometheus/pushgateway/releases/download/v1.4.0/pushgateway-1.4.0.linux-amd64.tar.gz
  11. # process-exporter
  12. wget -O /opt/tgzs/process-exporter-0.7.5.linux-amd64.tar.gz https://github.com/ncabatoff/process-exporter/releases/download/v0.7.5/process-exporter-0.7.5.linux-amd64.tar.gz
  13. # blackbox_exporter
  14. wget -O /opt/tgzs/blackbox_exporter-0.18.0.linux-amd64.tar.gz https://github.com/prometheus/blackbox_exporter/releases/download/v0.18.0/blackbox_exporter-0.18.0.linux-amd64.tar.gz
  15. # redis_exporter
  16. wget -O /opt/tgzs/redis_exporter-v1.20.0.linux-amd64.tar.gz https://github.com/oliver006/redis_exporter/releases/download/v1.20.0/redis_exporter-v1.20.0.linux-amd64.tar.gz
  17. # mysql_exporter
  18. wget -O /opt/tgzs/mysqld_exporter-0.12.1.linux-amd64.tar.gz https://github.com/prometheus/mysqld_exporter/releases/download/v0.12.1/mysqld_exporter-0.12.1.linux-amd64.tar.gz