1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
| ========================================================================= ubuntu编译安装zabbix 4.0.10
https:
zabbix-server:192.168.6.10 zabbix-mysql:192.168.6.20
1、安装mariadb数据库 root@zabbix-mysql:~# apt-get install mariadb-server mariadb-client apt-get install mariadb-server mariadb-client
建立数据库 MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin; Query OK, 1 row affected (0.05 sec)
授权 MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@"192.168.6.%" identified by '123456'; Query OK, 0 rows affected (0.00 sec)
安全加固脚本 root@zabbix-mysql:/usr/local/src/zabbix-4.0.10/database/mysql# mysql_secure_installation
修改监听端口 root@zabbix-mysql:~# grep 127.0.0.1 /etc/mysql/ -R /etc/mysql/mariadb.conf.d/50-server.cnf:bind-address = 127.0.0.1
root@zabbix-mysql:~# systemctl restart mariadb root@zabbix-mysql:~# systemctl enable mariadb
zabbix服务端测试登录数据库 root@zabbix-server:~# mysql -uzabbix -p123456 -h192.168.6.20 2、安装zabbix依赖包 root@zabbix-server:~# apt-get 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 3、开始编译安装zabbix4.0.10
root@zabbix-server:~# cd /usr/local/src/ root@zabbix-server:src# tar xvf zabbix-4.0.10.tar.gz
root@zabbix-server:/usr/local/src/zabbix-4.0.10# ./configure --prefix=/app/zabbix_server --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2 --enable-java
root@zabbix-server:/usr/local/src/zabbix-4.0.10# make && make install 4、数据库初始化 root@zabbix-server:~# cd /usr/local/src/zabbix-4.0.10/database/mysql/ root@zabbix-server:/usr/local/src/zabbix-4.0.10/database/mysql# mysql -uzabbix -p123456 -h192.168.6.20 zabbix < schema.sql root@zabbix-server:/usr/local/src/zabbix-4.0.10/database/mysql# mysql -uzabbix -p123456 -h192.168.6.20 zabbix < images.sql root@zabbix-server:/usr/local/src/zabbix-4.0.10/database/mysql# mysql -uzabbix -p123456 -h192.168.6.20 zabbix < data.sql
5、编辑zabbix配置文件 root@zabbix-server:/usr/local/src/zabbix-4.0.10/database/mysql# vim /app/zabbix_server/etc/zabbix_server.conf ...... DBHost=192.168.6.20
DBName=zabbix
DBUser=zabbix DBPassword=123456
6、创建zbbix用户 root@zabbix-server:~# useradd zabbix root@zabbix-server:~# chown zabbix.zabbix /app/zabbix_server -R
7、启动zabbix root@zabbix-server:~# /app/zabbix_server/sbin/zabbix_server -c /app/zabbix_server/etc/zabbix_server.conf root@zabbix-server:~# ss -nlt 8、安装zabbix-web界面 root@zabbix-server:~# rm -rf /var/www/html/index.html root@zabbix-server:~# mkdir /var/www/html/zabbix root@zabbix-server:~# cp -a /usr/local/src/zabbix-4.0.10/frontends/php
|