Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How to create an RPM repository
# How to create an RPM repository
# This is for Redhat 64 bit versions of Linux. You can create your own RPM repository # to host your custom RPM packages.
# See "How to create an RPM from source with spec file" for more information.
# Step: 1
# Install createrepo
yum install -y createrepo
# Step: 2
# Create repo directories for hosting your rpms.
# Create your repository inside your base directory. You will also need some rpms for
# your repo. For this example, I am using RHEL6 and /var/www/repo as base directory.
mkdir -p /var/www/repo/rhel/6/{SRPMS,x86_64}
# Step: 3
# Create `create-repo-metadata` executable file
# Use the `create-repo-metadata` command, which can create by downloading a shell
# script and making it an executable file. Make sure this file is in a directory in
# your $PATH. Run the command `echo $PATH` to list them. Install in /usr/local/bin
# IMPORTANT: In the script above, replace the path in 'DESTDIR' with:
# /var/www/repo/rhel/6
curl > /usr/local/bin/create-repo-metadata
chmod +x /usr/local/bin/create-repo-metadata
# Step: 4
# Create the repository metadata
# After creating the metadata, your repository will be ready for use
# Tip!
# If you have made this repo publicly available, others can use this yum repo config
# file to update their own systems.
# Run `vi /etc/yum.repos.d/my.repo` to create the file
name=My Repository
# Then simply run `yum update` to install the rpms.
yum update

This comment has been minimized.

Copy link

irab commented May 28, 2016

Your link is broken (301 error). I'm assuming you want to point to


This comment has been minimized.

Copy link

bateller commented Jan 29, 2019

@irab That seems to be correct. He tried linking directly to the "raw" version of gist #1377169 however the link is outdated.

The latest (as of right now, might be outdated in the future) raw gist to change the link on line 31 is:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.