Package Managers

55
Package Managers What are they and why we use them

description

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 - PowerPoint PPT Presentation

Transcript of Package Managers

Page 1: Package Managers

Package ManagersWhat are they and why we use them

Page 2: Package Managers

Thoughts of an adminInstalling software is painfulInstalling a lot of software is

extremely painfulInstalling a lot of software on a

lot of machines is HELL

Page 3: Package Managers

舉例 - LOL天賦、符文道具

Page 4: Package Managers

Before PackagesInstall from sourceTime consumingVarying configuration

Page 5: Package Managers

Improvement 1Copy the binariesSetup scripts?Version?Dependencies?

Page 6: Package Managers

Package - BasicArchiveBinariesSupporting filesSetup script

Page 7: Package Managers

Package – ImprovementVersioning

◦1.0.x◦1.1.x◦…

Upgrades!

Page 8: Package Managers

Package - DependenciesProgram A requires library B to

workIf library C is available, program

A will work better/faster!

Page 9: Package Managers

Example – Call of DutyRequires: DirectXWorks better with: PhysX

Page 10: Package Managers

Package ManagersLow Level

Unpacking packagesRun configuration scriptsDependency checks…

Page 11: Package Managers

Package ManagersHigh Level Usage

Fetch from remote repositoriesSearchInstall additional packages to

meet dependenciesHandle complex upgrades

Page 12: Package Managers

Package RepositoryCollection of packagesMaintained by distributionMultiple package versionsPackage index

Page 13: Package Managers

Package ManagersRPM Based DEB Based

Low level RPM DpkgHigh level YUM, up2date, … APT

Page 14: Package Managers

DEBIAN DPKG & APTFocus on

Page 15: Package Managers

Types of PackagesBinary PackageMeta PackageVirtual Package

Page 16: Package Managers

Binary PackageNormal packageSource is availableArchitecture

◦Dependent Compiled binary files

◦Independent Scripts Documents Data files

Page 17: Package Managers

Meta PackageDepends on other packages onlyRename

◦git-core -> gitDefault version

◦gcc -> gcc-4.6◦Python -> python2.7

Can be creative!

Page 18: Package Managers

Virtual PackageDoes not really existNames common functionalityOther binary packages “provide”

a virtual packagec-compiler is provided by

◦gcc◦gcc-4.6◦clang

Page 19: Package Managers

Commonly Used Commandsapt-getapt-cacheaptitude

◦Frontend to the first 2 commands

Page 20: Package Managers

Search for a packageapt-cache search ^vim$

Search pattern

State flags

Page 21: Package Managers

Search PatternsPatterns are regular expressionsAptitude supports complex

patterns◦See reference

Search requires guessing◦Just like Googling◦Keywords

Page 22: Package Managers

DifferencesAptitude and apt-cache have

slighty different search behavior◦Aptitude looks at package name only◦Apt-cache looks at description as

well

Page 23: Package Managers

State Flagsi Installedc Removedp Purgedv Virtual packageB Broken dependenciesu UnpackedC Half-configuredH Half-installed

Page 24: Package Managers

Try it!You want to install a web server.

What do you look for?What should you actually install?

Page 25: Package Managers

Looking at a packageWeb interface

◦http://packages.debian.orgCLI

◦apt-cache show XXX◦aptitude show XXX

Debian Control FileTry it now!

Page 26: Package Managers
Page 27: Package Managers

Package InfoNameStateVersionPrioritySectionMaintainerArchitectureDependenciesDescription

Page 28: Package Managers

Package Info - Stateinstallednot installedremoved…

Page 29: Package Managers

Package Info - VersionVim: 2:7.3.547-6

2: -> Epoch7.3.547 -> Upstream version-6 -> Debian package revision

Page 30: Package Managers

Package Info - PriorityRequiredImportantStandardOptionalExtra

Page 31: Package Managers

Package Info - DependenciesDependsRecommendsSuggestsConflictsReplacesBreaksProvidesSyntax:

http://www.debian.org/doc/debian-policy/ch-relationships.html

Page 32: Package Managers

Installing / Removingapt-get install XXXaptitude install XXX

remove/purgehold/unholdupgradedist-upgrade

Page 33: Package Managers

remove vs. purgeRemove keeps config files in

systemPurge = Remove + delete config

files

Page 34: Package Managers

hold/unholdKeep a package at a specific

state/version unless explicitly request otherwise

Page 35: Package Managers

upgrade vs. dist-upgradeupgrade only updates currently

installed packagesdist-upgrade will do anything to

satisfy all new dependencies

Page 36: Package Managers

Try it!Install a web serverThen remove itSee that config files are still thereThen purge it

Page 37: Package Managers

MAKING A PACKAGE

Page 38: Package Managers

Why?CustomizeSoftware not packaged yet

◦Become a maintainer?Build your own

Page 39: Package Managers

Making your first packageBasic 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

Page 40: Package Managers

Homework – Build a meta package

Name: nasa-hwShould always install

◦gcc >= 1:4.7◦make > 3.80

Should not install when◦clang is installed

Maintainer: Your ID <your email>Use your judgment for other fields

◦Read the documents!Submit control file

Page 41: Package Managers

Too simple?Debian related source code

◦source/debian/rules◦source/debian/control◦source/debian/changelog◦source/debian/…

Page 42: Package Managers

Guidelines for packagingDebian 新維護人員手冊

◦http://www.debian.org/doc/manuals/maint-guide/

Get other package sources and see how other people do it◦apt-get source XXX

Page 43: Package Managers

Packages for packagingbuild-essentialdpkg-devdebhelperCDBSdh_makelintian

Page 44: Package Managers

build-essentialMeta package that depends on

essential tools for packagingYou need to install additional

tools/libraries◦debhelper, cdbs, …◦lib*-dev

Page 45: Package Managers

dpkg-devBasic tools for package

developmentdpkg-buildpackage

Page 46: Package Managers

DebhelperCollection of commands to assist

packagingWraps complex steps

◦Splitting files between different packages

◦Generating shared library dependencies

◦Generate and sign binary packages◦…

Page 47: Package Managers

CDBSCommon Debian Build SystemClass based systemSupports different build systems

◦make, ant, cmake, …http://www.slideshare.net/peterei

sentraut/the-common-debian-build-system-cdbs

Page 48: Package Managers

dh_makePrepare source code for

packagingAlways uses debhelperSupports CDBS

Page 49: Package Managers

lintianCheck packages for errors

Page 50: Package Managers

Steps to packaging1. Get source code2. Unpack3. dh_make4. Install build dependencies5. Check control file6. Check installation paths7. Build package

◦ dpkg-buildpackage –b8. Check package contents, debug if

nessecary◦ dpkg-deb –c xxx.deb

Page 51: Package Managers

Packaging Tutorialhttp://www.debian.org/doc/manu

als/maint-guide/first.en.html

Page 52: Package Managers

Try if you wantLast semester’s homework

◦Very hardBuild a package of “Omnitty”

◦http://omnitty.sourceforge.net/You will also need to build a

package for “ROTE”◦http://omnitty.sourceforge.net/

Build it, install it, and try it out

Page 53: Package Managers

TipsPackages you can look at

◦libevent◦screen◦tmux◦make

Page 54: Package Managers

HOMEWORK RECAP

Page 55: Package Managers

nasa-hw meta packageUpload control file to CEIBAStart sooner! You need to do

research to finish this assignment.