الفلاتر
طريقة البحث
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • "كلمتان" تجد العبارة بالضبط.
  • --name أو -x تجد خيارًا.
  • #كلمة تبحث داخل الأوامر فقط.
  • @grep تجد الدروس والمعامل التي تستخدم grep.
  • الفلاتر: cat:network · in:labs · level:rhcsa · ch:8 · root:yes. ضع ! قبل كلمة لاستبعادها. OR بين الكلمات تعني إحداها.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث

createrepo

Create the index (repodata) for a folder of RPM files, so dnf can use it as a repository.

المستوى
لينكس اليومي
المجموعة
حزم البرامج
يحتاج root
للتغييرات
الحزمة
createrepo_c
يُسمّى أيضًا
createrepo_c

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

ماذا يفعل

A repository is just a folder with .rpm files and a repodata/ folder with the index. createrepo DIR (on RHEL the fast C version createrepo_c) reads all packages and writes the index. Then point a .repo file to the folder (baseurl=file:///DIR) or share it with a web server.

After you add or remove packages, run it again with --update (faster).

طريقة الكتابة

createrepo [OPTION]... DIRECTORY

الخيارات 21

الأكثر استخدامًا

--update
Reuse old data; only read new or changed packages.
-o, --outputdir DIR
Write repodata to another folder.
-x, --excludes PATTERN
Leave out packages matching the pattern.
-i, --pkglist FILE
Only the packages listed in the file.
-n, --includepkg PACKAGE
Add this package file (more allowed).
-g, --groupfile FILE
Add a comps file with package groups.
-s, --checksum TYPE
Checksum type (sha256 default).
--workers N
Number of worker threads.
-d, --database
Also create SQLite databases.
--no-database
Do not create SQLite databases.
--skip-stat
Do not check file times with --update.
--retain-old-md N
Keep this many old metadata files.
--revision TEXT
Set a revision string.
--distro TEXT, --content TEXT, --repo TEXT
Add tags to the metadata.
--compress-type TYPE
Compression of metadata (gz, xz, zstd …).
--zck
Also create zchunk metadata.
--deltas
Create delta RPMs.
-q, --quiet
Quiet.
-v, --verbose
Verbose.
-V, --version
Show the version.
-h, --help
Show help.

أمثلة 10

$ مستخدم عادي# بصلاحية root (أو مع sudo)

  1. 1Install the tool

    dnf install -y createrepo_c

    Gives the createrepo and createrepo_c commands.

  2. 2Make a repository of a folder

    createrepo /srv/myrepo

    Creates /srv/myrepo/repodata/.

  3. 3Use it on this machine

    cat /etc/yum.repos.d/myrepo.repo
    [myrepo]
    name=My packages
    baseurl=file:///srv/myrepo
    gpgcheck=0

    Then dnf repolist shows it.

  4. 4Update after adding packages

    cp new-tool-2.0-1.el10.x86_64.rpm /srv/myrepo/; createrepo --update /srv/myrepo

    Faster than a full run.

  5. 5Share the repository over HTTP

    dnf install -y httpd; ln -s /srv/myrepo /var/www/html/myrepo

    Clients use baseurl=http://server1/myrepo (check SELinux labels: restorecon or semanage fcontext).

  6. 6Build an offline mirror of needed packages

    dnf download --resolve --destdir=/srv/myrepo ansible-core
    createrepo /srv/myrepo

    For servers without internet.

  7. 7Add package groups

    createrepo -g comps.xml /srv/myrepo

    Then dnf group list shows your groups.

  8. 8Leave out test packages

    createrepo -x '*-debuginfo-*' /srv/myrepo

    Smaller index.

  9. 9Sign your packages (security)

    rpm --addsign /srv/myrepo/*.rpm

    Needs a GPG key in ~/.rpmmacros; then clients can use gpgcheck=1.

  10. 10Clean the dnf cache after changes

    dnf clean metadata; dnf makecache

    Clients see the new packages.

رموز الخروج

0 :: Done. 1 :: Error.

الدليل الكامل

هذه الصفحة تشرح الأمر بكلمات بسيطة. الدليل الأصلي فيه كل التفاصيل.

في الطرفية: man 8 createrepo