标签:col password pidfile for alt 账户 exe pre 源码编译
1.安装包下载
https://www.zabbix.com/download_sources#tab:40LTS
此次使用4.0 LTS
2.安装依赖
yum install -y gcc gcc-c++ libxml2 libxml2-devel OpenIPMI OpenIPMI-devel libevent-devel net-snmp-devel net-snmp* snmptt curl-devel
3.添加用户
useradd -m zabbix
4.创建目录
mkdir -p /zabbix/zabbix/logs
5.编译安装
tar -xf zabbix-4.0.25.tar.gz cd zabbix-4.0.25
#server和agent同时安装 ./configure --prefix=/zabbix/zabbix --enable-server --enable-agent --with-mysql=/zabbix/mysql/mysql/bin/mysql_config --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --with-openipmi make -j4 && make install
6.导入数据
mysql -uzabbix -pzabbixpasswd zabbix < /root/zabbix-4.0.25/database/mysql/schema.sql mysql -uzabbix -pzabbixpasswd zabbix < /root/zabbix-4.0.25/database/mysql/images.sql mysql -uzabbix -pzabbixpasswd zabbix < /root/zabbix-4.0.25/database/mysql/data.sql
7.修改server配置
#复制网页代码 cp -R /root/zabbix-4.0.25/frontends/php/* /zabbix/nginx/html/zabbix #赋权 chmod a+w /zabbix/nginx/html/zabbix/conf
#编辑zabbix_server配置文件 cat > /zabbix/zabbix/etc/zabbix_server.conf << EOF ListenPort=10051 LogFile=/zabbix/zabbix/logs/zabbix_server.log PidFile=/zabbix/zabbix/logs/zabbix_server.pid DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbixpasswd DBPort=3306 DBSocket=/zabbix/mysql/logs/mysql.sock Timeout=4 LogSlowQueries=3000 User=zabbix Include=/zabbix/zabbix/etc/zabbix_server.conf.d/*.conf CacheSize=2G CacheUpdateFrequency=180 HistoryCacheSize=64M HistoryIndexCacheSize=10M TrendCacheSize=128M ValueCacheSize=128M StartPollersUnreachable=20 Timeout=6 EOF
#赋权
chown -R zabbix.zabbix /zabbix/zabbix
#添加systemctl cat > /usr/lib/systemd/system/zabbix-server.service << EOF [Unit] Description=Zabbix Server After=syslog.target After=network.target [Service] Environment="CONFFILE=/zabbix/zabbix/etc/zabbix_server.conf" Type=forking Restart=on-failure PIDFile=/zabbix/zabbix/logs/zabbix_server.pid KillMode=control-group ExecStart=/usr/sbin/zabbix_server -c \$CONFFILE ExecStop=/bin/kill -SIGTERM \$MAINPID RestartSec=10s TimeoutSec=0 [Install] WantedBy=multi-user.target EOF #复制二进制文件至/usr/sbin cp /zabbix/zabbix/sbin/* /usr/sbin/ #添加库文件,不然启动报错 ln -sf /zabbix/mysql/mysql/lib/libmysqlclient.so.20 /usr/lib64
8.启动
systemctl start zabbix-server
#添加开机启动
systemctl enable zabbix-server
9.前端安装
#页面输入ip/index.php
开始安装zabbix_server前端页面
接下来开始登陆,账户密码默认为Admin/zabbix
至此,zabbix-server安装成功,接下来安装本机上的zabbix-agent
10.安装zabbix-agent
zabbix-agent在编译安装zabbix-server时已经同时安装,只需要修改下配置文件即可
#修改zabbix_agent配置文件 cat > /zabbix/zabbix/etc/zabbix_agentd.conf << EOF ListenPort=10050 LogFileSize=1 LogFile=/zabbix/zabbix/logs/zabbix_agentd.log PidFile=/zabbix/zabbix/logs/zabbix_agentd.pid Server=127.0.0.1,192.168.117.132 ServerActive=127.0.0.1,192.168.117.132 Hostname=Zabbix server StartAgents=1 Timeout=5 User=zabbix Include=/zabbix/zabbix/etc/zabbix_agentd.conf.d/*.conf UnsafeUserParameters=1 EOF
#添加systemctl cat > /usr/lib/systemd/system/zabbix-agent.service << EOF [Unit] Description=Zabbix Agent After=syslog.target After=network.target [Service] Environment="CONFFILE=/zabbix/zabbix/etc/zabbix_agentd.conf" Type=forking Restart=on-failure PIDFile=/zabbix/zabbix/logs/zabbix_agentd.pid KillMode=control-group ExecStart=/usr/sbin/zabbix_agentd -c \$CONFFILE ExecStop=/bin/kill -SIGTERM \$MAINPID RestartSec=10s TimeoutSec=0 [Install] WantedBy=multi-user.target EOF
systemctl start zabbix-agent
#添加开机启动
systemctl enable zabbix-agent
页面查看,zabbix-agent状态图标变成绿色,正常
至此zabbix-server和zabbix-agent安装完成
centos7源码编译安装LNMP+ZABBIX4.0LTS(4)——zabbix server+zabbix agent
标签:col password pidfile for alt 账户 exe pre 源码编译
原文地址:https://www.cnblogs.com/old-path-white-cloud/p/13863755.html