install the rpm building tools

install the rpm-build package as root

[root@r02edge WEB-INF]# yum install rpm-build

switch to a non root user id and create a package directory tree:

[dataexplorer1@r02edge ~] mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}

[dataexplorer1@r02edge ~]$ echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros


create specification file

cd SPECS and create a cbaWorkflow.spec file with the following content:

Name:cbaWorkflow
Version:1.0.0
Release:1
Summary:workflow application for data pipelines
Group:Applications
License:pay please
Packager:Boris Alexandrov, Custom Built Apps ltd
URL:www.custom-built-apps.com
AutoReqProv: no
BuildRoot: ~/rpmbuild/

%description
The application runs execution nodes like spark-sql, spark-submit, shell, hdfs commands in orchestration and cadence.
%prep
echo "BUILDROOT=$RPM_BUILD_ROOT"
mkdir -p $RPM_BUILD_ROOT/app/cbaWorkflow/{bin,lib,etc,wars}
cp /home/dataexplorer1/cbaWorkflow/bin/* $RPM_BUILD_ROOT/app/cbaWorkflow/bin
cp /home/dataexplorer1/cbaWorkflow/lib/* $RPM_BUILD_ROOT/app/cbaWorkflow/lib
cp /home/dataexplorer1/cbaWorkflow/etc/* $RPM_BUILD_ROOT/app/cbaWorkflow/etc
cp /home/dataexplorer1/cbaWorkflow/wars/* $RPM_BUILD_ROOT/app/cbaWorkflow/wars

exit

%files
%attr(0755,root,root)/app/cbaWorkflow/bin/*
%attr(0755,root,root)/app/cbaWorkflow/lib/*
%attr(0666,root,root)/app/cbaWorkflow/etc/*
%attr(0755,root,root)/app/cbaWorkflow/wars/*

%clean
rm -rf $RPM_BUILD_ROOT/app/cbaWorkflow


build the package

inside the SPECS directory:

rpmbuild -bb cbaWorkflow.spec

verify the package is available in RPMS directory

cd /home/dataexplorer1/rpmbuild/RPMS/x86_64

ls -l 

-rw-r--r--. 1 dataexplorer1 hadoop 1562560 Mar 27 09:33 cbaWorkflow-1.0.0-1.x86_64.rpm


install package as root

su -

cd /home/dataexplorer1/rpmbuild/RPMS/x86_64

rpm -ivh cbaWorkflow-1.0.0-1.x86_64.rpm
Preparing... ################################# [100%]
Updating / installing...
1:cbaWorkflow-1.0.0-1 ################################# [100%]


another option is to use yum:

yum install local cbaWorkflow-1.0.0-1.x86_64.rpm

Install 1 Package

Total size: 8.9 M
Installed size: 8.9 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : cbaWorkflow-1.0.0-1.x86_64 1/1
Verifying : cbaWorkflow-1.0.0-1.x86_64 1/1

Installed:
cbaWorkflow.x86_64 0:1.0.0-1

Complete!

verify installation

rpm -qa cbaWorkflow
cbaWorkflow-1.0.0-1.x86_64


[root@r02edge x86_64]# rpm -qi cbaWorkflow
Name : cbaWorkflow
Version : 1.0.0
Release : 1
Architecture: x86_64
Install Date: Sat 27 Mar 2021 09:33:49 AM EDT
Group : Applications
Size : 9310764
License : pay please
Signature : (none)
Source RPM : cbaWorkflow-1.0.0-1.src.rpm
Build Date : Sat 27 Mar 2021 09:33:04 AM EDT
Build Host : r02edge.custom-built-apps.com
Relocations : (not relocatable)
Packager : Boris Alexandrov, Custom Built Apps ltd
URL : www.custom-built-apps.com
Summary : workflow application for data pipelines
Description :
The application runs execution nodes like spark-sql, spark-submit, shell, hdfs commands in orchestration and cadence.

[root@r02edge x86_64]# rpm -q --changelog cbaWorkflow
* Sat Mar 27 2021 Boris Alexandrov boris.alexandrov@custom-built-apps.com
-The original package includes a repository builder, cbaWorkflow , cbaWFMonitor,
Repository connector for PostrgreSQL
war for deployment into tomcat in the wars directory

upload the rpm to Nexus:

rpm can be uploaded to Nexus using REST API or Maven.

there also is a direct upload way:

upload_to_nexus.sh

#!/bin/sh
VER=1.0.0
REL=1
RPM=$1
curl -v -u admin:ThePaSsWd --upload-file ${RPM} http://192.168.2.22:8081/repository/cbayum_hosted/cbaWorkflow/${VER}/${REL}/${RPM}


./upload_to_nexus.sh cbaWorkflow-1.0.0-1.x86_64.rpm

[dataexplorer1@r02edge rpms]$ ./upload_to_nexus.sh cbaWorkflow-1.0.0-1.x86_64.rpm
* About to connect() to 192.168.2.22 port 8081 (#0)
* Trying 192.168.2.22...
* Connected to 192.168.2.22 (192.168.2.22) port 8081 (#0)
* Server auth using Basic with user 'admin'
> PUT /repository/cbayum_hosted/cbaWorkflow/1.0.0/1/cbaWorkflow-1.0.0-1.x86_64.rpm HTTP/1.1
> Authorization: Basic YWRtaW46YkExMjYyNDEyMCE=
> User-Agent: curl/7.29.0
> Host: 192.168.2.22:8081
> Accept: */*
> Content-Length: 1569928
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
* We are completely uploaded and fine
< HTTP/1.1 201 Created
< Date: Sun, 28 Mar 2021 12:12:00 GMT
< Server: Nexus/3.19.1-01 (OSS)
< X-Content-Type-Options: nosniff
< Content-Security-Policy: sandbox allow-forms allow-modals allow-popups allow-presentation allow-scripts allow-top-navigation
< X-XSS-Protection: 1; mode=block
< Content-Length: 0
<
* Connection #0 to host 192.168.2.22 left intact


verify in Nexus:


update yum configuration for the cbaWorkflow repo


vi /etc/yum.repos.d/nexus.repo
[nexusrepocbaWorkflow]
name=Nexus Repository
baseurl=http://192.168.2.22:8081/repository/cbayum-hosted/cbaWorkflow
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
repo_gpgcheck=0
priority=1


now the installation can go like :

yum install cbaWorkflow

Package              Arch         Version        Repository                            Size
===============================================
Installing:
cbaWorkflow     x86_64        1.0.1-1        nexusrepocbaWorkflow       1.3 M

Transaction Summary
===============================================
Install 1 Package

Total size: 1.3 M
Installed size: 7.8 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : cbaWorkflow-1.0.1-1.x86_64 1/1
Verifying : cbaWorkflow-1.0.1-1.x86_64 1/1

Installed:
cbaWorkflow.x86_64 0:1.0.1-1

Complete!


Attachments: