一、实验环境:
[root@zabbixserver ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) [root@zabbixserver ~]# uname -r 3.10.0-327.el7.x86_64 [root@zabbixserver ~]# [root@zabbixserver ~]# ifconfig eno16777736 eno16777736: flags=4163<UP,broADCAST,RUNNING,MULTICAST> mtu 1500 inet 10.0.0.98 netmask 255.255.255.0 broadcast 10.0.0.255 inet6 fe80::20c:29ff:fef2:d583 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:f2:d5:83 txqueuelen 1000 (Ethernet) RX packets 150143 bytes 218651391 (208.5 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 30015 bytes 2046005 (1.9 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 [root@zabbixserver ~]#
二、安装软件包:
[root@zabbixserver tools]# ll total 65776 -rw-r--r-- 1 root root 523321 Jan 10 10:27 libmcrypt-2.5.7.tar.gz -rw-r--r-- 1 root root 32167628 Nov 28 07:46 mysql-5.6.35.tar.gz -rw-r--r-- 1 root root 910812 Oct 18 11:14 Nginx-1.10.2.tar.gz -rw-r--r-- 1 root root 18331135 Aug 6 2015 PHP-5.6.12.tar.gz -rw-r--r-- 1 root root 15412400 Jan 10 12:01 zabbix-3.0.5.tar.gz [root@zabbixserver tools]#
三、安装步骤
(1)创建用户zabbix
[root@zabbixserver ~]# useradd zabbix -s /sbin/nologin [root@zabbixserver ~]# id zabbix uid=1000(zabbix) gid=1000(zabbix) groups=1000(zabbix) [root@zabbixserver ~]#
(2)安装执行编译MysqL的编译工具cmake,(从MysqL5.5以后编译用工具cmake)
[root@zabbixserver ~]# yum -y install cmake cmake-devel [root@zabbixserver ~]#
[root@zabbixserver ~]# useradd MysqL -s /sbin/nologin [root@zabbixserver ~]# id MysqL uid=1001(MysqL) gid=1001(MysqL) groups=1001(MysqL) [root@zabbixserver ~]#
(4)安装MysqL,用cmake编译,先安装依赖包openssl openssl-devel ncurses ncurses-devel
[root@zabbixserver ~]# yum install -y openssl openssl-devel ncurses ncurses-devel [root@zabbixserver ~]# cd tools [root@zabbixserver tools]# tar xf mysql-5.6.35.tar.gz [root@zabbixserver tools]# cd mysql-5.6.35 [root@zabbixserver mysql-5.6.35]# [root@zabbixserver mysql-5.6.35]# cmake \ -DCMAKE_INSTALL_PREFIX=/usr/local/MysqL \ -DMysqL_DATADIR=/usr/local/MysqL/data \ -DSYSconfdIR=/etc \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_MEMORY_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DMysqL_UNIX_ADDR=/var/lib/MysqL/MysqL.sock \ -DMysqL_TCP_PORT=3306 \ -DENABLED_LOCAL_INFILE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DEXTRA_CHARSETS=all \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DMysqL_USER=MysqL \ -DWITH_DEBUG=0 \ -DWITH_SSL=system [root@zabbixserver mysql-5.6.35]# make && make install
(5)配置MysqL
[root@zabbixserver mysql-5.6.35]# chown -R MysqL.MysqL /usr/local/MysqL/
#拷贝配置文件
[root@zabbixserver mysql-5.6.35]# cp support-files/my-default.cnf /etc/my.cnf
[root@zabbixserver mysql-5.6.35]# vim /etc/my.cnf [client] port = 3306 socket = /usr/local/MysqL/data/socket [MysqLd] basedir = /usr/local/MysqL datadir = /usr/local/MysqL/data port = 3306 server_id = 1 socket = /usr/local/MysqL/data/socket [root@zabbixserver mysql-5.6.35]#
[root@zabbixserver mysql-5.6.35]# /usr/local/MysqL/scripts/MysqL_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/MysqL --datadir=/usr/local/MysqL/data --user=MysqL
[root@zabbixserver mysql-5.6.35]# cp support-files/MysqL.server /etc/init.d/MysqLd [root@zabbixserver mysql-5.6.35]# chmod +x /etc/init.d/MysqLd [root@zabbixserver mysql-5.6.35]# ll /etc/init.d/MysqLd -rwxr-xr-x 1 root root 10875 Jan 10 18:11 /etc/init.d/MysqLd [root@zabbixserver mysql-5.6.35]# [root@zabbixserver mysql-5.6.35]# chkconfig MysqLd on
#修改PATH变量
[root@zabbixserver mysql-5.6.35]# echo 'export PATH=/usr/local/MysqL/bin:$PATH'>>/etc/profile [root@zabbixserver mysql-5.6.35]# tail -1 /etc/profile export PATH=/usr/local/MysqL/bin:$PATH [root@zabbixserver mysql-5.6.35]# source /etc/profile [root@zabbixserver mysql-5.6.35]#
[root@zabbixserver mysql-5.6.35]# /etc/init.d/MysqLd start Starting MysqL. SUCCESS! [root@zabbixserver mysql-5.6.35]# MysqL Welcome to the MysqL monitor. Commands end with ; or \g. Your MysqL connection id is 1 Server version: 5.6.35 Source distribution copyright (c) 2000, 2016, 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> \s -------------- MysqL Ver 14.14 distrib 5.6.35, for Linux (x86_64) using EditLine wrapper Connection id: 1 Current database: Current user: root@localhost SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server version: 5.6.35 Source distribution Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: utf8 Db characterset: utf8 Client characterset: utf8 Conn. characterset: utf8 UNIX socket: /usr/local/MysqL/data/socket Uptime: 8 sec Threads: 1 Questions: 5 Slow queries: 0 Opens: 70 Flush tables: 1 Open tables: 63 Queries per second avg: 0.625 -------------- MysqL>
MysqL> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('root'); Query OK, 0 rows affected (0.00 sec) MysqL> flush privileges; Query OK, 0 rows affected (0.00 sec) MysqL> #删除不必要的用户 MysqL> select user,host from user; +------+--------------+ | user | host | +------+--------------+ | root | 127.0.0.1 | | root | ::1 | | | localhost | | root | localhost | | | zabbixserver | | root | zabbixserver | +------+--------------+ 6 rows in set (0.00 sec) MysqL> MysqL> delete from user where user="root" and host="::1"; Query OK, 1 row affected (0.00 sec) MysqL> delete from user where user="" and host="zabbixserver"; Query OK, 1 row affected (0.00 sec) MysqL> select user,host from user; +------+--------------+ | user | host | +------+--------------+ | root | 127.0.0.1 | | | localhost | | root | localhost | | root | zabbixserver | +------+--------------+ 4 rows in set (0.00 sec) MysqL> delete from user where user="" and host="localhost"; Query OK, 1 row affected (0.00 sec) MysqL> select user,host from user; +------+--------------+ | user | host | +------+--------------+ | root | 127.0.0.1 | | root | localhost | | root | zabbixserver | +------+--------------+ 3 rows in set (0.00 sec) MysqL>
#创建zabbix访问MysqL的用户和存放zabbix的数据库zabbix
MysqL> GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'127.0.0.1' IDENTIFIED BY 'zabbix' WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec) MysqL> create database zabbix default charset utf8; Query OK, 1 row affected (0.00 sec) MysqL> select user,host from user; +--------+--------------+ | user | host | +--------+--------------+ | root | 127.0.0.1 | | zabbix | 127.0.0.1 | | root | localhost | | root | zabbixserver | +--------+--------------+ 4 rows in set (0.00 sec) MysqL> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | MysqL | | performance_schema | | test | | zabbix | +--------------------+ 5 rows in set (0.00 sec) MysqL>
(6)安装PHP
#安装依赖包
[root@zabbixserver ~]# yum install -y libxml2-devel openssl-devel libcurl-devel libjpeg-turbo-devel libpng-devel freetype-devel libmcrypt-devel #创建启动PHP的用户和用户组,解压PHP压缩包进入压缩目录进行编译安装 [root@zabbixserver ~]# useradd www -s /sbin/nologin [root@zabbixserver ~]# id www uid=1002(www) gid=1002(www) groups=1002(www) [root@zabbixserver ~]# [root@zabbixserver ~]# cd tools [root@zabbixserver tools]# tar xf PHP-5.6.12.tar.gz [root@zabbixserver tools]# cd PHP-5.6.12 [root@zabbixserver PHP-5.6.12]# ./configure --prefix=/usr/local/PHP \ --with-config-file-path=/usr/local/PHP/etc \ --enable-fpm \ --with-fpm-user=www \ --with-fpm-group=www \ --with-MysqL=MysqLnd \ --with-MysqLi=MysqLnd \ --with-pdo-MysqL=MysqLnd \ --with-iconv-dir \ --with-freetype-dir \ --with-jpeg-dir \ --with-png-dir \ --with-zlib \ --with-libxml-dir=/usr \ --enable-xml \ --disable-rpath \ --enable-bcmath \ --enable-shmop \ --enable-sysvsem \ --enable-inline-optimization \ --with-curl \ --enable-mbregex \ --enable-mbstring \ --with-mcrypt \ --enable-ftp \ --with-gd \ --enable-gd-native-ttf \ --with-openssl \ --with-mhash \ --enable-pcntl \ --enable-sockets \ --with-xmlrpc \ --enable-zip \ --enable-soap \ --without-pear \ --with-gettext \ --disable-fileinfo \ --enable-maintainer-zts [root@zabbixserver PHP-5.6.12]# make && make install
#配置PHP相关服务
[root@zabbixserver PHP-5.6.12]# cp /usr/local/PHP/etc/PHP-fpm.conf.default /usr/local/PHP/etc/PHP-fpm.conf [root@zabbixserver PHP-5.6.12]# cp PHP.ini-production /usr/local/PHP/etc/PHP.ini [root@zabbixserver PHP-5.6.12]# cp sapi/fpm/init.d.PHP-fpm /etc/init.d/PHP-fpm [root@zabbixserver PHP-5.6.12]# chmod +x /etc/init.d/PHP-fpm [root@zabbixserver PHP-5.6.12]# ll /etc/init.d/PHP-fpm -rwxr-xr-x 1 root root 2354 Jan 10 18:54 /etc/init.d/PHP-fpm [root@zabbixserver PHP-5.6.12]# [root@zabbixserver PHP-5.6.12]# chkconfig PHP-fpm on [root@zabbixserver ~]# service PHP-fpm start Starting PHP-fpm done [root@zabbixserver ~]# netstat -lnupt|grep PHP-fpm tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 51556/PHP-fpm: mast [root@zabbixserver ~]#
(7)安装Nginx
[root@zabbixserver tools]# tar xf Nginx-1.10.2.tar.gz [root@zabbixserver tools]# cd Nginx-1.10.2 [root@zabbixserver Nginx-1.10.2]# ./configure --prefix=/usr/local/Nginx \ --pid-path=/usr/local/Nginx/Nginx.pid \ --error-log-path=/usr/local/Nginx/error.log \ --http-log-path=/usr/local/Nginx/access.log \ --with-http_ssl_module --with-mail \ --with-mail_ssl_module --with-stream \ --with-threads [root@zabbixserver Nginx-1.10.2]# make && make install [root@zabbixserver Nginx-1.10.2]# /usr/local/Nginx/sbin/Nginx -t Nginx: the configuration file /usr/local/Nginx/conf/Nginx.conf Syntax is ok Nginx: configuration file /usr/local/Nginx/conf/Nginx.conf test is successful [root@zabbixserver Nginx-1.10.2]# /usr/local/Nginx/sbin/Nginx [root@zabbixserver Nginx-1.10.2]# netstat -lnupt|grep Nginx tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 54318/Nginx: master [root@zabbixserver Nginx-1.10.2]#
(8)安装zabbix
#安装依赖包
[root@zabbixserver tools]# yum install -y net-snmp-devel libssh3-devel
#解压编译安装
[root@zabbixserver tools]# tar xf zabbix-3.0.5.tar.gz [root@zabbixserver tools]# cd zabbix-3.0.5 [root@zabbixserver zabbix-3.0.5]# ./configure --prefix=/usr/local/zabbix \ --enable-server --enable-agent \ --with-MysqL --with-net-snmp \ --with-libcurl --with-libxml2 \ --with-ssh3 [root@zabbixserver zabbix-3.0.5]# make && make install
#验证安装结果
[root@zabbixserver zabbix-3.0.5]# /usr/local/zabbix/sbin/zabbix_server -V zabbix_server (Zabbix) 3.0.5 Revision 62889 30 September 2016, compilation time: Jan 10 2017 19:04:09 copyright (C) 2016 Zabbix SIA License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it according to the license. There is NO WARRANTY, to the extent permitted by law. [root@zabbixserver zabbix-3.0.5]#
[root@zabbixserver zabbix-3.0.5]# egrep -v "^#|^$" /usr/local/zabbix/etc/zabbix_server.conf LogFile=/tmp/zabbix_server.log dbname=zabbix DBUser=zabbix Timeout=4 LogSlowQueries=3000 [root@zabbixserver zabbix-3.0.5]#
#修改后为
[root@zabbixserver zabbix-3.0.5]# egrep -v "^#|^$" /usr/local/zabbix/etc/zabbix_server.conf LogFile=/usr/local/zabbix/etc/log/zabbix_server.log PidFile=/usr/local/zabbix/etc/zabbix_server.pid DBHost=localhost dbname=zabbix DBUser=zabbix DBPassword=zabbix Timeout=4 LogSlowQueries=3000 [root@zabbixserver zabbix-3.0.5]#
#创建对应目录并修改属主和属组
[root@zabbixserver zabbix-3.0.5]# mkdir -p /usr/local/zabbix/etc/log [root@zabbixserver zabbix-3.0.5]# chown -R zabbix.zabbix /usr/local/zabbix/* [root@zabbixserver zabbix-3.0.5]#
#导入zabbix数据到zabbix数据库,注意顺序,一定是schema.sql、p_w_picpaths.sql、data.sql
[root@zabbixserver zabbix-3.0.5]# MysqL -uzabbix -pzabbix -h227.0.0.1 zabbix < /root/tools/zabbix-3.0.5/database/MysqL/schema.sql [root@zabbixserver zabbix-3.0.5]# MysqL -uzabbix -pzabbix -h227.0.0.1 zabbix < /root/tools/zabbix-3.0.5/database/MysqL/p_w_picpaths.sql [root@zabbixserver zabbix-3.0.5]# MysqL -uzabbix -pzabbix -h227.0.0.1 zabbix < /root/tools/zabbix-3.0.5/database/MysqL/data.sql [root@zabbixserver zabbix-3.0.5]# MysqL> use zabbix Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed MysqL> MysqL> show tables; +----------------------------+ | Tables_in_zabbix | +----------------------------+ | ackNowledges | | actions | | alerts | | application_discovery | | application_prototype | | application_template | | applications | | auditlog | | auditlog_details | | autoreg_host | | conditions | | config | | dbversion | | dchecks | | dhosts | | drules | | dservices | | escalations | | events | | expressions | | functions | | globalmacro | | globalvars | | graph_discovery | | graph_theme | | graphs | | graphs_items | | group_discovery | | group_prototype | | groups | | history | | history_log | | history_str | | history_text | | history_uint | | host_discovery | | host_inventory | | hostmacro | | hosts | | hosts_groups | | hosts_templates | | housekeeper | | httpstep | | httpstepitem | | httptest | | httptestitem | | icon_map | | icon_mapping | | ids | | p_w_picpaths | | interface | | interface_discovery | | item_application_prototype | | item_condition | | item_discovery | | items | | items_applications | | maintenances | | maintenances_groups | | maintenances_hosts | | maintenances_windows | | mappings | | media | | media_type | | opcommand | | opcommand_grp | | opcommand_hst | | opconditions | | operations | | opgroup | | opinventory | | opmessage | | opmessage_grp | | opmessage_usr | | optemplate | | profiles | | proxy_autoreg_host | | proxy_dhistory | | proxy_history | | regexps | | rights | | screen_user | | screen_usrgrp | | screens | | screens_items | | scripts | | service_alarms | | services | | services_links | | services_times | | sessions | | slides | | slideshow_user | | slideshow_usrgrp | | slideshows | | sysmap_element_url | | sysmap_url | | sysmap_user | | sysmap_usrgrp | | sysmaps | | sysmaps_elements | | sysmaps_link_triggers | | sysmaps_links | | timeperiods | | trends | | trends_uint | | trigger_depends | | trigger_discovery | | triggers | | users | | users_groups | | usrgrp | | valuemaps | +----------------------------+ 113 rows in set (0.01 sec) MysqL>
[root@zabbixserver zabbix-3.0.5]# cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/zabbix_agentd [root@zabbixserver zabbix-3.0.5]# cp misc/init.d/fedora/core/zabbix_server /etc/init.d/zabbix_server [root@zabbixserver zabbix-3.0.5]# [root@zabbixserver zabbix-3.0.5]# sed -i "s#BASEDIR=/usr/local#BASEDIR=/usr/local/zabbix#g" /etc/init.d/zabbix_server [root@zabbixserver zabbix-3.0.5]# sed -i "s#BASEDIR=/usr/local#BASEDIR=/usr/local/zabbix#g" /etc/init.d/zabbix_agentd [root@zabbixserver zabbix-3.0.5]# [root@zabbixserver zabbix-3.0.5]# chmod +x /etc/init.d/zabbix_agentd [root@zabbixserver zabbix-3.0.5]# chmod +x /etc/init.d/zabbix_server [root@zabbixserver zabbix-3.0.5]#
#设置开机启动
[root@zabbixserver zabbix-3.0.5]# chkconfig zabbix_server on [root@zabbixserver zabbix-3.0.5]# chkconfig zabbix_agentd on [root@zabbixserver zabbix-3.0.5]#
[root@zabbixserver zabbix-3.0.5]# mkdir -p /data/web/site/www [root@zabbixserver zabbix-3.0.5]# cp -rfp frontends/PHP/* /data/web/site/www/ -R [root@zabbixserver zabbix-3.0.5]# chown -R root.root /data/web/site/www/ [root@zabbixserver zabbix-3.0.5]# [root@zabbixserver zabbix-3.0.5]# cp /usr/local/Nginx/conf/Nginx.conf /usr/local/Nginx/conf/Nginx.conf.bak [root@zabbixserver zabbix-3.0.5]# vim /usr/local/Nginx/conf/Nginx.conf user root; worker_processes 4; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/Nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root /data/web/site/www; index index.PHP index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 location ~ \.PHP$ { root /data/web/site/www; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.PHP; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; include fastcgi_params; } } } [root@zabbixserver zabbix-3.0.5]# /usr/local/Nginx/sbin/Nginx -t Nginx: the configuration file /usr/local/Nginx/conf/Nginx.conf Syntax is ok Nginx: configuration file /usr/local/Nginx/conf/Nginx.conf test is successful [root@zabbixserver zabbix-3.0.5]# /usr/local/Nginx/sbin/Nginx -s reload [root@zabbixserver zabbix-3.0.5]#
#清除防火墙策略
[root@zabbixserver zabbix-3.0.5]# iptables -F [root@zabbixserver zabbix-3.0.5]# iptables -X [root@zabbixserver zabbix-3.0.5]# iptables -Z [root@zabbixserver zabbix-3.0.5]#
通过浏览器输入http://10.0.0.98进入安装zabbix界面
点击“Next step”
遇到上述错误是因为PHP配置文件/usr/local/PHP/etc/PHP.ini的中的默认参数不能满足zabbix要求,这里我们做如下调整:
post_max_size = 32M max_execution_time = 300 max_input_time = 300 date.timezone = "Asia/Shanghai" always_populate_raw_post_data = -1 [root@zabbixserver etc]# service PHP-fpm restart Gracefully shutting down PHP-fpm . done Starting PHP-fpm done [root@zabbixserver etc]#
然后刷新页面即可,然后下一步
输入密码"zabbix",下一步
输入"127.0.0.1"之后直接下一步
接着下一步
再下一步
按照提示下载zabbix.conf.PHP文件放置于/data/web/site/www/conf目录下即可
[root@zabbixserver etc]# cd /data/web/site/www/conf [root@zabbixserver conf]# rz rz waiting to receive. Starting zmodem transfer. Press Ctrl+C to cancel. 100% 415 bytes 415 bytes/s 00:00:01 0 Errors [root@zabbixserver conf]# ll total 12 -rw-r--r-- 1 root root 1036 Sep 30 05:42 maintenance.inc.PHP -rw-r--r-- 1 root root 415 Jan 10 10:48 zabbix.conf.PHP -rw-r--r-- 1 root root 411 Sep 30 05:42 zabbix.conf.PHP.example [root@zabbixserver conf]#
刷新页面,点击“finish”完成zabbix服务端的安装
编译安装zabbix常用参数
(1)同时安装sever和agent,并支持数据放入MysqL数据库中,可使用类似如下命令
./configure --prefix=/usr/local/zabbix --enable-server --with-MysqL --with-ipv6 --with-net-snmp --with-libcurl --with-ssh3
(2)如果仅安装server,并支持将数据放入MysqL数据中,可使用类似如下配置命令:
./configure --prefix=/usr/local/zabbix --enable-server --with-MysqL --with-net-snmp --with-libcurl
(3)如果仅仅安装proxy。并支持将数据放入MysqL数据库中,可使用类似如下命令
./configure --prefix=/usr/local/zabbix --enable-proxy --with-MysqL --with-net-snmp --with-MysqL --with-ssh3
create database zabbix_proxy;
grant all on zabbix_proxy.* to 'zabbix'@'localhost' identified by 'zabbix';
flush privileges;
MysqL -hhostname -uuser -ppassword zabbix_proxy < /root/tools/zabbix-3.0.5/database/MysqL/schema.sql #proxy端只需要导入这个文件
Server=IP #zabbix服务端IP
Hostname=zabbix_proxy #必须和WEB页面添加代理时设置的名称一致
LogFile=/var/log/zabbix/zabbix_proxy.log
DBHost=localhost #数据库IP
DBPassword=zabbix #数据库密码
(4)如果仅安装agent,可使用类似如下配置命令
./configure --prefix=/usr/local/zabbix --enable-agent
注意:在安装PHP时会出现一些错误,下面是一些常见错误解决方法
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
解决办法
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz
#解压
tar -zxvf libmcrypt-2.5.7.tar.gz
#进入目录
cd libmcrypt-2.5.7
#编译(默认安装到/usr/local/lib/)
./configure --prefix=/usr/local/libmcrypt
#执行安装
make && make install
configure: error: Don't kNow how to define struct flock on this system, set --enable-opcache=no
解决方法一:
查看PHP官方文档解决. 在configure 里面加上 --with-libdir=lib64
解决方法二:
编辑/etc/ld.so.conf
根据系统,加入include /etc/ld.so.conf,
然后执行ldconfig,使其重新加载一次;(如果出错改为vi /etc/ld.so.conf >> include /usr/local/libmcrytp/lib/)
configure: error: Don't kNow how to define struct flock on this system, set --enable-opcache=no
解决方法是:
echo /usr/local/MysqL/lib >> /etc/ld.so.conf.d/MysqL-x86_64.conf
ldconfig -v
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。