How to install Zabbix4.0 on Centos7

notice: the article is come from https://computingforgeeks.com/how-to-install-zabbix-server-4-0-on-centos-7/

Welcome to our guide on how to install Zabbix Server 4.0 on CentOS 7 Server. Our previous guide was on the installation of How to Install Zabbix Server 4.0 on Ubuntu 18.04 & Ubuntu 16.04 LTS. Zabbix is a powerful open source monitoring solution used to monitor server applications, systems, Network devices, Hardware appliances, IoT devices, e.t.c. Its backend is written in C and Java while the user web interface written in PHP.

Zabbix Architecture (Server & Client)

Zabbix works in a Client/Server model. The server communicates to the native software agents available for various Operating systems like Linux, NIX, and Windows. For systems without an agent, generic monitoring protocols such as Simple Network Management Protocol (SNMP) or Intelligent Platform Management Interface (IPMI) can be used.

Install Zabbix Server 4.0 on CentOS 7

Zabbix Server depends on the following software applications:

  • Apache web server
  • PHP with required extensions
  • MySQL/ MariaDB database server
    MySQL or MariaDB can be a remote server, but php and httpd need to be installed on the Zabbix server. It is possible to run Apache web server in reverse proxy mode.

It is recommended to have SELinux in permissive mode unless you know how to fix its issues

setenforce 0 sudo sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config
cat /etc/selinux/config | grep SELINUX=
Step 1: Install and Configure Apache httpd server

Install Apache web server on CentOS 7 server by running the command:

sudo yum -y install httpd vim

After installing Apache, configure basic security by allowing Prod ServerTokens only on./etc/httpd/conf/httpd.conf Add the following line at the end of the file:

ServerSignature Off
ServerTokens Prod

The directive ServerTokens configures what is returned as the Server HTTP response. Valid options are Full | OS | Minimal | Minor | Major | Prod.

Set ServerName:

# grep ServerName /etc/httpd/conf/httpd.conf
ServerName zabbix.example.com

Set Server Admin to receive an email in case of issues.

# grep ServerAdmin /etc/httpd/conf/httpd.conf
ServerAdmin admin@example.com

Restart apache web service after making the changes

sudo systemctl restart httpd

If you have a firewalld firewall installed and enabled, allow access to port 443 and 80

PHP 5.4.16 (cli) (built: Oct 30 2018 19:30:51) 
 Copyright (c) 1997-2013 The PHP Group
 Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologiessudo firewall-cmd --reload
Step 2: Install and Configure PHP

Install PHP on your CentOS 7 server and extensions required by Zabbix.

sudo yum -y install php php-pear php-cgi php-common php-mbstring php-snmp php-gd php-xml php-mysql php-gettext php-bcmath
Configure Apache and PHP on CentOS 7

Check PHP installed version:

$ php -v
 PHP 5.4.16 (cli) (built: Oct 30 2018 19:30:51) 
 Copyright (c) 1997-2013 The PHP Group
 Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

Set PHP timezone

sudo sed -i "s/^;date.timezone =$/date.timezone = \"Africa\/Nairobi\"/" /etc/php.ini

Restart httpd after this change:

sudo systemctl restart httpd
Step 3: Install MariaDB Database server

Install MariaDB database server on CentOS 7 server using our guide:

How to Install MariaDB 10.x on Ubuntu 18.04 and CentOS 7

Once Database server is installed, you need to create a database for Zabbix user:

export zabbix_db_pass="StrongPassword"
mysql -uroot -p <<MYSQL_SCRIPT
    create database zabbix;
    grant all privileges on zabbix.* to zabbix@'localhost' identified by '${zabbix_db_pass}';
    FLUSH PRIVILEGES;
MYSQL_SCRIPT

Replace “StrongPassword” with your desired password for the database.

Step 4: Install Zabbix 4.0 Server on CentOS 7

Now that we have required dependencies installed and working, we can finalize our installation by deploying Zabbix 4.0 server.

Add Zabbix 4.0 repository:

sudo yum install -y https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm

Now install Zabbix 4.0 Server and frontend with MySQL support:

sudo yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-get

Substitute ‘mysql’ in the commands with ‘pgsql‘ to use PostgreSQL, or with ‘sqlite3‘ to use SQLite3 (proxy only).

Import Zabbix Server database schema

For Zabbix server and Zabbix proxy daemons, a database is required. It is not needed to run Zabbix agent. If Zabbix server and proxy are installed on the same host, their databases must be created with different names!

Import initial schema and data for the server with MySQL:

zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

Enter your Zabbix database user password when prompted.

Step 5: Configure and start Zabbix server

Edit your Zabbix configuration file /etc/zabbix/zabbix_server.conf and set database connection settings.

DBName=zabbix
DBUser=zabbix
DBPassword=StrongPassword

Restart Zabbix server after modifying this file:

sudo systemctl restart httpd zabbix-server
sudo systemctl enable zabbix-server
Zabbix Frontend configuration

Apache configuration file for Zabbix frontend is located in /etc/httpd/conf.d/zabbix.conf. Some PHP settings are already configured. But it’s necessary to uncomment the “date.timezone” setting and set the right timezone for you.

php_value date.timezone Africa/Nairobi

Complete settings should be like this:

php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_sizoe 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value max_input_vars 10000
Configure Firewall

If you have ufw firewall installed and running on your system, ensure you allow port 5000 and port 5001

sudo firewall-cmd --add-port={10051/tcp,10050/tcp} --permanent
sudo firewall-cmd --reload

Restart httpd and start frontend installation

sudo systemctl restart httpd
Step 6: Perform Zabbix initial setup

Access http://(Zabbix server’s hostname or IP address)/zabbix/ to begin Zabbix initial setup.

Step 1 is a welcome page, click “Next step” to proceed.

在这里插入图片描述

Confirm that all pre-requisites are satisfied.
在这里插入图片描述

Configure DB settings
在这里插入图片描述
在这里插入图片描述
Confirm Hostname and Port number for Zabbix server. It is okay to use localhost in place of a name.

Verify all settings and click Next step to finish the initial setup. If all goes well, you should get congratulations page. Click the Finish button to end installation.
在这里插入图片描述

You’ll then get the login page. Default logins are:

Username: "admin"
Password: "zabbix"

Dashboard for Zabbix server 4.0 looks like below
在这里插入图片描述

Step 6: Change Admin Password
Login to Zabbix admin dashboard with admin user and password zabbix. You need to change the password for admin user after the first login for security reasons.

Navigate to Administration > Users > Admin > Password > Change Password

Configure Monitoring Target host
Now that we have our Zabbix server ready for monitoring, you can start configuring first monitoring target host. By default, Zabbix server is added to monitoring.

在这里插入图片描述

To add other host devices, login to Zabbix admin dashboard with the username admin and click on Configuration > Hosts.

After a few minutes, monitoring data will start flowing in, to check host graphs go to Monitoring > Screens > Server name. My next article will cover the installation of Zabbix agent 4.0 on CentOS 7.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值