基于lamp的Zabbix3.4.14部署

一 安装源和Zabbix的依赖包:
1 添加源
wget -q -O – http://www.atomicorp.com/installers/atomic | sh
2 安装LAMP环境
yum -y install httpd php php-mysql mysql mysql-server vim nmap
3 安装拓展包
yum -y install mysql-devel libcurl-devel net-snmp-devel php-bcmath php-ldap php-mbstring php-gd php-xmlwriter libevent-devel libevent pcre*
二 添加用户:
groupadd zabbix
useradd -g zabbix -s /sbin/nologin zabbix
三 创建数据库并添加授权账号:
#启动mysql数据库
/etc/init.d/mysqld start
#解决中文乱码问题
mysql -e “create database zabbix character set utf8;”
#对用户进行授权
mysql -e “grant all privileges on zabbix.* to zabbix@localhost identified by ‘admin@123’;”
四 下载zabbix
1 下载源码
2 编译安装
tar zxvf zabbix-3.4.14.tar.gz
cd zabbix-3.4.14
./configure –prefix=/usr/local/zabbix –enable-server –enable-agent –with-mysql –with-net-snmp –with-libcurl
make -j 4 && make install
4 #导入数据库
cd /tmp/zabbix-3.4.14
mysql -uzabbix -p’admin@123′ -hlocalhost zabbix < database/mysql/schema.sql
mysql -uzabbix -p’admin@123′ -hlocalhost zabbix < database/mysql/images.sql
mysql -uzabbix -p’admin@123′ -hlocalhost zabbix < database/mysql/data.sql
5 #修改配置在zabbix包路径下
sed -i ‘s/^DBUser=.*$/DBUser=zabbix/g’ /usr/local/zabbix/etc/zabbix_server.conf
sed -i ‘s/^.*DBPassword=.*$/DBPassword=admin@123/g’ /usr/local/zabbix/etc/zabbix_server.conf
sed -i ‘s/^DBSocket=.*$/DBSocket=\/var\/lib\/mysql\/mysql.sock /usr/local/zabbix/etc/zabbix_server.conf
cp -r frontends/php /var/www/html/zabbix
cp misc/init.d/fedora/core/zabbix_* /etc/init.d/
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
6 #添加服务端口
cat >>/etc/services <<EOF
zabbix-agent 10050/tcp Zabbix Agent
zabbix-agent 10050/udp Zabbix Agent
zabbix-trapper 10051/tcp Zabbix Trapper
zabbix-trapper 10051/udp Zabbix Trapper
EOF
7 #修改php.ini
sed -i ‘s/^\(.*\)date.timezone =.*$/date.timezone = Asia\/Shanghai/g’ /etc/php.ini
sed -i ‘s/^\(.*\)post_max_size =.*$/post_max_size = 16M/g’ /etc/php.ini
sed -i ‘s/^\(.*\)max_execution_time =.*$/max_execution_time = 300/g’ /etc/php.ini
sed -i ‘s/^\(.*\)max_input_time =.*$/max_input_time = 300/g’ /etc/php.ini
sed -i ‘s/^\(.*\)always_populate_raw_post_data =.*$/always_populate_raw_post_data = .*/g’ /etc/php.ini
8 #启动服务
/etc/init.d/httpd start
/etc/init.d/mysqld start
/etc/init.d/zabbix_server start
/etc/init.d/zabbix_agentd start
chkconfig httpd on
chkconfig mysqld on
echo “/etc/init.d/zabbix_server start” >> /etc/rc.local
echo “/etc/init.d/zabbix_agentd start” >> /etc/rc.local
五 WEB页面配置:
1、访问http://10.0.5.151/zabbix/setup.php
2、在install出现Fail的原因是zabbix的配置文件没有,需要点击“Download configuration file”将zabbix.conf.php下载到本地在上传到服务器的zabbix/conf/目录下,然后在web页面Retry即可

3、登陆界面,zabbix的默认登陆账号是admin,密码是zabbix

4、如果出现有乱码,可以到window系统找到自己喜欢的字体上传上去

在windows系统中的c:\windows\fonts目录中copy一个自己喜欢的字体文出来,如msyh.ttf
将copy出来的字体上传到Zabbix根目录中的fonts目录下
将原来的字体文件“DejaVusSans.ttf”备份
将上传的字体文件如msyh.ttf改名为DejaVusSans.ttf
重新登录zabbix即可

原创文章,作者:赛福,如若转载,请注明出处:https://www.safecdn.cn/monitor/zabbix/2018/11/lamp-zabbix3-4-14.html

发表评论

邮箱地址不会被公开。