T
T
TechNOIR2020-01-23 11:07:06
Red Hat Enterprise Linux
TechNOIR, 2020-01-23 11:07:06

How to properly build RPM from source?

Hello!
Can you please tell me how to properly build an RPM package from source?
What you need: Build your own rpm package from the Zabbix agent sources.
I created an rpmbuild folder structure and wrote a SPEC file like this:

%define name     zabbix_agentd
%define version  4.4.4
%define packager Zabbix
%define source   zabbix-4.4.4.tar.gz

Name:           %{name}
Version:        %{version}
Release:        1
Summary:        Zabbix Agent 4.4.4

Group:          Applications/Internet
License:        GPL
Source0:        %{source}
Packager:       %{packager}

%description
Zabbix agent 4.4.4

%prep
%setup -n zabbix-%{version}

%build
./configure --enable-agent

%install
make install
cp ./misc/init.d/fedora/core5/zabbix_agentd /etc/init.d/
chkconfig zabbix_agentd on

%clean
rm -rf %{buildroot}

%pre
groupadd --system zabbix
useradd --system -g zabbix -d /usr/lib/zabbix -s /sbin/nologin -c "Zabbix Monitoring System" zabbix

Please take a look with an experienced look, who has already done rpm.
What are the comments? Thanks in advance
PS The scheme for installing Zabbix agent from the sources is as follows:
1. Unpack the archive
2. Create a group and user zabbix
3. ./configure --enable-agent
4. make install
5. cp ./misc/init.d/fedora/ core5/zabbix_agentd /etc/init.d/
6. chkconfig zabbix_agentd on

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
CityCat4, 2020-01-23
@CityCat4

If the packages from the official Zabbix turnip are not satisfied with something, then at least you can take a spec from there to see how it is made there. In general, specs are rarely written from scratch - unless it's something rare, usually you can find it somewhere.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question