yum安装zabbix4.2别来无恙
yum部署zabbix-server4.2
前面写到过在已有的lnmp环境下源码部署zabbix-server4.0,这次就写一篇yum部署zabbix-server+mysql的结合。
环境说明:
1.这里我所使用的MySQL版本为8版本,系统版本为CentOS7.4系列操作系统
部署MySQL
1、配置MySQL yum源,由于官网源下载很慢,所以这里使用清华大学的镜像源
# cat > /etc/yum.repos.d/mysql-community.repo <<EOF[mysql
-connectors-community]name
=MySQL Connectors Communitybaseurl
=https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-connectors-community-el7/enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[mysql80-community]
name=MySQL 8.0 Community Server
baseurl=https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql80-community-el7/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
EOF
2、更新yum源
# yum clean all#
yum makecache
3、安装MySQL
# yuminstall mysql-community-server -y
4、启动MySQL
# systemctl start mysqld# systemctl enable mysqld
5、查看初始密码并修改密码
# grep password /var/log/mysqld.log 2020-03-31T08:46:17.270127Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: iwZgfDKdc1-N# mysql
-u root -p...
mysql
> ALTER USER "root"@"localhost" IDENTIFIED BY "NewPass#123";Query OK,
0 rows affected (0.01 sec)
6、创建zabbix数据库并创建用户及授权
mysql> create database zabbix character set utf8mb4;Query OK,
1 row affected (0.02 sec)mysql
> create user "zabbix"@"localhost" identified by "Zabbix@123";Query OK,
0 rows affected (0.01 sec)mysql
> grant all privileges on zabbix.* to "zabbix"@"localhost" with grant option;Query OK,
0 rows affected (0.01 sec)mysql
> alter user "zabbix"@"localhost" identified with mysql_native_password by "Zabbix@123";Query OK,
0 rows affected (0.01 sec)
部署zabbix-server
1、安装zabbix镜像源
# rpm -Uvh https://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-2.el7.noarch.rpm
2、安装zabbix
# yum-config-manager --enable rhel-7-server-optional-rpms#
yuminstall zabbix-server-mysql zabbix-web-mysql zabbix-get -y
3、编辑zabbix-server配置文件,配置数据库账户密码
# cp /etc/zabbix/zabbix_server.conf{,.bck}#
cat > /etc/zabbix/zabbix_server.conf <<EOFLogFile
=/var/log/zabbix/zabbix_server.logLogFileSize
=0PidFile
=/var/run/zabbix/zabbix_server.pidSocketDir
=/var/run/zabbixDBName
=zabbixDBUser
=zabbixDBPassword
=Zabbix@123SNMPTrapperFile
=/var/log/snmptrap/snmptrap.logTimeout
=4AlertScriptsPath
=/usr/lib/zabbix/alertscriptsExternalScripts
=/usr/lib/zabbix/externalscriptsLogSlowQueries
=3000StatsAllowedIP
=127.0.0.1EOF
4、编辑httpd的子配置文件zabbix.conf,将时区进行更改(20行)
# grep timezone /etc/httpd/conf.d/zabbix.confphp_value
date.timezone Asia/Shanghai
5、导入zabbix数据库文件
# zcat /usr/share/doc/zabbix-server-mysql-4.2.8/create.sql.gz |mysql -u root -pNewPass#123 zabbix# 验证zabbix库中是否有表结构
# mysql
-u root -pNewPass#123 -e "show tables from zabbix"
6、启动服务并加入开机自启动
# systemctl start zabbix-server# systemctl start httpd
# systemctl enable zabbix
-server# systemctl enable httpd
7、web访问并进行安装,默认访问:IP/zabbix
到这里,yum部署zabbix就完成了。其余配置,请参考zabbix系列文章。
以上是 yum安装zabbix4.2别来无恙 的全部内容, 来源链接: utcz.com/z/514944.html