目录

使用FPM制作ARM平台ZabbixAgent RPM包

安装fpm/rpm-build

1
2
3
4
5
6
https://gems.ruby-china.com/
gem sources --remove http://rubygems.org/
gem sources --add https://gems.ruby-china.com/
gem sources -l
gem install fpm
yum install -y rpm-build

制作RPM包

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
yum install -y rpm-build
tar zxf zabbix-4.2.8.tar.gz
cd zabbix-4.2.8
vi misc/init.d/tru64/zabbix_agentd
变更1:在#!/bin/sh下面添加两行
    #chkconfig: 345 95 95
    #description: Zabbix_Agent
变更2:修改启动位置
将DAEMON=/usr/local/sbin/zabbix_agentd改为DAEMON=/usr/local/zabbix-agent/sbin/zabbix_agentd
./configure --prefix=/usr/local/zabbix-agent --enable-agent
make
make install
cp misc/init.d/tru64/zabbix_agentd /usr/local/zabbix-agent/zabbix-agent

vi /home/mds/after-install.sh
#!/bin/bash
source /etc/rc.d/init.d/functions
groupadd zabbix
useradd -M -g zabbix zabbix -s /sbin/nologin
mv /usr/local/zabbix-agent/zabbix-agent /etc/init.d/
chmod +x /etc/init.d/zabbix-agent
mkdir -p /var/log/zabbix
chmod -R 755 /var/log/zabbix/
chown -R zabbix. /var/log/zabbix/
chmod -R 755 /usr/local/zabbix-agent/
chown -R zabbix. /usr/local/zabbix-agent/
chkconfig --add zabbix-agent

exit $?


vi /home/mds/after-remove.sh
#!/bin/bash
source /etc/rc.d/init.d/functions
rm -rf /usr/local/zabbix-agent/
rm -f /etc/init.d/zabbix-agent
userdel zabbix
exit $?

fpm -s dir -t rpm --vendor CentOS7.7 -n zabbix-agent -v 4.2.8 -d 'pcre,pcre-devel' -C /usr/local/zabbix-agent/ --prefix /usr/local/zabbix-agent/ --after-install /home/mds/after-install.sh --after-remove /home/mds/after-remove.sh