Simple RPM package Creation

Source: Internet
Author: User
Tags rpmbuild

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.