User Tools

Custom Repositories

Portage (Gentoo's package manager) is based on package repositories. It might happen that you need some software which has not been packaged on official Gentoo repository yet or maybe you want to thinker with a newer release that did not hit the official repo yet.

Another great point of Gentoo is that it's really simple to create your own package repository and use it alongside the official one.

The following links are exhaustive information that you should read carefully and are the source of this page info:

You can create it manually, but i think it's better to leverage the eselect-repository tools. Emerge the following packages if you odn't have them yet:

 > emerge app-eselect/eselect-repository pkgdev

Then use the eselect repository to create your new repo, let's call it myrepo:

 > eselect repository create myrepo

The repo will be created under /var/db/repos/local and i storngly suggest you treat it like a GIT repository:

 > cd /var/db/repos/local/
 > git init
 > git add .
 > git commit -m "Initial commit" -a

I have encountered a bug in the repo creation that will not populare correctly the /etc/portage/repos.conf/eselect-repo.conf file, check that you have the official repo in the list. You need to have the following section in that file:

[gentoo]
location = /var/db/repos/gentoo

Add it, if missing.

Here you can also move your myrepo somewhere else if you prefer a different location than default.

Now, Gentoo package manager is based on ebuild files which are recipes to download and build your packages. You need to create (or download) an ebuild to add to your repository. This guide will teach you how to write ebuilds yourself.

I will assume you have your ebuild called myapp under the app-misc category, this ebuild will have version 1.0.0, so it's filename will be: myapp-1.0.0.ebuild and you will need to copy it to /var/db/repos/myrepo/app-misc/myapp/myapp.ebuild.

At this point, you need to create the manifest for the ebuild, which includes downloading the associated sources/binaries/patches and calculate checksums:

 > cd /var/db/repos/myrepo/app-misc/myapp 
 > pkgdev manifest
 > chown -R portage:portage /var/db/repos/myrepo

And don't forget to properly apply permissions to the entire repo: it needs to be owned by user and group portage.

That's it, you can now simply:

 > emerge myapp

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also, you acknowledge that you have read and understand our Privacy Policy. If you do not agree, please leave the website.

More information