Created
November 18, 2011 16:34
-
-
Save fernandoaleman/1376973 to your computer and use it in GitHub Desktop.
How to create an RPM from source with spec file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to create an RPM from source with spec file | |
# This is for Redhat versions of linux. Sometimes when you search for an rpm package, | |
# it is either outdated or not available. The only thing available is the source code. | |
# You can create a custom RPM package from source. | |
# | |
# For this example, I'll be using the latest version of Git, currently v.1.7.7.3 | |
# Step: 1 | |
# Install rpmbuild | |
yum install -y rpm-build | |
# Step: 2 | |
# Create rpmbuild folders in your home directory | |
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} | |
# Step: 3 | |
# Download the source file | |
# | |
# Source files are usually available in tar.gz or tar.bz2 format. Create a src folder | |
# in your home directory to store your files, download the file, uncompress it and | |
# move the compressed file to the rpm build SOURCES directory | |
mkdir -p ~/src && cd ~/src | |
wget http://git-core.googlecode.com/files/git-1.7.7.3.tar.gz | |
tar -xzvf git-1.7.7.3.tar.gz | |
mv git-1.7.7.3.tar.gz ~/rpmbuild/SOURCES | |
# Step: 4 | |
# Locate .spec file and 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. | |
cd ~/src/git-1.7.7.3 && ls | grep *.spec | |
rpmbuild -ba git.spec |
do you know how can i change the path from /usr/bin to /opt/git/bin?
I'm needing to do exactly this but we're on git 2.22 now and I fail to understand how to get the git.spec
file.
git-2.22.0]# make git.spec
make: *** No rule to make target `git.spec'. Stop.
or
git-2.22.0]# ll git.spec
ls: cannot access git.spec: No such file or directory
I'm needing to do exactly this but we're on git 2.22 now and I fail to understand how to get the
git.spec
file.git-2.22.0]# make git.spec
make: *** No rule to make target `git.spec'. Stop.
or
git-2.22.0]# ll git.spec
ls: cannot access git.spec: No such file or directory
I have the same problem :(
I tried with different package and got error
install: cannot stat 'postfix_exporter': No such file or directory
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On newer git versions
git.spec
needs to be built from template: