Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Parsing the ultra-detailed steps of installing Zabix3.0 on centos7

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Prepare before installation:

1.1 install dependency packages:

Yum-y install wget net-snmp-devel OpenIPMI-devel httpd openssl-devel java lrzsz fping-devel libcurl-devel perl-DBI pcre-devel libxml2 libxml2-devel mysql-devel gcc php php-bcmath php-gd php-xml php-mbstring php-ldap php-mysql.x86_64 php-pear php-xmlrpc net-tools wget vim-enhanced

Possible failure problem: Cannot find a valid baseurl for repo: base/7/x86_64

Solution: modify DNS

1.2 turn off the firewall:

# systemctl stop firewalld.service

# systemctl disable firewalld.service

You need to turn off selinux. Be sure to turn this off. Turning on selinux will cause a series of problems, and even the discovery function of zabbix cannot be used properly.

# sed-I "s/SELINUX=enforcing/SELINUX=disabled/g" / etc/selinux/config

Confirm whether the modification is successful

# grep SELINUX / etc/selinux/config

Then restart the system.

# reboot

Zabbix server3.0 is installed on centos 7

According to the official requirements of zabbix server3.0, zabbix server3.0 cannot install yum on centos6 OS at present. If you must install zabbix server3.0 on centos6 OS, it is strongly recommended that you compile and install it in source code, and pay attention to the version of PHP.

With these factors in mind, here we are installing zabbix server3.0 on yum on centos7 OS.

Note: although zabbix server3.0 cannot be installed in yum on centos6 OS, zabbix-agent3.0 can be installed in yum on centos6 OS.

1.1 Building a lamp environment

Before installing zabbix server3.0 on centos7, we first build the lamp environment needed for zabbix.

Download the latest yum source, as follows:

# wget-P / etc/yum.repos.d http://mirrors.aliyun.com/repo/Centos-7.repo

Before we start the installation, we also need to note that the mysql that comes with centos7 is mariadb, which we can check with the following command:

Yum search mysql | tac

Now start installing the lamp environment, using the following command:

[root@zabbix ~] # yum-y install mariadb mariadb-server php php-mysql httpd

From the figure above, we can clearly see that php5.4, httpd2.4 and maradb5.5 are installed by default in centos7, which fully meets the software version requirements of zabbix3.0.

After lamp is installed, let's now configure the mysql database.

Set up the self-boot mysql and start the mysql, using the following command:

[root@zabbix ~] # systemctl enable mariadb.service

[root@zabbix ~] # systemctl start mariadb.service

Initialize the mysql database and configure the root user password. Use the following command:

[root@zabbix ~] # mysql_secure_installation

Note: at the Enter current passwdord for root in the above picture, we can just hit the enter key. Because the default root user password for mysql on centos7 is empty.

The main purpose of the above figure is to configure passwords for root users and refresh relevant permissions. (password set to 123456, for experimental use only, customized in production environment)

Remove anonymous users? Delete anonymous users?

Disallow root login remotely? Prohibit root remote login

Remove test database and access to it? Delete the test database and access it

Reload privilege tables now? Reload the privilege table

The figure above is mainly about configuring anonymous users, test users, remote connections for root users and other related configurations.

After mysql initialization, let's now create the zabbix database and its users, using the following command:

[root@zabbix] # mysql-uroot-p123456-e "create database zabbix default character set utf8 collate utf8_bin;"

[root@zabbix] # mysql-uroot-p123456-e "grant all on zabbix.* to 'zabbix'@'%' identified by' zabbix';"

Now let's test whether the zabbix user you just created can connect to the mysql database, as follows:

[root@zabbix] # mysql-uzabbix-pzabbix

MariaDB [(none)] > show databases

MariaDB [(none)] > quit

From the figure above, we can clearly see that zabbix users can connect to the database normally.

Start apache and open port 80, as follows:

[root@zabbix ~] # systemctl start httpd.service

[root@zabbix ~] # netstat-ltun

Up to this point, the lamp environment has been fully built.

1.2 install zabbix server3.0

After setting up the lamp environment, we now begin to formally install zabbix3.0.

The EPEL source required to install zabbix3.0 and the yum source of zabbix are as follows:

# rpm-ivh http://mirrors.aliyun.com/epel/7/x86_64/e/epel-release-7-9.noarch.rpm

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

After the above installation, we will now formally install zabbix3.0, using the following command:

[root@zabbix ~] # yum-y install zabbix-server-mysql zabbix-web-mysql zabbix-get

From the figure above, we can clearly see that the current zabbix server is version 3.0.5.

After the above installation, we will now start to configure zabbix.

Import the zabbix database structure as follows:

[root@zabbix ~] # cd / usr/share/doc/zabbix-server-mysql-3.0.5/

[root@zabbix zabbix-server-mysql-3.0.5] # zcat create.sql.gz | mysql- uroot-pDe123456 zabbix

After the database is imported, let's modify the configuration file of zabbix sever as follows:

[root@zabbix ~] # vi / etc/zabbix/zabbix_server.conf

LogFile=/var/log/zabbix/zabbix_server.log

LogFileSize=0

PidFile=/var/run/zabbix/zabbix_server.pid

DBHost=localhost

DBName=zabbix

DBUser=zabbix

DBPassword=zabbix

SNMPTrapperFile=/var/log/snmptrap/snmptrap.log

Timeout=4

AlertScriptsPath=/usr/lib/zabbix/alertscripts

ExternalScripts=/usr/lib/zabbix/externalscripts

LogSlowQueries=3000

In the above configuration file, we only need to focus on DBHost, DBName, DBUser,

Just a few items of DBPassword. These are the parameters that configure zabbix server to connect to the mysql database.

After the above modification, let's modify the zabbix.conf file again. As follows:

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

Alias / zabbix / usr/share/zabbix

Options FollowSymLinks

AllowOverride None

Require all granted

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 Asia/Chongqing

Before modification:

After modification:

Php_value date.timezone Asia/Chongqing mainly defines the time zone of php.

After the above modifications are completed, we will add zabbix-server to boot and start zabbix-server, as follows:

[root@zabbix ~] # systemctl start zabbix-server.service

[root@zabbix ~] # systemctl enable zabbix-server.service

Finally, restart apache as follows:

[root@zabbix ~] # systemctl restart httpd.service

3. Configure zabbix

Http://ip/zabbix/setup.php

Next step

Next step

What we need to fill in in the above figure is that the zabbix database we created earlier already has the user and password, Next step

Next step

Next step

Finish

The default user name is Admin password zabbix, and then click sign in

Fourth, install zabbix agent

We installed zabbix server3.0 earlier, and in this chapter we introduce the installation of the zabbix agent side. The installation of zabbix agent is relatively simple, we just need to install the appropriate warehouse, and then execute the installation command.

4.1 install zabbix agent

Install agent on centos os, using the following command:

[root@zabbix ~] # yum clean all

[root@zabbix ~] # yum-y install zabbix zabbix-agent

If there is an error as shown in the above figure during installation, due to the inconsistency between the two versions of the software, careful observation shows that the two software packages use different repositories and reinstall the epel shutdown (enabled=0, located at / etc/yum.repos.d/epel.repo)

4.2 configure zabbix agent

The configuration of zabbix agent is simple, and you only need to modify the Server, ServerActive, and Hostname items in the zabbix agent configuration file.

Where Server and ServerActive are the IP addresses of the zabbix server server, and Hostname is the IP address of the monitored end, as follows:

[root@zabbix ~] # vi / etc/zabbix/zabbix_agentd.conf

PidFile=/var/run/zabbix/zabbix_agentd.pid

LogFile=/var/log/zabbix/zabbix_agentd.log

LogFileSize=0

Server=127.0.0.1

ServerActive=127.0.0.1

Hostname=127.0.0.1

Include=/etc/zabbix/zabbix_agentd.d/

After the above configuration, when we add the monitoring machine on the zabbix web side, we only need to correspond the honst name to the hostname in the configuration file. As follows:

Server= server ip address

ServerActive= server ip address

Hostname= client ip address

Server passive ServerActive active

At this point, zabbix agent has been installed.

Start the client

[root@zabbix] # zabbix_agentd-c / etc/zabbix/zabbix_agentd.conf

[root@zabbix ~] # systemctl start zabbix-agent

[root@zabbix ~] # systemctl restart zabbix-agent

[root@zabbix ~] # systemctl enable zabbix-agent

Check the status.

Fifth, zabbix web Chinese display and optimization

5.1 zabbix web Chinese display

By default, zabbix web displays English. In fact, zabbix supports Chinese. We can open Chinese by modifying the source file on the web side.

Modify the / usr/share/zabbix/include/locales.inc.php file to change the false on the line of zh_CN to true, as follows:

[root@zabbix ~] # vim / usr/share/zabbix/include/locales.inc.php + 55

Before correction:

After correction:

Finally, click on the avatar in the upper right corner of the zabbix web monitoring page, and select the Chinese language in the pop-up tab. As follows:

Before correction:

After correction:

5.2 Chinese display optimization

Install Chinese support package

The installation method is as follows:

[root@zabbix ~] # wget https://github.com/echohn/zabbix-zh_CN/archive/master.zip

[root@zabbix ~] # unzip master.zip

[root@zabbix ~] # rm / usr/share/zabbix/locale/zh_CN/LC_MESSAGES/frontend.mo

[root@zabbix ~] # cp zabbix-zh_CN-master/frontend.mo / usr/share/zabbix/locale/zh_CN/LC_MESSAGES/frontend.mo

You can restart apache and zabbix_server services now, as follows:

[root@zabbix ~] # systemctl restart httpd

[root@zabbix ~] # systemctl restart zabbix-server

Zabbix Chinese garbled code:

The garbled code is shown below:

How to solve the garbled code:

Copy the italics found in C:\ Windows\ Fonts in the Windows system to the windows desktop

How to upload window files to linux, we can build a samba server, here we introduce a software

"winscp" download address on the Internet Baidu on it.

Double-click to open when the installation is complete

Click Edit:

Enter hostname (ip address) port 22 username and password

Save, then click Log in

Enter the password again and make sure

On the left is the window desktop, and on the right is the linux root directory. Directly dragging the file on the left to the right is to copy the window file to linux, so that you can upload it to linux. Next, move simkai.ttf to the fonts directory of the zabbix installation directory.

[root@zabbix ~] # mv simkai.ttf / usr/share/zabbix/fonts/

[root@zabbix ~] # cd / usr/share/zabbix/fonts/

[root@zabbix fonts] # ls

Graphfont.ttf simkai.ttf

[root@zabbix fonts] # chmod 777 simkai.ttf

[root@zabbix fonts] # cp graphfont.ttf graphfont.ttf.bak

[root@zabbix fonts] # mv simkai.ttf graphfont.ttf

Mv: does it overwrite "graphfont.ttf"? Y

Check it out, ok

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report