Zabbix5.0企业级安装部署详细手册step-by-step超级全面

作者联系微信号:NateIT 

1.安装环境准备

yum -y update    (所有都升级和改变)

升级所有包,系统版本和内核,改变软件设置和系统设置

yum -y upgrade(不变内核和设置,升级包和系统版本)

升级所有包和系统版本,不改变内核,软件和系统设置

1.1检查操作系统版本

[root@huaxun ~]#  cat /etc/redhat-release

CentOS Linux release 8.2.2004 (Core)

1.2检查服务器主机名称和修改主机名称

检查主机名称

[root@huaxun ~]# hostnamectl

修改主机名hostname

静态,瞬态或灵活分别对应 “--static”,“--transient”或“--pretty”选项我们永久修改主机名称用“--static”选项

[root@huaxun ~]# hostnamectl --static set-hostname zabbixserver

[root@huaxun ~]# hostnamectl

[root@huaxun ~]#  cat  /etc/hostname

修改hosts文件

[root@huaxun ~]# vi /etc/hosts

[root@huaxun ~]# reboot

完成以上操作后重启系统。

1.3 关闭防火墙及SElinux

[root@huaxun ~]# systemctl stop firewalld.service

[root@huaxun ~]# systemctl disable firewalld.service

(1)设置开机启用防火墙:systemctl enable firewalld.service

(2)设置开机禁用防火墙:systemctl disable firewalld.service

(3)启动防火墙:systemctl start firewalld

(4)关闭防火墙:systemctl stop firewalld

(5)检查防火墙状态:systemctl status firewalld

开放10050端口

# 开放10050端口

firewall-cmd --zone=public --add-port=10050/tcp --permanent

# 开放80端口

firewall-cmd --zone=public --add-port=80/tcp –permanent

# 配置立即生效

firewall-cmd --reload

SELinux关闭

接着将SELinux关闭,运行如下命令编辑SELINUX配置文件:

并将SELINUX=enforcing改成SELINUX=disable,如下:

[root@huaxun ~]# vi /etc/selinux/config

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

#     enforcing - SELinux security policy is enforced.

#     permissive - SELinux prints warnings instead of enforcing.

#     disabled - No SELinux policy is loaded.

SELINUX=disabled

# SELINUXTYPE= can take one of three values:

#     targeted - Targeted processes are protected,

#     minimum - Modification of targeted policy. Only selected processes are protected.

#     mls - Multi Level Security protection.

SELINUXTYPE=targeted

SELinux有三种模式:Enforcing, Permissive 和 Disable,Enforcing模式就是应用SELinux所设定的Policy,所有违反Policy的规则(Rules)都会被SELinux拒绝,Permissive和Enforcing的区别就在于,前者还是会遵循SELinux的Policy,但是对于违反规则的操作只会予以记录而并不会拒绝操作,Disable 顾名思义就是完全禁用SELinux;

修改完成后,重启机器,重启后运行getenforce命令查看已经关闭SELinux。

[root@huaxun ~]# getenforce

Disabled

[root@huaxun ~]# /usr/sbin/sestatus -v

SELinux status:                 disabled

1.4安装依赖包

[root@zabbixserver ~]# yum install -y httpd mariadb-server mariadb php php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mhash

[root@zabbixserver ~]# rpm -qa httpd php mariadb

备注:可能用到的指令

安装指令

undo yum install mariadb mariadb-server -y

查看是否安装成功

rpm -qa | grep mariadb

常用命令:

# 查看 mariadb 安装位置

rpm -ql mariadb

# 设置开机自动启动

systemctl enable mariadb

# 开启mariadb服务

systemctl start mariadb

# 关闭 mariadb 服务

systemctl stop mariadb

# 重启mariadb服务

systemctl restart mariadb

1.5相关配置

[root@zabbixserver ~]#  vi /etc/httpd/conf/httpd.conf

将servername设置为192.168.10.218:80,在DirectoryIndex中添加index.php,如下:

# ServerName gives the name and port that the server uses to identify itself.

# This can often be determined automatically, but we recommend you specify

# it explicitly to prevent problems during startup.

#

# If your host doesn't have a registered DNS name, enter its IP address here.

#

ServerName 39.99.160.163:80

#

# DirectoryIndex: sets the file that Apache will serve if a directory

# is requested.

#

<IfModule dir_module>

    DirectoryIndex index.html index.php

</IfModule>

接着配置php.ini,如下:

[root@zabbixserver ~]# vi /etc/php.ini

将date.timezone设置为PRC:

PRC就是The People's Republic of China

[Date]
; Defines the default timezone used by the date functions
http://php.net/date.timezone
date.timezone = PRC

1.6开始启动http和mysql数据库

[root@zabbixserver ~]# systemctl start httpd

[root@zabbixserver ~]# systemctl start mariadb

[root@zabbixserver ~]#  ss -naplt | grep httpd

[root@zabbixserver ~]#  ss -naplt | grep mysqld

设置开机自启动模式:

[root@zabbixserver ~]# systemctl enable httpd
[root@zabbixserver ~]# systemctl enable mariadb

1.7开始测试PHP功能

[root@zabbixserver ~]# vi /var/www/html/index.php

输入以下内容:

<?php
phpinfo();
?>

打开http://39.99.160.163,显示如下界面说明PHP运行正常。

1.8 Centos8上安装中文语言包

[root@zabbixserver ~]# yum install langpacks-zh_CN.noarch

1.9 配置并初始化数据库

设置mysql数据库root密码为zabbixroot,如下:

[root@zabbixserver ~]# mysqladmin -u

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值