初探Zabbix7.0 丿记性不太好丶 默认分类 2026-04-18 10 次浏览 0 次点赞 1.关闭SeLinux ``` sudo vim /etc/selinux/config ``` 2.更换DNF源 ``` sudo mv /etc/yum.repos.d /etc/yum.repos.d.bak sudo mkdir /etc/yum.repos.d sudo sed -i.bak -e 's|^mirrorlist=|#mirrorlist=|g' -e 's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=https://mirrors.aliyun.com/rockylinux|g' /etc/yum.repos.d/rocky*.repo sudo dnf clean all sudo dnf makecache dnf update ``` 3.导入zabbix安装源 ``` rpm -Uvh https://repo.zabbix.com/zabbix/7.0/rocky/10/x86_64/zabbix-release-latest-7.0.el10.noarch.rpm dnf clean all ``` 4.安装 ``` dnf install zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent2 dnf install zabbix-agent2-plugin-mongodb zabbix-agent2-plugin-mssql zabbix-agent2-plugin-postgresql ``` 5.安装mysql ``` dnf install -y mariadb-server systemctl enable --now mariadb mariadb-secure-installation mysql -u root -p create database zabbix character set utf8mb4 collate utf8mb4_bin; create user zabbix@localhost identified by 'password'; grant all privileges on zabbix.* to zabbix@localhost; set global log_bin_trust_function_creators = 1; quit; zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix mysql -uroot -p set global log_bin_trust_function_creators = 0; quit; ``` 6.安装PHP ``` dnf install -y php php-mysqlnd php-gd php-bcmath php-ctype php-xml php-mbstring php-sockets php-ldap php-intl systemctl enable --now php-fpm ``` 7.安装NGinx ``` dnf install -y nginx ``` 8.编辑配置文件 /etc/zabbix/zabbix_server.conf ``` DBPassword=password ``` 改一下PHP前端时区 ``` echo "date.timezone = Asia/Shanghai" >> /etc/php.ini systemctl restart php-fpm systemctl restart nginx ``` 9.开一下防火墙 ``` firewall-cmd --permanent --add-service=http firewall-cmd --permanent --add-port=10050/tcp firewall-cmd --permanent --add-port=10051/tcp firewall-cmd --reload ``` 10.测试工具安装 ``` dnf install -y net-snmp-utils snmpwalk -v 3 -u zabbix_user -l authPriv -a SHA -A Hello123 -x AES128 -X Hello123 192.168.80.201 1.3.6.1.2.1.2.2.1.2 ``` 开机启动 ``` systemctl restart zabbix-server zabbix-agent2 nginx php-fpm systemctl enable zabbix-server zabbix-agent2 nginx php-fpm ``` 参数: ``` cat > /etc/php.ini << EOF [PHP] engine = On short_open_tag = Off precision = 14 output_buffering = 4096 zlib.output_compression = Off implicit_flush = Off unserialize_callback_func = serialize_precision = -1 disable_functions = disable_classes = zend.enable_gc = On zend.exception_ignore_args = On zend.exception_string_param_max_len = 0 expose_php = On max_execution_time = 300 max_input_time = 300 memory_limit = 128M error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT display_errors = Off display_startup_errors = Off log_errors = On log_errors_max_len = 1024 ignore_repeated_errors = Off ignore_repeated_source = Off report_memleaks = On html_errors = On variables_order = "EGPCS" request_order = "GP" register_argc_argv = Off auto_globals_jit = On post_max_size = 16M auto_prepend_file = auto_append_file = default_mimetype = "text/html" default_charset = "UTF-8" doc_root = user_dir = enable_dl = Off file_uploads = On upload_max_filesize = 2M max_file_uploads = 20 allow_url_fopen = On allow_url_include = Off default_socket_timeout = 60 extension=mysqli EOF ``` ``` cat > /etc/nginx/conf.d/zabbix.conf << EOF server { listen 80; server_name _; root /usr/share/zabbix; index index.php; location / { try_files \$uri \$uri/ /index.php; } location ~ \.php$ { fastcgi_pass unix:/run/php-fpm/www.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name; include fastcgi_params; } } EOF ``` 点赞 0
楼主残忍的关闭了评论