码迷,mamicode.com
首页 > 其他好文 > 详细

CentOS 7 源码安装Zabbix 5.0 LTS

时间:2020-06-02 11:35:50      阅读:551      评论:0      收藏:0      [点我收藏+]

标签:源码编译安装   key   asi   moni   image   led   app   aclocal   ==   

Zabbix监控系统的Web采用PHP编写而成,需要安装PHP动态解析组件,并用PHP操作数据库。httpd与PHP的交互式通过php-fpm完成的,需要在httpd服务的配置文件中开启FastCGI。

Zabbix 5.0 LTS于2020年5月发布第一个更新,Zabbix 5.0的部署安装不同于之前的1、2、3、4大版本,改动比较大。目前发现的是Zabbix前端安装配置与之前的大版本有较大的区别,以下是源码编译安装的踩坑过程:

安装完毕CentOS71908后,先做OS环境初始化,执行脚本如下:

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.original
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all && yum makecache
yum -y update
yum install -y ntpdate
ntpdate cn.ntp.org.cn
systemctl stop firewalld && systemctl disable firewalld
sed -i ‘s/^SELINUX=./SELINUX=disabled/‘ /etc/selinux/config && setenforce 0
wget https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm
yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
sed -i ‘s|^#baseurl=https://download.fedoraproject.org/pub|baseurl=https://mirrors.aliyun.com|‘ /etc/yum.repos.d/epel
sed -i ‘s|^metalink|#metalink|‘ /etc/yum.repos.d/epel*
yum clean all && yum makecache
yum -y update
init 6

安装部署Zabbix 5.0 LTS:

[googlebigtable@localhost ~]$ su - root
Password:
Last login: Mon Jun 1 02:54:07 EDT 2020 on pts/0
[root@localhost ~]# rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Retrieving http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-release-el7-5 ################################# [100%]
[root@localhost ~]# yum install epel-release -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Package epel-release-7-12.noarch already installed and latest version
Nothing to do
[root@localhost ~]# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
Retrieving https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
warning: /var/tmp/rpm-tmp.Pk5uwy: Header V4 RSA/SHA1 Signature, key ID 62e74ca5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:webtatic-release-7-3 ################################# [100%]
[root@localhost ~]# yum -y update
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
.......................................................................................
[root@localhost zabbix-5.0.0]# yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
Loaded plugins: fastestmirror, langpacks
remi-release-7.rpm | 20 kB 00:00:00
Examining /var/tmp/yum-root-nMNXiI/remi-release-7.rpm: remi-release-7.7-2.el7.remi.noarch
Marking /var/tmp/yum-root-nMNXiI/remi-release-7.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package remi-release.noarch 0:7.7-2.el7.remi will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================
Package Arch Version Repository Size

Installing:
remi-release noarch 7.7-2.el7.remi /remi-release-7 26 k

Transaction Summary

Install 1 Package

Total size: 26 k
Installed size: 26 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Installing : remi-release-7.7-2.el7.remi.noarch 1/1
Verifying : remi-release-7.7-2.el7.remi.noarch 1/1

Installed:
remi-release.noarch 0:7.7-2.el7.remi

Complete!
[root@localhost zabbix-5.0.0]# yum install yum-utils
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile

  • remi-safe: mirrors.tuna.tsinghua.edu.cn
  • webtatic: uk.repo.webtatic.com
    remi-safe | 3.0 kB 00:00:00
    remi-safe/primary_db | 1.7 MB 00:00:00
    Package yum-utils-1.1.31-54.el7_8.noarch already installed and latest version
    Nothing to do
    [root@localhost zabbix-5.0.0]# yum install -y php73-php-fpm php73-php-cli php73-php-bcmath php73-php-gd php73-php-json php73-php-mbstring php73-php-mcrypt php73-php-mysqlnd php73-php-opcache php73-php-pdo php73-php-pecl-crypto php73-php-pecl-mcrypt php73-php-pecl-geoip php73-php-recode php73-php-snmp php73-php-soap php73-php-xmll
    Loaded plugins: fastestmirror, langpacks
    Loading mirror speeds from cached hostfile
    .......................................................................................
    [root@localhost ~]# yum install -y httpd php php-gd php-ldap php-mysqlnd php-json php-bcmath php-mbstring php-xml mysql mysql-server mysql-devel libevent-devel pcre-devel gcc gcc-c++ make libcurl-devel curl- net-snmp libxml2-*
    Loaded plugins: fastestmirror, langpacks
    Loading mirror speeds from cached hostfile
    .............................................................................................................
    [root@localhost ~]# systemctl enable --now httpd mysqld php-fpm
    [root@localhost ~]# cd /opt/
    [root@localhost opt]# ls -F
    rh/
    [root@localhost opt]# ll
    total 0
    drwxr-xr-x. 2 root root 6 Oct 30 2018 rh
    [root@localhost opt]# wget https://cdn.zabbix.com/zabbix/sources/stable/5.0/zabbix-5.0.0.tar.gz
    --2020-06-01 15:00:53-- https://cdn.zabbix.com/zabbix/sources/stable/5.0/zabbix-5.0.0.tar.gz
    Resolving cdn.zabbix.com (cdn.zabbix.com)... 172.67.179.162, 104.31.69.176, 104.31.68.176, ...
    Connecting to cdn.zabbix.com (cdn.zabbix.com)|172.67.179.162|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 18519888 (18M) [application/octet-stream]
    Saving to: ‘zabbix-5.0.0.tar.gz’

100%[===================================================================================================================================>] 18,519,888 451KB/s in 44s

2020-06-01 15:01:37 (416 KB/s) - ‘zabbix-5.0.0.tar.gz’ saved [18519888/18519888]

[root@localhost opt]#
[root@localhost opt]# ls -F
rh/ zabbix-5.0.0.tar.gz
[root@localhost opt]# tar zxvf zabbix-5.0.0.tar.gz
zabbix-5.0.0/
..................................................................................
[root@localhost opt]# ls -F
rh/ zabbix-5.0.0/ zabbix-5.0.0.tar.gz
[root@localhost opt]# cd zabbix-5.0.0/
[root@localhost zabbix-5.0.0]# ls -F
aclocal.m4 bin/ ChangeLog conf/ config.sub configure.ac database/ include/ install-sh Makefile.am man/ missing README src/
AUTHORS build/ compile
config.guess configure COPYING depcomp* INSTALL m4/ Makefile.in misc/ NEWS sass/ ui/
[root@localhost zabbix-5.0.0]# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent \

--with-mysql --with-net-snmp --with-libcurl --with-libxml2
checking for a BSD-compatible install... /bin/install -c
checking whether build environment is sane... yes
...............................................................................................................


[root@localhost zabbix-5.0.0]# make install
Making install in src
.......................................................................
[root@localhost zabbix-5.0.0]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we‘ll need the current
password for the root user. If you‘ve just installed MySQL, and
you haven‘t set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]
... Success!

Normally, root should only be allowed to connect from ‘localhost‘. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]
... Success!

By default, MySQL comes with a database named ‘test‘ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n]

  • Dropping test database...
    ERROR 1008 (HY000) at line 1: Can‘t drop database ‘test‘; database doesn‘t exist
    ... Failed! Not critical, keep moving...
  • Removing privileges on test database...
    ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n]
... Success!

All done! If you‘ve completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

Cleaning up...
[root@localhost zabbix-5.0.0]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.6.48 MySQL Community Server (GPL)

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)

mysql> create user zabbix@localhost identified by ‘password‘;
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on zabbix.* to zabbix@localhost;
Query OK, 0 rows affected (0.00 sec)

mysql> quit;
Bye
[root@localhost zabbix-5.0.0]# mysql -uzabbix -p zabbix < /opt/zabbix-5.0.0/database/mysql/schema.sql
Enter password:
[root@localhost zabbix-5.0.0]# mysql -uzabbix -p zabbix < /opt/zabbix-5.0.0/database/mysql/images.sql
Enter password:
[root@localhost zabbix-5.0.0]# mysql -uzabbix -p zabbix < /opt/zabbix-5.0.0/database/mysql/data.sql
Enter password:
[root@localhost zabbix-5.0.0]# gedit /usr/local/zabbix/etc/zabbix_server.conf

(gedit:14661): WARNING : 15:14:39.586: Set document metadata failed: Setting attribute metadata::gedit-spell-language not supported

(gedit:14661): WARNING : 15:14:39.587: Set document metadata failed: Setting attribute metadata::gedit-encoding not supported

(gedit:14661): WARNING : 15:14:41.357: Set document metadata failed: Setting attribute metadata::gedit-position not supported
[root@localhost zabbix-5.0.0]# ls -F /var/www/html/
[root@localhost zabbix-5.0.0]# ls -F /var/www/
cgi-bin/ html/
[root@localhost zabbix-5.0.0]#
[root@localhost zabbix-5.0.0]# gedit /lib/systemd/system/zabbix-server.service

(gedit:14776): WARNING : 15:17:46.533: Set document metadata failed: Setting attribute metadata::gedit-spell-language not supported

(gedit:14776): WARNING : 15:17:46.533: Set document metadata failed: Setting attribute metadata::gedit-encoding not supported

(gedit:14776): WARNING : 15:17:47.613: Set document metadata failed: Setting attribute metadata::gedit-position not supported
[root@localhost zabbix-5.0.0]# gedit /lib/systemd/system/zabbix-agent.service

(gedit:16210): WARNING : 15:18:14.142: Set document metadata failed: Setting attribute metadata::gedit-spell-language not supported

(gedit:16210): WARNING : 15:18:14.144: Set document metadata failed: Setting attribute metadata::gedit-encoding not supported

(gedit:16210): WARNING : 15:18:16.022: Set document metadata failed: Setting attribute metadata::gedit-position not supported
[root@localhost zabbix-5.0.0]# systemctl enable --now zabbix-server
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
[root@localhost zabbix-5.0.0]# systemctl enable --now zabbix-agent
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
[root@localhost zabbix-5.0.0]# cp -r /opt/zabbix-5.0.0/ui/* /var/www/html/
[root@localhost zabbix-5.0.0]# chown -R apache:apache /var/www/html/
[root@localhost zabbix-5.0.0]# sed -i ‘s#post_max_size = 8M#post_max_size = 16M#‘ /etc/php.ini
[root@localhost zabbix-5.0.0]# sed -i ‘s#max_execution_time = 30#max_execution_time = 300#‘ /etc/php.ini
[root@localhost zabbix-5.0.0]# sed -i ‘s#max_input_time = 60#max_input_time = 300#‘ /etc/php.ini
[root@localhost zabbix-5.0.0]# sed -i ‘s#;date.timezone =#date.timezone = Asia/Shanghai#‘ /etc/php.ini
[root@localhost zabbix-5.0.0]#

以下是Web安装配置界面:
技术图片

孟伯,20200531

交流联系:微信 1807479153 ,QQ 1807479153

CentOS 7 源码安装Zabbix 5.0 LTS

标签:源码编译安装   key   asi   moni   image   led   app   aclocal   ==   

原文地址:https://blog.51cto.com/6286393/2500416

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!