源码编译后,打成RPM包,方便后续管理。
= zabbix_server =
安装目录: /root/zabbix_server
提前安装:
yum install libxml2 libxml2-devel net-snmp-devel curl curl-devel php php-bcmath php-mbstring php-gd php-mysql
编译参数:
./configure --enable-server --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --prefix=/root/zabbix_server
其他安装步骤见官方文档
= zabbix_agentd =
安装目录: /root/zabbix_agentd
使用RPM包管理的优势:
1. 便于安装及升级
2. 安装目录规范统一
3. RPM中将zabbix_agentd放入系统的service中进行管理
zabbix_agentd.spec
-
%define _topdir
-
%define debug_package %{nil}
-
%define zabbix_home /root/zabbix_agentd
-
%define %{_initrddir} /etc/init.d
-
-
Summary: RPM for zabbix agentd
-
Name: zabbix_agentd
-
Version: 2.4.5
-
Release: 1
-
Vendor: zabbix
-
License: GPL
-
Group: Applications/Internet
-
BuildRoot: %{_builddir}/%{name}
-
Packager: guofzhao
-
Source0: %{name}-%{version}.tar.gz
-
Source1: zabbix_agentd.init
-
Requires(post): /sbin/chkconfig
-
Requires(preun): /sbin/chkconfig
-
Requires(preun): /sbin/service
-
%description
-
Zabbix agentd
-
-
%prep
-
rm -rf ${buildroot}
-
%setup -c
-
-
-
%install
-
mkdir -p %{buildroot}%{zabbix_home}
-
mkdir -p %{buildroot}%{_initrddir}
-
cp -r %{name}-%{version}/* %{buildroot}%{zabbix_home}
-
%{__install} -D -p -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/%{name}
-
-
%clean
-
rm -rf %{buildroot}
-
-
%post
-
grep -q %{name} /etc/services || cat >> /etc/services <<EOF
-
zabbix_agentd 10050/tcp #Zabbix Agent
-
zabbix_agentd 10050/udp #Zabbix Agent
-
EOF
-
# Add zabbix-agent to system start-up
-
/sbin/chkconfig --add %{name}
-
/sbin/chkconfig %{name} on
-
-
%preun
-
# Stop and disable service before removal
-
/sbin/service %{name} stop >/dev/null 2>&1 || :
-
/sbin/chkconfig --del %{name}
-
sed -i "/%{name}/d" /etc/services
-
-
%files
-
%{zabbix_home}
-
%attr(755,root,root) %{_initrddir}/%{name}
zabbix_agentd.init
阅读(1375) | 评论(0) | 转发(0) |