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 execut...
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.
Size: 709.47 KB
Language: en
Added: Jun 19, 2016
Slides: 2 pages
Slide Content
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