zabbix系列之二——安装

时间:2021-09-12 10:21:38

1Getting zabbix

Four ways of getting:

Index

Option

note

1

Install it from the distribution packages

A step-by-step tutorial for installing Zabbix from packages is provided in sub-pages here.

Several popular OS distributions have Zabbix packages provided. You can use these packages to install Zabbix.

http://repo.zabbix.com/

2

Download the latest source archive and compile it yourself

https://www.zabbix.com/download

3

Install it from the containers

4

Download the virtual appliance

https://www.zabbix.com/download

2requirements

3installation from packages

Red Hat Enterprise Linux/CentOS

https://www.zabbix.com/download

3.1Server

Index

step

Operation

note

1

Install Repository with MySQL database

rpm -i http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm

1Has included all requirements

(such as the lamp environment)

2install mysql first

2

install Zabbix server, frontend, agent

yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent

 

No affect the installation mysql,just a connection tool

3

Create initial database

mysql -uroot –p

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;

 

4

Import initial schema and data.

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

Note:

the table ‘users’ has already existed.

Causes:in step 3(Create initial database) all tables has been created.thus need to drop all created tables;

Solve method:

SELECT concat('DROP TABLE IF EXISTS ', table_name, ';')

FROM information_schema.tables

WHERE table_schema = 'mydb';

mydb换成你想删除的数据库的名字

再复制输出的语句,粘贴执行。

5

Configure the database for Zabbix server

1 vi /etc/zabbix/zabbix_server.conf

2

DBHost=localhost

DBName=zabbix

DBUser=zabbix

DBPassword=<password>

 

6

Start Zabbix server and agent processes

# systemctl start zabbix-server zabbix-agent httpd

# systemctl enable zabbix-server zabbix-agent httpd

Start Zabbix server and agent processes and make it start at system boot:

7

Starting Zabbix server process

service zabbix-server start

or

systemctl start zabbix-server

Note:if using service command to start,then must use the same command to stop,else it maybe not work.

3.2Fontend

 

Index

step

Operation

note

1

Configure PHP for Zabbix frontend

/etc/httpd/conf.d/zabbix.conf

Add

php_value date.timezone Asia/Shanghai

after:

# php_value date.timezone Europe/Riga

Now your Zabbix server is up and running!

2

Visit the fontend

http://server_ip_or_name/zabbix

(http://11.115.110.114:9008/zabbix)

Error:cannot access

Causes:

1zabbix server default port is 80,witch has been used.

2the firewall is open.

3

Change the default port

1 find the apache service port:

vi /etc/httpd/conf/httpd.conf

2reset the listen and servername

Listen 9008

ServerName 121.43.161.35:9008

3restart apache service

service httpd restart

3add the port to firewall

firewall-cmd

--zone=public --add-port=9008/tcp --permanent

 

Reference link:

https://www.cnblogs.com/moxiaoan/p/5683743.html

 

https://www.jianshu.com/p/41a7d90e55e3

after this,you can access the zabbix web fontend with:

http:// 121.43.161.35:9008/zabbix

4

Follow steps described in Zabbix documentation: Installing frontend

 

https://www.zabbix.com/download

 

3.3Installing frontend

 

Index

step

Operation

note

1

open Zabbix URL: http://<server_ip_or_name>/zabbix

http:// 121.43.161.35:9008/zabbix

https://www.zabbix.com/documentation/3.4/manual/installation/install#installing_frontend

2

Make sure that all software prerequisites are met.

 

1A failed optional prerequisite is displayed in orange and has a Warning status. With a failed optional pre-requisite, the setup may continue.

2 If there is a need to change the Apache user or user group, permissions to the session folder must be verified. Otherwise Zabbix setup may be unable to continue.

3

Enter details for connecting to the database.

 

Zabbix database must already be created

4

Enter Zabbix server details.

 

 

5

Review a summary of settings.

 

 

6

Finish the installation.

 

 

7

Zabbix frontend is ready! The default user name is Admin, password zabbix.

 

 

 

Cofiguration review

Column

detail

note

Database server

11.115.110.114

 

Database port

3306

 

Database name

zabbix

 

Database user

zabbix

 

Database password

**********

 

Zabbix server

11.115.110.114

 

Zabbix server port

10051

 

Zabbix server name

zabbix-server