centos 6.5 编译安装zabbix3.2

前端之家收集整理的这篇文章主要介绍了centos 6.5 编译安装zabbix3.2前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

centos 6.5 编译安装zabbix3.2


注意zabbix需要 MysqL、http、PHP为基础环境


1.安装MysqL5.7.17


1).解压:


tar xvf MysqL-5.7.17-1.el6.x86_64.rpm-bundle.tar



2).移除已经安装的早期版本

如果不移除的话,会提示有冲突,版本可能有所不同


查看是否安装早期的版本,若有将其卸载


rpm -qa | grep MysqL

yum -y remove MysqL-libs-*


3).安装rpm包,注意安装顺序

rpm -ivh MysqL-community-common-5.7.17-1.el6.x86_64.rpm

rpm -ivh MysqL-community-libs-5.7.17-1.el6.x86_64.rpm

rpm -ivh MysqL-community-client-5.7.17-1.el6.x86_64.rpm

rpm -ivh MysqL-community-server-5.7.17-1.el6.x86_64.rpm

rpm -ivh MysqL-community-devel-5.7.17-1.el6.x86_64.rpm


4).启动MysqL服务


[root@localhost ~]# service MysqLd start

Initializing MysqL database: [ OK ]

Installing validate password plugin: [ OK ]

Starting MysqLd: [ OK ]


5).修改管理员密码

查看初始管理员密码:


grep 'temporary password' /var/log/MysqLd.log


MysqL -uroot -p 登录数据库


修改密码,密码必须包含大写字母小写字母数字和符号


MysqL> alter user 'root'@'localhost' identified by 'Report@123';

Query OK,0 rows affected (0.05 sec)


MysqL> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Report@123' WITH GRANT OPTION; 为 root用户授予所有权限


MysqL> FLUSH PRIVILEGES;


2.安装httpd-2.4.23


1).检查是否安装httpd,若安装将其卸载,避免冲突


rpm -q httpd

rpm -e httpd --nodeps


2)安装依赖环境


yum -y install gcc gcc-c++


3)安装http的依赖包


1>安装apr


tar zxvf apr-1.5.2.tar.gz


cd apr-1.5.2


./configure --prefix=/usr/local/apr


make && make install


2>安装apr-util


tar zxvf apr-util-1.5.4.tar.gz


cd apr-util-1.5.4


./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr


make && make install


3>安装pcre


tar zxvf pcre-8.38.tar.gz


cd pcre-8.38


./configure --prefix=/usr/local/pcre


make && make install



4)安装httpd-2.4.23


1>安装


tar zxvf httpd-2.4.23.tar.gz -C /usr/local/


cd /usr/local/httpd-2.4.23/


./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-charset-lite --enable-cgi --with-pcre=/usr/local/pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util


make && make install


2>优化执行路径


ln -s /usr/local/httpd/bin/* /usr/local/bin/


3>优化添加系统服务,并设为开机自启


cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd


chmod +x /etc/init.d/httpd


vim /etc/init.d/httpd 添加如下两行


#chkconfig: 2345 85 21

#description: Startup script for the Apache HTTP Server


chkconfig --add httpd


chkconfig httpd on


chkconfig --list httpd


4>配置http并启动


vim /usr/local/httpd/conf/httpd.conf 修改如下:


#ServerName www.example.com:80


ServerName www.example.com


httpd -t


service httpd start

3.安装PHP7


1)安装依赖环境


yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel pcre-devel curl curl-devel libxslt-devel libmcrypt-devel gd-devel openssl openssl-devel openldap openldap-devel


2)添加用户、同步时间


useradd -M -s /sbin/noloin PHP


ntpdate 202.112.10.36

3)安装依赖环境


tar zxvf libmcrypt-2.5.8.tar.gz

cd libmcrypt-2.5.8

./configure && make && make install


4)编译安装PHP


tar zxvf PHP-7.0.14.tar.gz


cd PHP-7.0.14.tar.gz


cp -frp /usr/lib64/libldap* /usr/lib/

./configure --prefix=/usr/local/PHP7 --enable-fpm --enable-opcache --with-config-file-path=/usr/local/PHP7/etc --enable-MysqLnd --with-MysqL-sock=/var/lib/MysqL/MysqL.sock --with-MysqLi=MysqLnd --with-pdo-MysqL=MysqLnd --enable-static --enable-sockets --enable-wddx --enable-zip --enable-calendar --enable-bcmath --enable-soap --with-zlib --with-iconv --with-freetype-dir --with-gd --with-jpeg-dir --with-xmlrpc --enable-mbstring --with-sqlite3 --with-curl --enable-ftp --with-mcrypt --with-openssl --with-gettext --with-ldap


make && make install


5)创建PHPPHP-fpm配置

cp PHP-7.0.14/PHP.ini-production /usr/local/PHP7/etc/PHP.ini


cp /usr/local/PHP7/etc/PHP-fpm.d/www.conf.default usr/local/PHP7/etc/PHP-fpm.conf



6)修改PHP-FPM的配置文件,将用户改为自己创建的用户


vim usr/local/PHP/etc/PHP-fpm.conf


#23 user = PHP

#24 group = PHP


7)配置PHP-fpm开机自启动脚本


cp /root/PHP-7.0.14/sapi/fpm/init.d.PHP-fpm /etc/init.d/PHP-fpm

chmod +x /etc/init.d/PHP-fpm


chkconfig --add PHP-fpm


chkconfig PHP-fpm on


8)创建链接文件,查看版本以及启动情况


ln -s /usr/local/PHP7/sbin/PHP-fpm /usr/local/sbin/


ln -s /usr/local/PHP7/bin/* /usr/local/bin/


PHP -v


PHP-fpm -t


9)修改相应的PHP配置文件


vim /usr/local/PHP7/etc/PHP.ini


#368 max_execution_time = 300


#378 max_input_time = 300


#656 post_max_size = 16M


#924 date.timezone ="Asia/Shanghai"


10)重启使配置文件生效


/etc/init.d/PHP-fpm restart


11)配置httpd支持解析PHP

vim /usr/local/httpd/conf/httpd.conf


#155 LoadModule PHP7_module modules/libPHP7.so 配置http通过PHP解析PHP语言(默认有)


#385 AddType application/x-httpd-PHP .PHP 需要自己添加


#256 DirectoryIndex index.PHP index.html 注意修改


12)重启httpd ,并且创建测试页进行访问


/etc/init.d/httpd restart


vim /usr/local/httpd/htdocs/test.PHP

<?PHP

PHPinfo();

?>


浏览器访问测试页:http://ip/test.PHP 能看到PHP的相关信息


4.安装zabbix3.2


1)查看基础环境是否安装


netstat -anplt | grep LISTEN


MysqLd -V


httpd -v


PHP -v


2)安装依赖环境


yum -y install curl curl-devel net-snmp net-snmp-devel perl-DBI


注意安装jdk依赖环境


3)创建用户


useradd -M -s /sbin/nologin zabbix


find / -name MysqL_config 找到MysqL_config的路径


4)安装


tar zxvf zabbix-3.2.7.tar.gz


cd zabbix-3.2.7


./configure --with-MysqL=/usr/local/MysqL/bin/MysqL_config --with-net-snmp --with-libcurl --enable-server --enable-agent --enable-proxy --prefix=/usr/local/zabbix --enable-java


make && make install


5)创建zabbix数据库


MysqL -u root -pReport@123 登录


MysqL> create database zabbix character set utf8;


MysqL> grant all privileges on zabbix.* to zabbix@localhost identified by 'Zabbix@123';

MysqL> grant all privileges on zabbix.* to zabbix@'%' identified by 'zabbix';

MysqL> flush privileges;


MysqL> exit


MysqL> use zabbix #进入数据库


MysqL> select database();#查看当前数据


6)数据按顺序导入zabbix数据库


MysqL -u root -pReport@123 zabbix < /root/zabbix-3.2.7/database/MysqL/schema.sql


MysqL -u root -pReport@123 zabbix < /root/zabbix-3.2.7/database/MysqL/images.sql


MysqL -u root -pReport@123 zabbix < /root/zabbix-3.2.7/database/MysqL/data.sql


7)创建连接文件


ln -s /usr/local/zabbix//etc/ /etc/zabbix


ln -s /usr/local/zabbix/bin/* /usr/bin/


ln -s /usr/local/zabbix/sbin/* /usr/sbin/


8)创建自启动脚本


cp zabbix-3.0.4/misc/init.d/fedora/core/zabbix_* /etc/init.d/


chmod 755 /etc/init.d/zabbix_*


vim /etc/init.d/zabbix_agentd

将BASEDIR=/usr/local 改为 BASEDIR=/usr/local/zabbix

vim /etc/init.d/zabbix_server

将BASEDIR=/usr/local 改为 BASEDIR=/usr/local/zabbix


chkconfig zabbix_server on


chkconfig zabbix_agentd on


9)修该配置文件


vim /etc/zabbix/zabbix_server.conf


DBPassword=Zabbix@123 #数据库密码


vim /etc/zabbix/zabbix_agentd.conf


#91 Server=192.168.31.53


#132 ServerActive=192.168.31.53


#279 UnsafeUserParameters=1


10)配置web站点


cp -rf zabbix-3.2.7/frontends/PHP/ /usr/local/httpd/htdocs/zabbix


11)启动zabbix服务


/etc/init.d/zabbix_server start


/etc/init.d/zabbix_agentd start


注意zabbix_server zabbix_agentd 端口都要启动监听


12)在客户端以http方式访问


http://192.168.31.53/zabbix 用户名:admin 密码:zabbix


注意一步步进行不能有报错


最后需要下载zabbix.conf.PHP文件,并把它放到zabbix服务器的/usr/local/httpd/htdocs/zabbix目录下,注意按提示进行



此时部署完成

原文链接:https://www.f2er.com/centos/376474.html

猜你在找的CentOS相关文章