Zabbix7.4 LAMP环境下Zabbix3.4源码部署安装

systemctl stop firewalld.service
systemctl disable firewalld.service
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
grep SELINUX=disabled /etc/selinux/config
setenforce 0

关闭防火墙和selinux

yum -y install gcc* make php php-gd php-mysql php-bcmath php-mbstring php-xml curl curl-devel net-snmp  net-snmp-devel perl-DBI httpd mariadb* mysql-devel libxml2-devel curl-devel unixODBC-devel net-snmp-devel OpenIPMI-devel openldap openldap-devel libevent-devel php-ldap

安装需要用到的lamp环境

mkdir -p /app/zabbix
groupadd zabbix
useradd -g zabbix zabbix

创建安装点和zabbix用户

tar -xvf zabbix-3.4.0.tar.gz
cd zabbix-3.4.0
./configure --prefix=/app/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2 --with-openipmi --with-unixodbc
make && make install

解压以及安装

systemctl start mariadb.service
systemctl status mariadb.service
mysql_secure_installation

启动数据库 初始化数据库 设置root密码 一路Y下去

mysql -uroot -p
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';

配置数据库

cd /root/zabbix-3.4.0/database/mysql
mysql -uzabbix -pzabbix2018 zabbix < schema.sql
mysql -uzabbix -pzabbix2018 zabbix < images.sql
mysql -uzabbix -pzabbix2018 zabbix < data.sql

到解压的位置数据库对应文件导入数据库

vim /etc/php.ini 
date.timezone= Asia/Shanghai
max_execution_time = 300
post_max_size = 32M
memory_limit = 128M
mbstring.func_overload = 1
max_input_time = 300

修改php的参数配置

cp -r frontends/php/ /var/www/html/zabbix
ll /var/www/html/
chown -R apache.apache /var/www/html/zabbix/

到解压的位置 复制php的文件到/var/www/html/zabbix下

cd /app/zabbix/
mkdir logs
mkdir alertscripts
mkdir externalscripts
 
grep -n '^'[a-Z] /app/zabbix/etc/zabbix_server.conf
38:LogFile=/tmp/zabbix_server.log
68:PidFile=/tmp/zabbix_server.pid
95:DBName=zabbix
111:DBUser=zabbix
119:DBPassword=zabbix
426:Timeout=4
483:AlertScriptsPath=/app/zabbix/alertscripts
492:ExternalScripts=/app/zabbix/externalscripts
510:LogSlowQueries=3000

创建对应目录和修改配置文件

cd /root/zabbix-3.4.0/
cp misc/init.d/fedora/core/zabbix_server /etc/init.d/
vim /etc/init.d/zabbix_server
BASEDIR=/app/zabbix
cd /app/
chown -R zabbix.zabbix zabbix/

修改启动脚本为安装目录 安装目录授权zabbix用户

chkconfig --add zabbix_server
chkconfig zabbix_server on
systemctl enable httpd.service
systemctl enable mariadb.service
systemctl start httpd.service
/etc/init.d/zabbix_server restart

开机启动

web服务初始化

ip/zabbix

Zabbix7.4 LAMP环境下Zabbix3.4源码部署安装_第1张图片
Zabbix7.4 LAMP环境下Zabbix3.4源码部署安装_第2张图片

yum -y install php-ldap

Zabbix7.4 LAMP环境下Zabbix3.4源码部署安装_第3张图片
Zabbix7.4 LAMP环境下Zabbix3.4源码部署安装_第4张图片
下一步就ok了

你可能感兴趣的:(Zabbix)