以下为在同一台机器(localhost)上安装zabbix-server、zabbix-agent,均使用部署包安装。
一、配置LAMP环境
# yum install httpd httpd-devel mariadb mariadb-server mariadb-devel php php-devel php-mysql -y
# systemctl restart httpd
# systemctl restart mariadb
# systemctl enable httpd
# systemctl enable mariadb
二、升级php
升级软件仓库:
# rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
删除php:
# yum remove php-common -y
安装php5.6:
# yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring
重新启动httpd:
# systemctl restart httpd
三、初始化数据库服务程序
# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we’ll need the current password for the root user. If you’ve just installed MariaDB, 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 MariaDB root user without the proper authorisation.
Set root passwordY/n] y
New password: 输入要为root用户设置的数据库密码。
Re-enter new password: 重复再输入一次密码。
Password updated successfully!
Reloading privilege tables..
… Success!
By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB 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 usersY/n] y(删除匿名帐 )
… 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 remotelyY/n] y(禁止root用户从远程登陆)
… Success!
By default, MariaDB 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 itY/n] y(删除test数据库并取消对其的访问权限)
– Dropping test database…
… Success!
– 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 nowY/n] y(刷新授权表,让初始化后的设定立即生效)
… Success!
Cleaning up…
All done! If you’ve completed all of the above steps, your MariaDB installation should now be secure.
Thanks for using MariaDB!
四、从部署包安装zabbix
大多数主流的操作系统分发版本都提供了Zabbix部署包,你可以使用这些部署包安装Zabbix。以下为CentOS7为例:(操作系统分发版本的源码库中可能会缺少Zabbix的最新版本)
安装源码库配置部署包
安装源码库配置部署包,这个部署包包含了yum配置文件。(文件名以最新文件名为准,下同)
# rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
安装Zabbix-server
安装Zabbix部署包。以下是使用Mysql数据库安装Zabbix server、WEB前端的示例。(Zabbix官方源码库也提供fping,iksemel,libssh2部署包这些包位于non-supported目录)
# yum install zabbix-server-mysql zabbix-web-mysql
安装Zabbix Agent
# yum install zabbix-agent
安装初始化数据库
在MySQL上安装Zabbix-server使用的数据库:
然后导入初始架构(Schema)和数据:
配置Zabbix Server
启动zabbix-server、zabbix-agent进程
Zabbix前端的Apache配置文件位于 /etc/httpd/conf.d/zabbix.conf,通常这些设置已经完成。
在配置文件更改后,需要重启Apache Web服务器。
通过web界面完成相关设置
Zabbix前端可以在浏览器中通过 http://zabbix-frontend-hostname/zabbix 进行访问,填入相关信息即可。默认的用户名/密码为Admin/zabbix,登录后可看到一默认存在主机zabbix server,查看状态:
五、zabbix-server is not running 解决方案
官方解决方案:(测试无效,有待考证)
SELinux configuration
Having SELinux status enabled in enforcing mode, you need to execute the following commands to enable communication between Zabbix frontend and server:
RHEL 7 and later:
RHEL prior to 7:
As frontend and SELinux configuration is done, you need to restart Apache web server:
替代方案:关闭防火墙和selinux
文章知识点与官方知识档案匹配,可进一步学习相关知识云原生入门技能树首页概览8757 人正在系统学习中
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!