Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for HOW TO MAKE A RPM PACKAGE
Lucas Puntillo
Lucas Puntillo

Posted on • Originally published atlucaspuntillo.blogspot.com

     

HOW TO MAKE A RPM PACKAGE

How to make a RPM package

RPM is a versatile Linux packaging originally meant for Red Hat Linux (now RHEL) but now ported to Fedora Linux, Clear linux, and many more distro's. In my opinion, it is more cleaner and refined than the .deb format, DPKG, and APT, (used by Debian Linux and it's derivatives.)

NOTE: The package was made on a CentOS 7 Virtual machine and was tested on a Fedora Linux 33 virtual machine.

Step one, dependencies:

yum install rpm-build rpm-devel rpmlint make diffutils patch rpmdevtools
Enter fullscreen modeExit fullscreen mode

Step two, setup build directory

mkdir $HOME/rpmmaker
Enter fullscreen modeExit fullscreen mode

Step three, create a specifications file:

Name:       testVersion:    1Release:    1Summary:    a test RPM packageLicense:    None%descriptionThis is my first RPM package, which does nothing.%prep# We have nothing to prepare.%buildcat > hello-world <<EOF#!/bin/shecho Hello worldEOF%installmkdir -p %{buildroot}/usr/bin/install -m 755 hello-world %{buildroot}/usr/bin/hello-world%files/usr/bin/hello-world%changelog#This is version 1.0!
Enter fullscreen modeExit fullscreen mode

Save it as helloworld.spec in the rpmmaker directory

Step four, make the rpm:

cd $HOME/rpmmakerrpmdev-setuptreerpmbuild -ba helloworld.spec
Enter fullscreen modeExit fullscreen mode

The directory/home/YourName/rpmbuild/RPMS/x86_64/ should hold your RPM file.

Step 5, testing the file:

cd into the directory where the rpm is

sudo rpm -i filename.rpmhello-world
Enter fullscreen modeExit fullscreen mode

If it says "Hello World!" then the file works.

The RPM is now ready to be shared.

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

AOSP Contributor, Ubuntu Contributor, Open Source engineer
  • Location
    Mississauga, Canada
  • Joined

Trending onDEV CommunityHot

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp