This blog is formatted using Jekyll and I use the
jekyll-redirect-from plugin to do URL redirection, so that old blog
posts migrated my former blog platform can still be accessed via the
My regular desktop operating system and Jekyll has been packaged by
Fedora for some years. However, most plugins, including
jekyll-redirect-from, are NOT packaged by Fedora.
In the past, this has led me to have to muck about with other package tools, like gem or pip. I don’t like it. They put stuff in weird places, duplicate system provided dependencies and just cause a mess.
No…call me stubborn, but I’d just like a nice simple RPM packages. Thank you very much.
Enter Fedora Copr. Copr is a front-end to Fedora’s package build system that allows one to build custom RPM packages and host them in a personal, publicly-accesible, yum repositories.
Copr has been around for a while, and I play around building some Emacs packages about 4 years ago, but it’s become substantially easier.
In just a few commands, I can have the Jekyll plugin I want, or really most Gems, converted to an RPM and available for me to install.
First, in order to use Copr, a Fedora Account is required. Signing up for one is free and relatively easy.
Next, I’d highly recommend getting the
copr-cli package installed on
your Fedora machine. It’s part of the default Fedora repositories, so
it should be as simple as
dnf install copr-cli.
Almost all of the tasks could be done through the Copr Web UI, but in
this post, I’m using
Next, populate the Copr token by visiting https://copr.fedorainfracloud.org/api/
Put the output there into
~/.config/copr. It should look something
[copr-cli] login = gibberish username = your_user_name token = gibberish copr_url = https://copr.fedorainfracloud.org # expiration date: 2022-07-09
copr whoami should now return your Fedora Account name:
[chale@work-wired ~]$ copr whoami xlark
Creating a project
The first step is to create a project. This acts as your yum repository. It’s possible to create multiple projects, if desired.
For example, I have an
emacs project for Emacs related packages, and
I created a
jekyll-gems project for all the Jekyll Gems I intend to
To create a project named
jekyll-gems, run the following command:
[chale@work-wired ~]$ copr-cli create --chroot fedora-35-x86_64 jekyll-gems New project was successfully created.
--chroot fedora-35-x86_64 specificies the package build
environment. There are many different options. Fedora 35 seemed
reasonable to me, since I’m currently using it, although rawhide may
be a more future proof selection.
Building the Package
Now that we have a project, building a package from a Gem file in just one command:
[chale@work-wired ~]$ copr-cli buildgem --gem jekyll-redirect-from jekyll-gems Build was added to jekyll-gems: https://copr.fedorainfracloud.org/coprs/build/3144944 Created builds: 3144944 Watching build(s): (this may be safely interrupted) 17:17:28 Build 3144944: pending 17:17:58 Build 3144944: running 17:20:28 Build 3144944: succeeded
This builds an RPM from the Gem,
jekyll-redirect-from into the project
jekyll-redirect-from is hosted on
RubyGems, Copr pulls the Gem file directly
from there without any additional information required.
After the build has succeeded, the package is ready to install!
Installing the Package
First enable your Copr repository. The name should always be in the form of “Fedora Account/Project Name”:
[chale@work-wired ~]$ sudo dnf copr enable xlark/jekyll-gems Enabling a Copr repository. Please note that this repository is not part of the main distribution, and quality may vary. The Fedora Project does not exercise any power over the contents of this repository beyond the rules outlined in the Copr FAQ at <https://docs.pagure.org/copr.copr/user_documentation.html#what-i-can-build-in-copr>, and packages are not held to any quality or security level. Please do not file bug reports about these packages in Fedora Bugzilla. In case of problems, contact the owner of this repository. Do you really want to enable copr.fedorainfracloud.org/xlark/jekyll-gems? [y/N]: y Repository successfully enabled.
After that, we can just install the package like normal! By Fedora standards, all RPMs for Gems are always prefixed by “rubygem-“
[chale@work-wired ~]$ sudo dnf install rubygem-jekyll-redirect-from Copr repo for jekyll-gems owned by xlark 15 kB/s | 2.6 kB 00:00 Dependencies resolved. ===================================================================================================================================== Package Architecture Version Repository Size ===================================================================================================================================== Installing: rubygem-jekyll-redirect-from noarch 0.16.0-1.fc35 copr:copr.fedorainfracloud.org:xlark:jekyll-gems 14 k Transaction Summary ===================================================================================================================================== Install 1 Package Total download size: 14 k Installed size: 9.8 k Is this ok [y/N]:
Sharing your project
Projects and their corresponding repositories created in Copr are
public. Anyone running Fedora can enable your repository using
Others can benefit from whatever you package using Copr, so if you package something useful, feel free to share with others!