centos7搭建zabbix

参考:https://blog.csdn.net/xiaocong66666/article/details/82818893

安装所需的依赖包即可:
yum install gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre pcre-devel -y    

官网下载源码:

上传到contos7系统

解压: tar -zxvf zabbix-4.0.0.tar.gz

进入解压文件执行安装命令:

./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2

 备注:
--prefix=/usr/local/zabbix  本次安装的路径
--enable-server --enable-agent表示即安装server也安装agent

make&&make install    

# rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
# yum clean all

yum -y install zabbix-server-mysql zabbix-web-mysql

参考网址:https://blog.csdn.net/rujianxuezha/article/details/79842998

 rpm -ivh https://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm

yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-get

cd  /usr/share/doc/zabbix-server-mysql-3.0.28

zcat create.sql.gz | mysql  zabbix

参考网址:https://blog.csdn.net/u013569329/article/details/82685295

移除已经安装的zabbix命令:

yum remove zabbix-release

yum clean all

cd /etc/yum.repos.d/
vim zabbix.repo #看看和操作系统的版本与yum源是否匹配,如果没有该文件就不用管

yum -y install unixODBC (连接数据库的组件,可以不用安装)

wget http://repo.zabbix.com/zabbix/3.4/rhel/6/x86_64/zabbix-release-3.4-1.el6.noarch.rpm
rpm -ivh zabbix-release-3.4-1.el6.noarch.rpm
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent

yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent   --skip-broken

卸载 rpm  中不要的包:https://www.cnblogs.com/wei9593/p/10856899.html

   查看安装的 zabbix 

rpm -qa | grep zabbix

rpm -e zabbix-release-4.0-2.el7.noarch  :rpm -e 命令删除 yum中的rpm包

rpm -e --nodeps  zabbix-release-4.0-2.el7.noarch :rpm -e --nodeps 强制删除

卸载安装错的zabbix: find / -name zabbix

删除 cd /etc/yum.repos.d/   下的 zabbix.repo文件

yum -y update   :更新yum为最新

cat /etc/redhat-release

cat /proc/version    看版本,看内核

关闭selinux 

vi /etc/selinux/config    #将SELINUX=enforcing改为SELINUX=disabled 设置后需要重启才能生效

setenforce 0       #临时关闭命令

getenforce         #检测selinux是否关闭,Disabled 为关闭

firewall-cmd --state 

systemctl stop firewalld.service    #临时关闭firewall
systemctl disable firewalld.service #禁止firewall开机启动

cd /etc/yum.repos.d/       cat zabbix.repo 查看文件夹下的zabbix.repo文件

1.服务器已经安装lampp

2.在监控机创建监控数据库并授权

mysql -u root 
mysql> create database zabbix default character set utf8;
mysql> grant select,insert,update,delete,create on zabbix.* to 'zabbix_user'@'localhost' identified by '123456';
mysql>grant all privileges on *.* to 'zabbix_user'@'%' identified by '123456';
mysql> flush privileges;
    quit;      退出数据库命令
 
按 ctrl+z:退出数据库
 
 
zabbix安装命令:
 
# rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
# yum clean all
# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
   yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent  --skip-broken
 
 
创建数据库及访问的用户名和密码:
# mysql -uroot -p
password
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'password';
mysql> quit;
 
 
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql zabbix    :创建数据库 中zabbix 库中的表
 
配置/etc/zabbix/zabbix_server.conf:
### Option: DBPassword
#    Database password.
#    Comment this line if no password is used.
#
# Mandatory: no
# Default:
# DBPassword=

修改为

### Option: DBPassword
#    Database password.
#    Comment this line if no password is used.
#
# Mandatory: no
# Default:
DBPassword=password
e. Configure PHP for Zabbix frontend

Edit file /etc/httpd/conf.d/zabbix.conf, uncomment and set the right timezone for you. # php_value date.timezone Europe/Riga

f. Start Zabbix server and agent processes

Start Zabbix server and agent processes and make it start at system boot:

# systemctl restart zabbix-server zabbix-agent httpd
# systemctl enable zabbix-server zabbix-agent httpd

Now your Zabbix server is up and running!

Zabbix 4.0 LTS下载地址:https://www.zabbix.com/download_sources#tab:40LTS

参考官网:https://www.zabbix.com/download?zabbix=4.0&os_distribution=centos&os_version=7&db=mysql

 
 
 
 
原文地址:https://www.cnblogs.com/jingzaixin/p/11856457.html