SlideShare a Scribd company logo
Creating RPM package in Linux
This exercise was done on RHEL 6 and same steps are applicable for other variants too. This tutorial provides you with
steps to create your own RPM packages in Linux. Following procedure shows creating a basic RPM package that
includes a shell script. After the RPM is installed, the script is executed on the command prompt to display the output.
Step 1 – Install necessary RPM dependencies
[student@desktop3 ~]$yum install rpm-build–y
Step 2 – Setup your package in a directory
[student@desktop3 ~]$mkdir myrpm-1.0
[student@desktop3 ~]$cd myrpm-1.0
(Create a simple script which executes after installing the rpm)
[student@desktop3 ~]$ vi myrpm.sh
#!/bin/bash
#
echo 'Hello There ! This is my RPM script...'
exit 0
(Make the script executable)
[student@desktop3 ~]$ chmod a+x myrpm.sh
Step 3 – Create a tar file of your package
[student@desktop3 ~]$ mkdir -p ~/rpmbuild/SOURCES
[student@desktop3 ~]$ mkdir -p ~/rpmbuild/SPECS
[student@desktop3 ~]$ tar -zcvf ~/rpmbuild/SOURCES/myrpm-1.0-1.tar.gz myrpm-1.0/
Step 4 – Create and edit SPEC file
[student@desktop3 ~]$ vi ~/rpmbuild/SPECS/myrpm.spec
Name: myrpm
Version: 1.0
Release: 1
Summary: MyRPM
Group: RHCE
License: GPL
URL: http://www.redhat.com
Source0: %{name}-%{version}-%{release}.tar.gz
BuildRoot: /var/tmp/%{name}-buildroot
%description
Installs /root/bin/myrpm.sh
%prep
%setup -q -n %{name}-%{version}
%build
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/root/bin
install -m 755 myrpm.sh $RPM_BUILD_ROOT/root/bin/myrpm.sh
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
/root/bin/myrpm.sh
%changelog
Step 5 – Execute rpmbuild to build the RPM package
[student@desktop3 ~]$rpmbuild -ba rpmbuild/SPECS/myrpm.spec
Step 6 – Install and Run the RPM package
[root@desktop3 ~]# rpm -ivh /home/student/rpmbuild/RPMS/x86_64/myrpm-1.0-1.x86_64.rpm
Preparing... ########################################### [100%]
1:myrpm ########################################### [100%]
[root@desktop3 ~]# ll /root/bin/myrpm.sh
-rwxr-xr-x. 1 root root 131 Jun 29 17:19 /root/bin/myrpm.sh
[root@desktop3 ~]# myrpm.sh
Hello There ! This is my RPM script...
Document Version 1
Date : 29th
June 2012
Author : Manish Chopra

More Related Content

Viewers also liked

GSMA 2017 | 200 Plus Slides
GSMA 2017 |  200 Plus SlidesGSMA 2017 |  200 Plus Slides
GSMA 2017 | 200 Plus Slides
Zohar Urian
 

Viewers also liked (10)

dr. Brigita Serafinavičiūtė (VU) Atviras mokslas: nauja mada ar būtinybė?
dr. Brigita Serafinavičiūtė (VU) Atviras mokslas: nauja mada ar būtinybė?dr. Brigita Serafinavičiūtė (VU) Atviras mokslas: nauja mada ar būtinybė?
dr. Brigita Serafinavičiūtė (VU) Atviras mokslas: nauja mada ar būtinybė?
 
The Anatomy of GOOGLE Search Engine
The Anatomy of GOOGLE Search EngineThe Anatomy of GOOGLE Search Engine
The Anatomy of GOOGLE Search Engine
 
Tadas Juknevičius (MOSTA) Doktorantūros horizontai Lietuvos mokslo politikoje
Tadas Juknevičius (MOSTA) Doktorantūros horizontai Lietuvos mokslo politikojeTadas Juknevičius (MOSTA) Doktorantūros horizontai Lietuvos mokslo politikoje
Tadas Juknevičius (MOSTA) Doktorantūros horizontai Lietuvos mokslo politikoje
 
Lietuvos doktorantūra iššūkiai ir galimybės
Lietuvos doktorantūra iššūkiai ir galimybėsLietuvos doktorantūra iššūkiai ir galimybės
Lietuvos doktorantūra iššūkiai ir galimybės
 
Congenital vertical talus BY DR.NAVEEN RATHOR
Congenital vertical talus BY DR.NAVEEN RATHORCongenital vertical talus BY DR.NAVEEN RATHOR
Congenital vertical talus BY DR.NAVEEN RATHOR
 
GSMA 2017 | 200 Plus Slides
GSMA 2017 |  200 Plus SlidesGSMA 2017 |  200 Plus Slides
GSMA 2017 | 200 Plus Slides
 
7 Trends & Insights MWC 2017
7 Trends & Insights MWC 20177 Trends & Insights MWC 2017
7 Trends & Insights MWC 2017
 
MAROC EN AFRIQUE ; LES MODES D’ENTRÉE DES ENTREPRISES MAROCAINES SUR LE MARCH...
MAROC EN AFRIQUE ; LES MODES D’ENTRÉE DES ENTREPRISES MAROCAINES SUR LE MARCH...MAROC EN AFRIQUE ; LES MODES D’ENTRÉE DES ENTREPRISES MAROCAINES SUR LE MARCH...
MAROC EN AFRIQUE ; LES MODES D’ENTRÉE DES ENTREPRISES MAROCAINES SUR LE MARCH...
 
Women day splash answers
Women day splash answersWomen day splash answers
Women day splash answers
 
Féminisme et égalité des sexes
Féminisme et égalité des sexesFéminisme et égalité des sexes
Féminisme et égalité des sexes
 

Similar to Steps to create an RPM package in Linux

Software management in linux
Software management in linuxSoftware management in linux
Software management in linux
nejadmand
 
101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package management101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package management
Acácio Oliveira
 
Dockerizing Symfony Applications - Symfony Live Berlin 2014
Dockerizing Symfony Applications - Symfony Live Berlin 2014Dockerizing Symfony Applications - Symfony Live Berlin 2014
Dockerizing Symfony Applications - Symfony Live Berlin 2014
D
 
InstallingRoRinLinux
InstallingRoRinLinuxInstallingRoRinLinux
InstallingRoRinLinux
tutorialsruby
 
InstallingRoRinLinux
InstallingRoRinLinuxInstallingRoRinLinux
InstallingRoRinLinux
tutorialsruby
 

Similar to Steps to create an RPM package in Linux (20)

Software management in linux
Software management in linuxSoftware management in linux
Software management in linux
 
Unix Administration 2
Unix Administration 2Unix Administration 2
Unix Administration 2
 
101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package management101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package management
 
OSDC 2013 | Software Packaging with RPM Demystified by Andrew Ford
OSDC 2013 | Software Packaging with RPM Demystified by Andrew FordOSDC 2013 | Software Packaging with RPM Demystified by Andrew Ford
OSDC 2013 | Software Packaging with RPM Demystified by Andrew Ford
 
OpenWRT guide and memo
OpenWRT guide and memoOpenWRT guide and memo
OpenWRT guide and memo
 
Linux for programmers
Linux for programmersLinux for programmers
Linux for programmers
 
Bundling Packages and Deploying Applications with RPM
Bundling Packages and Deploying Applications with RPMBundling Packages and Deploying Applications with RPM
Bundling Packages and Deploying Applications with RPM
 
How to run_moses 2
How to run_moses 2How to run_moses 2
How to run_moses 2
 
Linux Presentation
Linux PresentationLinux Presentation
Linux Presentation
 
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
 
A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...
A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...
A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...
 
Adding System Call to Kernel
Adding System Call to KernelAdding System Call to Kernel
Adding System Call to Kernel
 
Dockerizing Symfony Applications - Symfony Live Berlin 2014
Dockerizing Symfony Applications - Symfony Live Berlin 2014Dockerizing Symfony Applications - Symfony Live Berlin 2014
Dockerizing Symfony Applications - Symfony Live Berlin 2014
 
Installation of lammps-5Nov14 on Mac OS X Yosemite
Installation of lammps-5Nov14 on Mac OS X YosemiteInstallation of lammps-5Nov14 on Mac OS X Yosemite
Installation of lammps-5Nov14 on Mac OS X Yosemite
 
Docker perl build
Docker perl buildDocker perl build
Docker perl build
 
InstallingRoRinLinux
InstallingRoRinLinuxInstallingRoRinLinux
InstallingRoRinLinux
 
InstallingRoRinLinux
InstallingRoRinLinuxInstallingRoRinLinux
InstallingRoRinLinux
 
Oracle11g On Fedora14
Oracle11g On Fedora14Oracle11g On Fedora14
Oracle11g On Fedora14
 
Oracle11g on fedora14
Oracle11g on fedora14Oracle11g on fedora14
Oracle11g on fedora14
 
Linux Troubleshooting
Linux TroubleshootingLinux Troubleshooting
Linux Troubleshooting
 

More from Manish Chopra

Big-Data-Seminar-6-Aug-2014-Koenig
Big-Data-Seminar-6-Aug-2014-KoenigBig-Data-Seminar-6-Aug-2014-Koenig
Big-Data-Seminar-6-Aug-2014-Koenig
Manish Chopra
 

More from Manish Chopra (20)

AWS and Slack Integration - Sending CloudWatch Notifications to Slack.pdf
AWS and Slack Integration - Sending CloudWatch Notifications to Slack.pdfAWS and Slack Integration - Sending CloudWatch Notifications to Slack.pdf
AWS and Slack Integration - Sending CloudWatch Notifications to Slack.pdf
 
Getting Started with ChatGPT.pdf
Getting Started with ChatGPT.pdfGetting Started with ChatGPT.pdf
Getting Started with ChatGPT.pdf
 
Grafana and AWS - Implementation and Usage
Grafana and AWS - Implementation and UsageGrafana and AWS - Implementation and Usage
Grafana and AWS - Implementation and Usage
 
Containers Auto Scaling on AWS.pdf
Containers Auto Scaling on AWS.pdfContainers Auto Scaling on AWS.pdf
Containers Auto Scaling on AWS.pdf
 
OpenKM Solution Document
OpenKM Solution DocumentOpenKM Solution Document
OpenKM Solution Document
 
Alfresco Content Services - Solution Document
Alfresco Content Services - Solution DocumentAlfresco Content Services - Solution Document
Alfresco Content Services - Solution Document
 
Jenkins Study Guide ToC
Jenkins Study Guide ToCJenkins Study Guide ToC
Jenkins Study Guide ToC
 
Ansible Study Guide ToC
Ansible Study Guide ToCAnsible Study Guide ToC
Ansible Study Guide ToC
 
Microservices with Dockers and Kubernetes
Microservices with Dockers and KubernetesMicroservices with Dockers and Kubernetes
Microservices with Dockers and Kubernetes
 
Unix and Linux Operating Systems
Unix and Linux Operating SystemsUnix and Linux Operating Systems
Unix and Linux Operating Systems
 
Working with Hive Analytics
Working with Hive AnalyticsWorking with Hive Analytics
Working with Hive Analytics
 
Preparing a Dataset for Processing
Preparing a Dataset for ProcessingPreparing a Dataset for Processing
Preparing a Dataset for Processing
 
Organizations with largest hadoop clusters
Organizations with largest hadoop clustersOrganizations with largest hadoop clusters
Organizations with largest hadoop clusters
 
Distributed File Systems
Distributed File SystemsDistributed File Systems
Distributed File Systems
 
Difference between hadoop 2 vs hadoop 3
Difference between hadoop 2 vs hadoop 3Difference between hadoop 2 vs hadoop 3
Difference between hadoop 2 vs hadoop 3
 
Oracle solaris 11 installation
Oracle solaris 11 installationOracle solaris 11 installation
Oracle solaris 11 installation
 
Big Data Analytics Course Guide TOC
Big Data Analytics Course Guide TOCBig Data Analytics Course Guide TOC
Big Data Analytics Course Guide TOC
 
Emergence and Importance of Cloud Computing for the Enterprise
Emergence and Importance of Cloud Computing for the EnterpriseEmergence and Importance of Cloud Computing for the Enterprise
Emergence and Importance of Cloud Computing for the Enterprise
 
Setting up a HADOOP 2.2 cluster on CentOS 6
Setting up a HADOOP 2.2 cluster on CentOS 6Setting up a HADOOP 2.2 cluster on CentOS 6
Setting up a HADOOP 2.2 cluster on CentOS 6
 
Big-Data-Seminar-6-Aug-2014-Koenig
Big-Data-Seminar-6-Aug-2014-KoenigBig-Data-Seminar-6-Aug-2014-Koenig
Big-Data-Seminar-6-Aug-2014-Koenig
 

Recently uploaded

Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 

Recently uploaded (20)

Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Kraków
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
 
GraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisGraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysis
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 

Steps to create an RPM package in Linux

  • 1. Creating RPM package in Linux This exercise was done on RHEL 6 and same steps are applicable for other variants too. This tutorial provides you with steps to create your own RPM packages in Linux. Following procedure shows creating a basic RPM package that includes a shell script. After the RPM is installed, the script is executed on the command prompt to display the output. Step 1 – Install necessary RPM dependencies [student@desktop3 ~]$yum install rpm-build–y Step 2 – Setup your package in a directory [student@desktop3 ~]$mkdir myrpm-1.0 [student@desktop3 ~]$cd myrpm-1.0 (Create a simple script which executes after installing the rpm) [student@desktop3 ~]$ vi myrpm.sh #!/bin/bash # echo 'Hello There ! This is my RPM script...' exit 0 (Make the script executable) [student@desktop3 ~]$ chmod a+x myrpm.sh Step 3 – Create a tar file of your package [student@desktop3 ~]$ mkdir -p ~/rpmbuild/SOURCES [student@desktop3 ~]$ mkdir -p ~/rpmbuild/SPECS [student@desktop3 ~]$ tar -zcvf ~/rpmbuild/SOURCES/myrpm-1.0-1.tar.gz myrpm-1.0/ Step 4 – Create and edit SPEC file [student@desktop3 ~]$ vi ~/rpmbuild/SPECS/myrpm.spec Name: myrpm Version: 1.0 Release: 1 Summary: MyRPM Group: RHCE License: GPL URL: http://www.redhat.com Source0: %{name}-%{version}-%{release}.tar.gz BuildRoot: /var/tmp/%{name}-buildroot %description Installs /root/bin/myrpm.sh %prep %setup -q -n %{name}-%{version}
  • 2. %build %install rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/root/bin install -m 755 myrpm.sh $RPM_BUILD_ROOT/root/bin/myrpm.sh %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) /root/bin/myrpm.sh %changelog Step 5 – Execute rpmbuild to build the RPM package [student@desktop3 ~]$rpmbuild -ba rpmbuild/SPECS/myrpm.spec Step 6 – Install and Run the RPM package [root@desktop3 ~]# rpm -ivh /home/student/rpmbuild/RPMS/x86_64/myrpm-1.0-1.x86_64.rpm Preparing... ########################################### [100%] 1:myrpm ########################################### [100%] [root@desktop3 ~]# ll /root/bin/myrpm.sh -rwxr-xr-x. 1 root root 131 Jun 29 17:19 /root/bin/myrpm.sh [root@desktop3 ~]# myrpm.sh Hello There ! This is my RPM script... Document Version 1 Date : 29th June 2012 Author : Manish Chopra