#yum install maridb and php apache
yum install make httpd php mysql-devel gcc net-snmp-devel curl-devel perl-DBI php-fpm php-gd php-mysql php-bcmath php-mbstring php-xml unixODBC-devel OpenIPMI-devel libxml2-devel mariadb mariadb-server -y
#add new user zabbix
useradd zabbix -s /sbin/nologin
#start mariadb
systemctl start mariadb.service
#create new database
mysql -uroot -e "create database zabbix character set utf8 collate utf8_bin;"
#create new user
mysql -uroot -e "grant all on zabbix.* to [email protected] identified by ‘zabbix‘;"
#flush privileges
mysql -uroot -e "flush privileges;"
#download zabbix installation and install
cd /usr/local/src/
wget https://testom.obs.cn-east-2.myhuaweicloud.com/zabbix-3.2.7.tar.gz
tar -xf zabbix-3.2.7.tar.gz
cd zabbix-3.2.7
#excute sql script
cd database/mysql/
mysql -uzabbix -pzabbix zabbix < schema.sql
mysql -uzabbix -pzabbix zabbix < images.sql
mysql -uzabbix -pzabbix zabbix < data.sql
#start install zabbix
cd /usr/local/src/zabbix-3.2.7
./configure --enable-server --enable-agent --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl --with-libxml2 --with-openipmi --with-unixodbc
make && make install
#modify zabbix db password
sed -i "s/# DBPassword=/DBPassword=zabbix/g" /usr/local/etc/zabbix_server.conf
#copy start file to init.d
cp /usr/local/src/zabbix-3.2.7/misc/init.d/fedora/core5/zabbix_server /etc/init.d/
chmod +x /etc/init.d/zabbix_server
#start zabbix
/etc/init.d/zabbix_server start
#modify php conf
sed -i "s#max_execution_time = 30#max_execution_time = 300#" /etc/php.ini
sed -i "s#max_input_time = 60#max_input_time = 300#" /etc/php.ini
sed -i "s#post_max_size = 8M#post_max_size = 32M#" /etc/php.ini
sed -i "s#;date.timezone =#date.timezone = Asia\/Shanghai#g" /etc/php.ini
#copy zabbix frontend to html
cd /usr/local/src/zabbix-3.2.7/frontends/
mkdir -p /var/www/html/zabbix
\cp -rf php/* /var/www/html/zabbix
chmod -R 777 /var/www/html/zabbix
原文地址:https://www.cnblogs.com/zmichael/p/12054325.html