1 / 54

Package Managers

Package Managers. What are they and why we use them. Thoughts of an admin. Installing software is painful Installing a lot of software is extremely painful Installing a lot of software on a lot of machines is HELL. 舉例 - LOL. 天賦、符文 道具. Before Packages. Install from source

mariel
Download Presentation

Package Managers

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Package Managers What are they and why we use them

  2. Thoughts of an admin • Installing software is painful • Installing a lot of software is extremely painful • Installing a lot of software on a lot of machines is HELL

  3. 舉例 - LOL • 天賦、符文 • 道具

  4. Before Packages • Install from source • Time consuming • Varying configuration

  5. Improvement 1 • Copy the binaries • Setup scripts? • Version? • Dependencies?

  6. Package - Basic • Archive • Binaries • Supporting files • Setup script

  7. Package – Improvement • Versioning • 1.0.x • 1.1.x • … • Upgrades!

  8. Package - Dependencies • Program A requires library B to work • If library C is available, program A will work better/faster!

  9. Example – Call of Duty • Requires: DirectX • Works better with: PhysX

  10. Package ManagersLow Level • Unpacking packages • Run configuration scripts • Dependency checks • …

  11. Package ManagersHigh Level • Fetch from remote repositories • Search • Install additional packages to meet dependencies • Handle complex upgrades

  12. Package Repository • Collection of packages • Maintained by distribution • Multiple versions • Index

  13. Package Managers

  14. Focus on Debian DPKG & APT

  15. Types of Packages • Binary Package • Meta Package • Virtual Package

  16. Binary Package • Normal package • Source is available • Architecture • Dependent • Compiled binary files • Independent • Scripts • Documents • Data files

  17. Meta Package • Depends on other packages only • Rename • git-core -> git • Default version • gcc -> gcc-4.6 • Python -> python2.7 • Can be creative!

  18. Virtual Package • Does not really exist • Names common functionality • Other binary packages “provide” a virtual package • c-compiler is provided by • gcc • gcc-4.6 • clang

  19. Commonly Used Commands • apt-get • apt-cache • aptitude • Frontend to the first 2 commands

  20. Search for a package • apt-cache search ^vim$ Search pattern State flags

  21. Search Patterns • Patterns are regular expressions • Aptitude supports complex patterns • See reference • Search requires guessing • Just like Googling

  22. Differences • Aptitude and apt-cache have slighty different behavior • Aptitude looks at package name only • Apt-cache looks at description as well

  23. State Flags

  24. Try it! • You want to install a web server. What do you look for? • What should you actually install?

  25. Looking at a package • Web interface • http://packages.debian.org • CLI • apt-cache show XXX • aptitude show XXX • Debian Control File • Try it now!

  26. Package Info • Name • State • Version • Priority • Section • Maintainer • Architecture • Dependencies • Description

  27. Package Info - State • installed • not installed • removed • …

  28. Package Info - Version • Vim: 2:7.3.547-6 • 2: -> Epoch • 7.3.547 -> Upstream version • -6 -> Debian package revision

  29. Package Info - Priority • Required • Important • Standard • Optional • Extra

  30. Package Info - Dependencies • Depends • Recommends • Suggests • Conflicts • Replaces • Breaks • Provides • Syntax: http://www.debian.org/doc/debian-policy/ch-relationships.html

  31. Installing / Removing • apt-get install XXX • aptitude install XXX • remove/purge • hold/unhold • upgrade • dist-upgrade

  32. remove vs. purge • Remove keeps config files in system • Purge = Remove + delete config files

  33. hold/unhold • Keep a package at a specific state/version unless explicitly request otherwise

  34. upgrade vs. dist-upgrade • upgrade only updates currently installed packages • dist-upgrade will do anything to satisfy all new dependencies

  35. Try it now! • Install a web server • Then remove it • See that config files are still there • Then purge it

  36. Making a Package

  37. Why? • Customize • Software not packaged yet • Become a maintainer? • Build your own

  38. Making your first package • Basic structure • package/XXX • Files you want to package • package/DEBIAN/control • Debian control file • package/DEBIAN/xxx • Package scripts, other control files • dpkg-deb –b package

  39. Homework – Build a meta package • Name: nasa-hw • Should always install • gcc no older than 4.7 • make newer than 3.80 • Should not install when • clang is installed • Maintainer: Your ID <your email> • Use your judgment for other fields • Read the documents! • Submit .deb file

  40. Too simple? • Debianrelated source code • source/debian/rules • source/debian/control • source/debian/changelog • source/debian/…

  41. Guidelines for packaging • Debian新維護人員手冊 • http://www.debian.org/doc/manuals/maint-guide/ • Get other package sources and see how other people do it • apt-get source XXX

  42. Packages for packaging • build-essential • dpkg-dev • debhelper • CDBS • dh_make • lintian

  43. build-essential • Meta package that depends on essential tools for packaging • You need to install additional tools/libraries • debhelper, cdbs, … • lib*-dev

  44. dpkg-dev • Basic tools for package development • dpkg-buildpackage

  45. Debhelper • Collection of commands to assist packaging • Wraps complex steps • Splitting files between different packages • Generating shared library dependencies • Generate and sign binary packages • …

  46. CDBS • Common Debian Build System • Class based system • Supports different build systems • make, ant, cmake, … • http://www.slideshare.net/petereisentraut/the-common-debian-build-system-cdbs

  47. dh_make • Prepare source code for packaging • Always uses debhelper • Supports CDBS

  48. lintian • Check packages for errors

  49. Steps to packaging • http://www.debian.org/doc/manuals/maint-guide/first.en.html • Get source code • Unpack • dh_make • Install build dependencies • Check control file • Check installation paths • Build package • dpkg-buildpackage -b

More Related