Skip to content

Instantly share code, notes, and snippets.

@VeryCrazyDog
Last active August 29, 2015 14:16
Show Gist options
  • Save VeryCrazyDog/1d1fef411d9e20f4c12b to your computer and use it in GitHub Desktop.
Save VeryCrazyDog/1d1fef411d9e20f4c12b to your computer and use it in GitHub Desktop.
Building Linux RPM Package from Source Code
# Building Linux RPM Package from Source Code
# Referencing from https://gist.github.com/fernandoaleman/1376973
# Step: 1
# Install rpmbuild
yum install rpm-build
# Step: 2
# Create rpmbuild folders in your home directory
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
# Step: 3
# Download the source file
wget -P ~/rpmbuild/SOURCES "http://git-core.googlecode.com/files/git-1.7.7.3.tar.gz"
tar -xzvf ~/rpmbuild/SOURCES/git-1.7.7.3.tar.gz -C /tmp
# Step: 4
# Prepare the .spec file, and made any necessary changes
#
# If the source file did not include .spec file, you have to prepare one by your own
ls -l /tmp/git-1.7.7.3/*.spec
cp -p /tmp/git-1.7.7.3/git.spec ~/rpmbuild/SPECS
vim ~/rpmbuild/SPECS/git.spec
# Step: 5
# Build rpm
#
# If you get any errors during build, it is usually because of dependencies. Simply
# install the dependencies with `yum install [dependency]` and run rpmbuild again.
rpmbuild -ba --define "_topdir %(echo $HOME)/rpmbuild" ~/rpmbuild/SPECS/git.spec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment