Simple RPM package Creation
Today, in order to test and build your own yum repository and install the upgrade software package, you need an rpm package for testing, so you think of yourself as the simplest rpm, because it is just a test, no file to be compiled is added, but only a shell file is used to output the cute Hello World.
$ Sudo yum install-y rpm-build rpmdevtools
$ Rpmdev-setuptreerpmdev-setuptree command by default, a new RPM is created under the root directory of the current user to build the root directory structure ~ /Rpmbuild/
Mkdir-p ~ // Rpmbuild/SOURCES/helloworld-1.0.0 touch ~ /Rpmbuild/SOURCES/helloworld-1.0.0/helloworld chmod 755 ~ /Rpmbuild/SOURCES/helloworld-1.0.0/helloworld echo "#! /Bin/sh ">> ~ /Rpmbuild/SOURCES/helloworld-1.0.0/helloworld echo "echo Hello World! ">> ~ /Rpmbuild/SOURCES/helloworld-1.0.0/helloworld cd ~ /Rpmbuild/SOURCES; tar zcvf helloworld-1.0.0.tar.gz helloworld-1.0.0
$ Rpmdev-newspec helloworld. spec
Name: helloworld Version: 1.0.0 Release: 1% {? Dist} Summary: helloworld Group: Development/Tools License: GPL # URL: Source0: registry.name=-registry.version=.tar.gz # BuildRequires: # Requires: % description % prep % setup-q % build mkdir-p $ RPM_BUILD_ROOT/usr/bin cp $ RPM_BUILD_DIR/% {name}-% {version}/helloworld $ RPM_BUILD_ROOT/usr/bin /% install % clean rm-rf $ RPM_BUILD_ROOT % files % defattr (-, root, root,-) % doc/usr/bin/helloworld % changelog
Rpmbuild-ba SPECS/helloworld. spec
Sudo yum install ~ // Rpmbuild/RPMS/x86_64/helloworld-1.0.0-1.el6.x86_64.rpm
Release: 2% {? Dist} Then run "rpmbuild-ba SPECS/helloworld. spec" to package
Sudo yum update ~ // Rpmbuild/RPMS/x86_64/helloworld-1.0.0-2.el6.x86_64.rpm