purpose

Modified Spark source code. After compiling it into a JAR package, replace the JAR in the original RPM package and repackage it into an RPM package for installation.

steps

  1. Install rPMBuild, rpmrebuild, and rPMDevTools
yum install -y rpm-build
yum install -y rpmrebuild
yum install -y rpmdevtools
Copy the code
  1. Run rpmdev – the setuptree generated working directory, use the rpmbuild – showrc | grep topdir to check the working directory. If you are the root user, the generated folder is in/root/rpmbuildUnder. CD /root/rpmbuild;mkdir BUILDROOT
  2. You can also use mkdir -p to manually generate these directories:
mkdir -p /root/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
Copy the code
  1. Extract the spec file:
rpmrebuild -p -n -sSpark2. Spec spark2_3_0_1_0_187-2.3.1.3.0.1.0-187. Noarch. RPMCopy the code
  1. The generatedspark2.specCopy to the SPECS directory.
  2. Decompress spark2_3_0_1_0_187-2.3.1.3.0.1-187.noarch. RPM to rpmBuild /BUILDROOT:
Rpm2cpio spark2_3_0_1_0_187 2.3.1.3.0.1.0-187. Noarch. RPM | cpio - idvCopy the code
  1. You may need to create the Spark2_3_0_1_0_187-2.3.1.3.0.0.0-187 directory and move the contents extracted from the previous step to this directory.
  2. Copy the jar package you compiled into the decompressed code to the corresponding location (delete the original jar package with the same name!).
  3. Copy the extracted spec files into RPM packages:
cd ~/rpmbuild/
rpmbuild -ba SPECS/spark2.spec
Copy the code
  1. The newly generated xxx.rpm package is stored in /root/rpmbuild/RPMS (when the root user is used).
  2. This RPM package is ready to install and use:
rpm -ivh /root/rpmbuild/RPMS/xxx.rpm
Copy the code

note

You can also extract the spec file using the following command:

Rpmrebuild - package - notest-install - spec-only your.spec XXXX.rpmCopy the code