關閉 selinux
vi /etc/sysconfig/selinux # 編輯 selinux 配置文件后保存退出
reboot # 重啟永久生效
SELINUX=disabled 詳細解說 SELiunx
安裝 httpd
yum -y install httpd
systemctl status httpd.service # 查看 httpd 狀態
systemctl start httpd.service # 啟動 httpd
systemctl enable httpd # 設置 httpd 每次開機都自動啟動
安裝更新源、php7、禁用 5.4、開啟 7.2
yum -y install epel-release # 安裝 Epel 擴充資源庫
yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm # 安裝 php7
yum install -y yum-utils # 安裝 yum 管理工具
yum-config-manager --disable remi-php54 # 停用 PHP5.4
yum-config-manager --enable remi-php72 # 啟用 PHP7.2
安裝 PHP 套件以及編輯 PHP.ini 文件
yum install -y php php-pear php-cgi php-common php-mbstring php-snmp php-gd php-pecl-mysql php-xml php-mysql php-gettext php-bcmath
vi /etc/php.ini # 這個配置文件是需要滿足 Zabbix 的配置要求,要不然會出錯
PHP option "memory_limit" 128M
PHP option "post_max_size" 16M
PHP option "upload_max_filesize" 2M
PHP option "max_execution_time" 300
PHP option "max_input_time" 300
PHP option "date.timezone" Asia/Taipe
# 設置時區的時候請留意,默認是不開啟時區
安裝 mariadb-server 與配置安全性
yum --enablerepo=remi install mariadb-server -y
systemctl start mariadb.service
systemctl enable mariadb
mysql_secure_installation
# 1 直接回車
# 2 設定 root 訪問 mariadb-server 密碼
# 全部回答 Y(yes)
配置數據庫
mysql -u root -p
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by 'P@ssw09rd';
grant all privileges on zabbix.* to zabbix@localhost ;
quit;
安裝 zabbix
rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-get
重啟 httpd 服務、配置 mysql
systemctl restart httpd.service
cd /usr/share/doc/zabbix-server-mysql-4.0.20/
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
P@ssw09rd # 輸入密碼
配置 zabbix_server.conf
vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=P@ssw09rd
配置 zabbix.conf 時區
vi /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Taipei
啟動 zabbix-server
systemctl restart zabbix-server zabbix-agent httpd
systemctl enable zabbix-server zabbix-agent httpd
配置防火墻與重啟 httpd
firewall-cmd --add-service={http,https} --permanent
firewall-cmd --add-port={10051/tcp,10050/tcp} --permanent
firewall-cmd --reload
systemctl restart httpd
登陸你的 zabbix
http://ip or domain name/zabbix/
Done
無法啟動 Zabbix 一般都是 Mysql 數據庫格式配置錯誤以及 php 文件配置信息不對
全部配置信息
vi /etc/sysconfig/selinux SELINUX=disabled reboot ====== yum -y install httpd systemctl status httpd.service systemctl start httpd.service systemctl enable httpd ====== yum -y install epel-release yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm yum install -y yum-utils yum-config-manager --disable remi-php54 yum-config-manager --enable remi-php72 ====== yum install -y php php-pear php-cgi php-common php-mbstring php-snmp php-gd php-pecl-mysql php-xml php-mysql php-gettext php-bcmath vi /etc/php.ini(修改)PHP option "memory_limit" 128M PHP option "post_max_size" 16M PHP option "upload_max_filesize" 2M PHP option "max_execution_time" 300 PHP option "max_input_time" 300 PHP option "date.timezone" Asia/Taipei ====== yum --enablerepo=remi install mariadb-server -y systemctl start mariadb.service systemctl enable mariadb mysql_secure_installation(All-Yes)mysql -u root -p create database zabbix character set utf8 collate utf8_bin; grant all privileges on zabbix.* to zabbix@localhost identified by 'P@ssw09rd'; grant all privileges on zabbix.* to zabbix@localhost ; quit;
======rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-get
====== systemctl restart httpd.service cd /usr/share/doc/zabbix-server-mysql-4.0.20/ zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix P@ssw09rd ====== vi /etc/zabbix/zabbix_server.conf(配置)DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=P@ssw09rd ======vi /etc/httpd/conf.d/zabbix.conf php_value date.timezone Asia/Taipei
systemctl restart zabbix-server zabbix-agent httpd systemctl enable zabbix-server zabbix-agent httpd
firewall-cmd --add-service={http,https} --permanent firewall-cmd --add-port={10051/tcp,10050/tcp} --permanent firewall-cmd --reload systemctl restart httpd
=== http://192.168.18.155/zabbix/
正文完