LNMP环境搭建参考连接:https://blog.csdn.net/qq_26741933/article/details/86614409
vi /etc/php.ini
修改以下配置:
date.timezone = Asia/Shanghai
max_execution_time = 300
post_max_size = 16M ###有时候这里会被设置成32M,但是这里根据后面初始化提示中的信息,被要求设置成16M
max_input_time=300
memory_limit = 128M
mbstring.func_overload = 2
进入数据库:
mysql -uroot -p123456
mysql> use mysql
mysql>insert into mysql.user(Host,User,Password) values("localhost","zabbix",password("zabbix"));
mysql> flush privileges;
quit;
groupadd zabbix -g 501
useradd -g zabbix -u 501 -m zabbix
cd /usr/src/
上传压缩包后解压:
tar xf zabbix-3.4.2.tar.gz
cd zabbix-3.4.2
yum install curl-devel
yum install net-snmp-devel
./configure --prefix=/usr/local/zabbix --enable-server --enable-proxy --enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --with-libcurl
make
make install
vi /etc/services
后面添加:
zabbix-agent 10050/tcp #Zabbix Agent
zabbix-agent 10050/udp #Zabbix Agent
zabbix-trapper 10051/tcp #Zabbix Trapper
zabbix-trapper 10051/udp #Zabbix Trappe
mysql -uroot -p123456
mysql> create database zabbix character set utf8;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
mysql> flush privileges;
quit;
mysql -uzabbix -pzabbix zabbix <./database/mysql/schema.sql
mysql -uzabbix -pzabbix zabbix <./database/mysql/images.sql
mysql -uzabbix -pzabbix zabbix <./database/mysql/data.sql
mkdir /var/log/zabbix
chown zabbix.zabbix /var/log/zabbix
ln -s /usr/local/zabbix/etc /etc/zabbix
ln -s /usr/local/zabbix/bin/* /usr/bin/
ln -s /usr/local/zabbix/sbin/* /usr/sbin/
cp misc/init.d/fedora/core/zabbix_* /etc/init.d/
chmod 755 /etc/init.d/zabbix_*
sed -i "s#BASEDIR=/usr/local#BASEDIR=/usr/local/zabbix#g" /etc/init.d/zabbix_server
sed -i "s#BASEDIR=/usr/local#BASEDIR=/usr/local/zabbix#g" /etc/init.d/zabbix_agentd
sed -i "s/DBUser\=root/DBUser\=zabbix/g" /etc/zabbix/zabbix_server.conf
sed -i "/# DBPassword=/aDBPassword=zabbix\n" /etc/zabbix/zabbix_server.conf
sed -i "s#tmp/zabbix_server.log#var/log/zabbix/zabbix_server.log#g" /etc/zabbix/zabbix_server.conf
sed -i "s/Server\=127.0.0.1/Server\=127.0.0.1,192.168.154.129/g" /etc/zabbix/zabbix_agentd.conf
sed -i "s/ServerActive\=127.0.0.1/ServerActive\=192.168.1.89:10051/g" /etc/zabbix/zabbix_agentd.conf
sed -i "s#tmp/zabbix_agentd.log#var/log/zabbix/zabbix_agentd.log#g" /etc/zabbix/zabbix_agentd.conf
sed -i "#UnsafeUserParameters=0#aUnsafeUserParameters=1\n" /etc/zabbix/zabbix_agentd.conf
cp -r ./frontends/php/ /usr/local/nginx/html/zabbix
vi /etc/nginx/nginx.conf #修改nginx配置文件
root /usr/local/nginx/html/zabbix;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
添加软连接
ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64
/etc/init.d/zabbix_server start
/etc/init.d/zabbix_agentd start