This article is the source installation method, please refer to the following articles for yum installation method
Zabbix installation tutorial under CentOs7-preparationsZabbix installation tutorial under CentOs7-zabbix server installationZabbix installation tutorial under CentOs7 ——Zabbix agent installation and front-end configuration
I am here to use the source code to install zabbix, the system is CentOs7, and the zabbix version is 3.2.1
The installation of zabbix requires a LAMP environment
# yum install php php-gd php-mysql php-bcmath php-mbstring php-xml curl curl-devel net-snmp net-snmp-devel perl-DBI
# yum install httpd mariadb*
Database configuration
# systemctl start mariadb.service
# mysql -u root -p
Enter password: ##Enter the MySQL password, the default is empty
MariaDB [(none)]> create database zabbix character set utf8;##Create the database zabbix, and the database encoding uses utf8
MariaDB [(none)]> insert into mysql.user(Host,User,Password)values('localhost','zabbix',password('zabbix')); ##New account zabbix, password zabbix
MariaDB [(none)]> flush privileges; ##Refresh system authorization
MariaDB [(none)]> grant all on zabbix.* to 'zabbix'@'127.0.0.1' identified by 'zabbix'with grant option; ##Allow the account to connect to the database zabbix from this machine
MariaDB [(none)]> flush privileges;
First download the zabbix installation package
Download link: http://www.zabbix.com/download
I download version 3.2.1 here
tar -zxvf zabbix-3.2.1.tar.gz
cd zabbix-3.2.1
create Account
groupadd zabbix
useradd -g zabbix zabbix
Configure the source file to execute the following instructions
. /configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
The following error may be reported at this time:
configure: error: LIBXML2 library not found
This is because the LIBXML2 file is missing
Solution:
# yum install libxml2 libxml2-devel
After executing the above instructions, start the installation:
# make
# make install
Import database
# mysql -u root -p
MariaDB [(none)]> use zabbix;
MariaDB [zabbix]> source /tmp/zabbix-3.2.1/database/mysql/schema.sql
MariaDB [zabbix]> source /tmp/zabbix-3.2.1/database/mysql/images.sql
MariaDB [zabbix]> source /tmp/zabbix-3.2.1/database/mysql/data.sql
MariaDB [zabbix]> quit
Note: Please import in the above order, otherwise there will be errors.
Copy relevant configuration files to /etc and make relevant configuration modifications
# mkdir -p /etc/zabbix
# cp -r zabbix-2.4.5/conf/* /etc/zabbix/
# chown -R zabbix:zabbix /etc/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/
Modify zabbix_server.conf
# vi /etc/zabbix/zabbix_server.conf
Modify the place:
LogFile=/tmp/zabbix_server.log ##Log file address
DBHost=localhost ##Database host
DBName=zabbix ##Database name
DBUser=zabbix ##Database user name
DBPassword=zabbix ##Database password
ListenIP=127.0.0.1 ##Database IP address
AlertScriptsPath=/usr/local/zabbix/share/zabbix/alertscripts##zabbix run script storage directory
After the modification is completed, you can use the following command to view the modified place
# cat /etc/zabbix/zabbix_server.conf|grep -n ^[^#]
Modify zabbix_agentd.conf
# vi /etc/zabbix/zabbix_agentd.conf
Modify the following places:
PidFile=/tmp/zabbix_agentd.pid ##Process PID
LogFile=/tmp/zabbix_agentd.log ##Log save location
EnableRemoteCommands=1 ##Allow the execution of remote commands
Server=127.0.0.1 ##agent-side ip
ServerActive=127.0.0.1
Hostname=Zabbix server ##Must be the same as the hostname created by zabbix
Include=/usr/local/etc/zabbix_agentd.conf.d/
UnsafeUserParameters=1 ##Start custom key
Modify PHP related parameters
vi /etc/php.ini
Modify the following places:
max_execution_time = 300
max_input_time = 300
memory_limit = 128M
upload_max_filesize = 2M
date.timezone = Asia/Shanghai
post_max_size = 28M
Configure web site
# cd zabbix-3.2.1
# cp -r frontends/php /var/www/html/zabbix
Modify the parameters of httpd.conf
# vi /etc/httpd/conf/httpd.conf
amend as below:
< IfModule dir_module>
DirectoryIndex index.html index.php
< /IfModule>
Turn off SELinux:
a. Temporarily shut down (no need to restart the machine):
# setenforce 0 ##Set SELinux into permissive mode (close SELinux)
# setenforce 1 ##Set SELinux into enforcing mode (enforcing SELinux)
b. Modifying the configuration file requires restarting the machine:
# vi /etc/selinux/config #SELINUX=enforcing changed to SELINUX=disabled need to restart the machine
After the above steps are completed, you can enter the web interface for installation and configuration operations, open the browser and enter http://zabbix server host/zabbix. I did not keep screenshots during the previous installation, so it is not easy to explain here, everyone You can look at the configuration interface on the Internet. Basically, the previous steps are okay. The configuration here is basically okay. If you have the opportunity to make up later!
Recommended Posts