LinuxCommandLibrary

createrepo

Create a YUM repository

TLDR

Initialize a basic repository in a directory

$ createrepo [path/to/directory]
copy

Initialize a repository, exclude test RPMs and display verbose logs
$ createrepo [[-v|--verbose]] [[-x|--excludes]] [test_*.rpm] [path/to/directory]
copy

Initialize a repository, using SHA1 as the checksum algorithm, and ignoring symbolic links
$ createrepo [[-S|--skip-symlinks]] [[-s|--checksum]] [sha1] [path/to/directory]
copy

SYNOPSIS

createrepo [options]

PARAMETERS

-u
    Set the base URL for the repository metadata.

-g
    Specify a group file to include package groups in the repository metadata.

-v
    Enable verbose output.

-q
    Run quietly. Suppress all output except errors.

-n
    Do not update the repository metadata if it already exists.

-p
    Keep the original packages in the repository directory.

-o
    Specify the output directory for the repository metadata.

--update
    Only update the existing repository metadata.

--unique-id
    Sets the unique ID string of the repository.

--checksum
    Override the checksum type (sha256, sha1, md5).

--database
    Create sqlite database (default).

--no-database
    Do not create sqlite database.

DESCRIPTION

The createrepo command generates the necessary metadata for a Yum repository from a directory containing RPM packages. It scans the RPM headers within the specified directory, indexing the packages and their dependencies. This metadata is then used by Yum clients to resolve dependencies and install packages from the repository.
createrepo makes it easier to manage your own software repositories. It is an integral part of distributing packages locally or creating mirrors of existing repositories.
It supports various options for customization, including controlling the type of metadata generated (SQLite vs. XML) and adding extra information to the repository. It is a core command for any sysadmin managing RPM-based systems.

CAVEATS

createrepo only processes RPM files. Any other files in the directory will be ignored. Make sure the user running createrepo has write access to the directory where the repository metadata is being created.

DIRECTORY STRUCTURE

createrepo will generate the `repodata` directory within the specified directory. This `repodata` directory contains all the metadata needed by Yum.

POST-CREATION STEPS

After running createrepo, ensure that your web server or file server is configured to serve the contents of the repository directory. Also, update your Yum client configuration to point to the new repository location.

HISTORY

createrepo has been around for a long time, evolving alongside the Yum package manager. It was created to simplify the process of building and maintaining Yum repositories. Over time, it has been enhanced to support various features, including different checksum algorithms and metadata formats to improve the efficiency and security of package management.

SEE ALSO

yum(8), repoquery(1), rpm(8)

Copied to clipboard