zabbix3.2_yum官方文档centos 7版

Installation from packages

1 Repository installation

 

For Red Hat Enterprise Linux / CentOS

 

Supported versions

  • RHEL 7
  • Oracle Linux 7
  • CentOS 7

Some packages (agent, proxy, etc.) are available for RHEL 5 and RHEL 6 (in http://repo.zabbix.com/zabbix/3.2/rhel/5/x86_64/ and http://repo.zabbix.com/zabbix/3.2/rhel/6/x86_64/ directories respectively).

Installing repository configuration package

Install the repository configuration package. This package contains yum (software package manager) configuration files.

# rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm

Now you are ready to install Zabbix server with MySQL or server with PostreSQLagent and proxy.

 

2 Server installation with MySQL database

 

 

It is a good practice to have the innodb_file_per_table option enabled on MySQL. Check this setting before proceeding.

 

 

Red Hat Enterprise Linux / CentOS

 

Installing packages

Here is an example for Zabbix server and web frontend installation with MySQL database:

# yum install zabbix-server-mysql zabbix-web-mysql

Creating initial database

Create Zabbix database and user on MySQL by the following commands, where <root_password> shall be replaced with the actual root password (e.g., shell> mysql -uroot -p12345) and <password> with new password for zabbix user on the database (including apostrophes: …identified by '67890';):

shell> mysql -uroot -p<root_password>
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '<password>';
mysql> quit;

Now import initial schema and data. Make sure to insert correct version for 3.2.*. You will be prompted to enter your newly created password.

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

In order to check the version you have in your package, use the following command:

# rpm -q zabbix-server-mysql

Database configuration for Zabbix server

Edit server host, name, user and password in zabbix_server.conf as follows, where DBPassword is the password you've set creating initial database:

# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=<password>

Starting Zabbix server process

It's time to start Zabbix server process and make it start at system boot:

# systemctl start zabbix-server
# systemctl enable zabbix-server

PHP configuration for Zabbix frontend

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 max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value always_populate_raw_post_data -1
# php_value date.timezone Europe/Riga

SELinux configuration

Having SELinux status enabled in enforcing mode, you need to execute the following command to enable successful connection of Zabbix frontend to the server:

# setsebool -P httpd_can_connect_zabbix on

As frontend and SELinux configuration is done, you need to restart Apache web server:

# systemctl start httpd

Installing frontend

Now you are ready to proceed with frontend installation steps which will allow you to access your newly installed Zabbix.

 

 

Zabbix official repository provides fping, iksemel, libssh2 packages for RHEL as well. These packages are located in the non-supported directory.

 

 

3 Server installation with PostgreSQL database

 

Red Hat Enterprise Linux / CentOS

 

Installing packages

Here is an example for Zabbix server and web frontend with PostgreSQL database.

# yum install zabbix-server-pgsql zabbix-web-pgsql

Creating initial database

You need to have database username user set up with permissions to create database objects.
Create Zabbix database on PostgreSQL with the following commands:

shell> psql -U <username>
psql> create database zabbix; 
psql> \q 

Then import initial schema and data. Make sure to insert correct values for 3.2.*.

# zcat /usr/share/doc/zabbix-server-pgsql-3.2.*/create.sql.gz | psql -U <username> zabbix

In order to check the version you have in your package, use the following command:

# rpm -q zabbix-server-pgsql

Database configuration for Zabbix server

Edit server host, name, user and password in zabbix_server.conf as follows, replacing <username_password> with actual password of PostgreSQL user:

# vi /etc/zabbix/zabbix_server.conf
DBHost=
DBName=zabbix
DBUser=zabbix
DBPassword=<username_password>

You might want to keep default setting DBHost=localhost (or an IP address), but this would make PostgreSQL use network socket connecting to Zabbix. See SELinux configuration block below for instructions.

Starting Zabbix server process

It's time to start Zabbix server process and make it start at system boot:

# systemctl start zabbix-server
# systemctl enable zabbix-server

PHP configuration for Zabbix frontend

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 max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value always_populate_raw_post_data -1
# php_value date.timezone Europe/Riga

SELinux configuration

Having SELinux status enabled in enforcing mode, you need to execute the following command to enable successful connection of Zabbix frontend to the server:

# setsebool -P httpd_can_connect_zabbix on

If any parameter such as “localhost” or an IP address is set for DBHost= in zabbix_server.conf, you need to allow connection between Zabbix frontend and the database too:

# setsebool -P httpd_can_network_connect_db on

As frontend and SELinux configuration is done, you need to restart Apache web server:

# systemctl start httpd

Installing frontend

Now you are ready to proceed with frontend installation steps which will allow you to access your newly installed Zabbix.

 

 

Zabbix official repository provides fping, iksemel, libssh2 packages for RHEL as well. These packages are located in the non-supported directory.

 

 

 

4 Agent installation

This page covers installation of Zabbix agent. If needed, you may check additional info about supported platforms and permission requirements for the agent.

Red Hat Enterprise Linux / CentOS

To install agent after correct repository configuration package is installed, run the following command:

# yum install zabbix-agent

Now agent is ready to be started by:

# systemctl start zabbix-agent


5 Proxy installation

For this procedure Zabbix repository provides choice of 3 packages named as follows:

  • zabbix-proxy-mysql
  • zabbix-proxy-pgsql
  • zabbix-proxy-sqlite3

where the last value of the name (after zabbix-proxy-) represents database type of the package — MySQL, PostgreSQL and SQLite respectively.

Red Hat Enterprise Linux / CentOS

 

Installing packages

Install proxy and make sure to insert correct database type value for <database_type>:

# yum install zabbix-proxy-<database_type>

Creating proxy database

Create Zabbix proxy database and its user. 
For instructions on doing that, see examples from server installation with MySQL or PostgreSQL and mind peculiarity of the SQLite creation.

Then import initial schema. Make sure to insert correct version for 3.2.X.

MySQL command:

# zcat /usr/share/doc/zabbix-proxy-mysql-3.2.X/create.sql.gz | mysql -u<username> zabbix

PostgreSQL command:

# zcat /usr/share/doc/zabbix-proxy-pgsql-3.2.X/create.sql.gz | psql -U <username> zabbix

SQLite command:

# zcat /usr/share/doc/zabbix-proxy-pgsql-3.2.X/create.sql.gz | sqlite3 zabbix.db

In order to check the version you have in your package, use the following command:

# rpm -q zabbix-proxy-<database_type>

In order to check the version you have in your package, use the following command:

# rpm -q zabbix-proxy-<database_type>

Starting Zabbix proxy process

After database is installed and zabbix_proxy.conf file is configured, you may start Zabbix proxy process.

# systemctl start zabbix-proxy

Debian / Ubuntu

 

Installing packages

Install proxy and make sure to insert correct database type value for <database_type>:

# apt-get install zabbix-proxy-<database_type>

Creating proxy database

Create Zabbix proxy database and its user. 
For instructions on doing that, see examples from server installation with MySQL or PostgreSQL and mind peculiarity of the SQLite creation.

Then import initial schema.

MySQL command:

# zcat /usr/share/doc/zabbix-proxy-mysql/create.sql.gz | mysql -u<username> zabbix

PostgreSQL command:

# zcat /usr/share/doc/zabbix-proxy-pgsql/create.sql.gz | psql -U <username> zabbix

SQLite command:

# zcat /usr/share/doc/zabbix-proxy-pgsql/create.sql.gz | sqlite3 zabbix.db

Starting Zabbix proxy process

After database is installed and zabbix_proxy.conf file is configured, you may start Zabbix proxy process.

# service zabbix-proxy start

Common configuration

 

Database configuration for Zabbix proxy

Edit proxy host, name, user and password in zabbix_proxy.conf

 

 

If Zabbix proxy and Zabbix server are installed on the same host, their databases must have unique names! Defaults for both are zabbix.

 

 

# vi /etc/zabbix/zabbix_proxy.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix

 


posted @ 2017-04-15 11:04  陈浩然201  阅读(354)  评论(0编辑  收藏  举报