编译安装zabbix4.0
作者:互联网
一、环境规划
二、编译安装zabbix
在10.0.0.101
主机部署zabbix_server
2.1 下载源码包
# pwd
/usr/local/src
# groupadd zabbix && useradd -g zabbix zabbix
# tar xvf zabbix-4.0.38.tar.gz -C /usr/local/src
# ln -sv /usr/local/src/zabbix-4.0.38 /usr/local/zabbix_server
2.2 解决依赖关系
apt install apache2 apache2-bin apache2-data apache2-utils fontconfig-config \
fonts-dejavu-core fping libapache2-mod-php libapache2-mod-php7.2 libapr1 \
libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libfontconfig1 libgd3 \
libiksemel3 libjbig0 libjpeg-turbo8 libjpeg8 liblua5.2-0 libodbc1 libopenipmi0 \
libsensors4 libsnmp-base libsnmp30 libsodium23 libssh2-1 libtiff5 libwebp6 \
libxpm4 php-bcmath php-common php-gd php-ldap php-mbstring php-mysql php-xml \
php7.2-bcmath php7.2-cli php7.2-common php7.2-gd php7.2-json php7.2-ldap \
php7.2-mbstring php7.2-mysql php7.2-opcache php7.2-readline php7.2-xml snmpd \
ssl-cert ttf-dejavu-core libmysqlclient-dev libxml2-dev libxml2 snmp libsnmp-dev \
libevent-dev openjdk-8-jdk curl libcurl4-openssl-dev -y
2.3 编译安装zabbix
# groupadd zabbix && useradd -g zabbix zabbix
# tar xvf zabbix-4.0.38.tar.gz -C /usr/local/src
# ln -sv /usr/local/src/zabbix-4.0.38 /usr/local/zabbix_server
# mkdir /apps
# cd /usr/local/zabbix_server && ./configure \
--prefix=/apps/zabbix_server \
--enable-server \
--enable-agent \
--with-mysql \
--with-net-snmp \
--with-libcurl \
--with-libxml2 \
--enable-java
# make install
2.4 修改配置文件
# vim /apps/zabbix_server/etc/zabbix_server.conf
LogFile=/tmp/zabbix_server.log
DBHost=10.0.0.104
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix.zabbix
DBPort=3306
Timeout=4
LogSlowQueries=3000
三、配置mysql服务
3.1 安装mysql
在10.0.0.104
主机安装mysql
# apt update
# apt install mysql-server mysql-client -y
# vim /etc/mysql/mysql.conf.d/mysqld.cnf
bind-adress =0.0.0.0
# systemctl start mysql && systemctl enable mysql
mysql > create database zabbix character set utf8 collate utf8_bin;
mysql > grant all privileges on zabbix.* to zabbix@'10.0.0.%' identified by "zabbix.zabbix";
mysql > flush privileges;
# systemctl restart mysql
3.2 导入数据库
在zabbix主机将数据库导入到mysql
cd /apps/zabbix-server/database/mysql
mysql -uzabbix -pzabbix.zabbix -h 10.0.0.104 zabbix < schema.sql
mysql -uzabbix -pzabbix.zabbix -h 10.0.0.104 zabbix < images.sql
mysql -uzabbix -pzabbix.zabbix -h 10.0.0.104 zabbix < data.sql
3.3 检验数据库是否导入
# mysql -uzabbix -pzabbix.zabbix -h 10.0.0.104
# mysql> use zabbix;
# mysql> show tables;
...可用很多数据表,省略,,
四、启动zabbix server
4.1 复制php文件到
# mkdir /var/www/html/zabbix
# cp zabbix-4.0.30/frontends/php/* /var/www/html/zabbix/ -a
# systemctl restart apache2
4.2 启动zabbix
# /apps/zabbix_server/sbin/zabbix_server -c /apps/zabbix_server/etc/zabbix_server.conf
五、访问web界面
使用浏览器访问10.0.0.101/zabbix/
解决报错,根据要求的参数做相应的更改
sed -i -e 's#;date.timezone =#date.timezone = Asia/Shanghai#' \
-e 's#post_max_size = 8M#post_max_size = 16M#' \
-e 's#max_execution_time = 30#max_execution_time = 300#' \
-e 's#max_input_time = 60#max_input_time = 300#' /etc/php/7.2/apache2/php.ini
#重启apaceh
systemctl restart apache2
# ls /var/www/html/zabbix/conf/zabbix.conf.php #将文件保存到该目录
maintenance.inc.php zabbix.conf.php zabbix.conf.php.example
六、设置中文界面
##安装简体中文语言环境
sudo apt -y install language-pack-zh*
##增加中文语言环境变量
echo 'LANG="zh_CN.UTF-8"' >> /etc/environment
##重新设置本地配置
sudo dpkg-reconfigure locales
重启Apache
sudo systemctl restart apache2
由此,zabbix安装完成!
标签:10.0,php,php7.2,server,编译,zabbix,mysql,zabbix4.0,安装 来源: https://www.cnblogs.com/hzgy/p/16010085.html