I created my own linux distro (if you can call it that) and the last thing want to do is to create my own package manager and I have no idea on how to do this. How can I create something like apt, yum etc. What are some good resources on this?

  • 1
    Why not use apt or yum or some other existing package manager? This is what most other distributions do. It does not mean that you need to use their package repositories. – Kusalananda Nov 20 '20 at 10:20

All package managers work the same way which is not exactly too difficult to mimic, the question is implementation details.

  1. If you don't want to use your own package format, e.g. something akin to RPM or DEB, you can simply use tar.gz

  2. Within this tar.gz file you can you have your package files and auxiliary files which contain: description, list of files (if you want allow the user to search for files without extracting the whole archive) and dependencies (might be a simple list of files).

  3. Building dependencies is not a rocket science either. You can use ldd or/and strace.

  • Now you have to create a dababase of packages files and dependencies which you can store in e.g. Berkley DB or SQLite DB.

  • Then you have to find a way to scan these dependencies whenever the user wants to install a new package

  • Lastly you need to have a database of installed files and packages.

This all involves a ton of code. You'd be better off using something which is already available.

Lastly, of course you can reinvent the wheel and do it all but there are literally thousands of bug reports filed against Open Source projects which you could help by fixing them. No one really needs a new obscure distro which you will maintain for a while and then get rid of, because you don't have enough time for it or you're not motivated enough for various reasons.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.